feat: add SetOrganizationMemberRole RPC by whoAbhishekSah · Pull Request #1471 · raystack/frontier · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
dc05755
chore: update proton commit for SetOrganizationMemberRole RPC
whoAbhishekSah Mar 23, 2026
aaa0520
feat: implement SetOrganizationMemberRole RPC
whoAbhishekSah Mar 23, 2026
aa8461a
docs: add rationale for org-only policy filter in SetMemberRole
whoAbhishekSah Mar 23, 2026
139bba1
chore: update proton commit after rebase
whoAbhishekSah Mar 23, 2026
7f7aa9b
chore: remove unintended docs files
whoAbhishekSah Mar 23, 2026
9d74518
fix: SetOrganizationMemberRole validation and owner check
whoAbhishekSah Mar 24, 2026
df5ff66
style: fix indentation in service_test.go
whoAbhishekSah Mar 24, 2026
f5560d7
refactor: simplify RoleService by using role.Role directly
whoAbhishekSah Mar 24, 2026
8e21f03
style: improve error handling readability in SetMemberRole
whoAbhishekSah Mar 24, 2026
cdf9491
refactor: rename roleID to newRoleID for clarity in SetMemberRole
whoAbhishekSah Mar 24, 2026
9e3922b
refactor: split SetMemberRole into smaller functions
whoAbhishekSah Mar 24, 2026
4e6b4cd
refactor: move role validation from handler to service
whoAbhishekSah Mar 24, 2026
c071f6a
refactor: consolidate validation into validateSetMemberRoleRequest
whoAbhishekSah Mar 24, 2026
24a6202
test: add table-driven tests for SetOrganizationMemberRole handler
whoAbhishekSah Mar 24, 2026
3691a82
test: add unit tests for SetMemberRole service function
whoAbhishekSah Mar 24, 2026
5c4dc8b
fix: validate user_id is a valid UUID in SetOrganizationMemberRole
whoAbhishekSah Mar 24, 2026
488fb21
fix: use distinct error for last owner role constraint
whoAbhishekSah Mar 24, 2026
02a3bc2
feat: use proto UUID validation for SetOrganizationMemberRole
whoAbhishekSah Mar 25, 2026
5cc97fc
refactor: address review feedback on SetMemberRole
whoAbhishekSah Mar 25, 2026
bb411e6
fix: require user to be org member before changing role
whoAbhishekSah Mar 25, 2026
9973227
feat: validate role is valid for organization scope
whoAbhishekSah Mar 25, 2026
6979c5b
fix: handle nil UUID for global role org_id check
whoAbhishekSah Mar 25, 2026
eae912d
chore: update proton commit and simplify role validation
whoAbhishekSah Mar 25, 2026
39f8e94
chore: regenerate proto with SearchCurrentUserPATsRequest rename
whoAbhishekSah Mar 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
2 changes: 1 addition & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func buildAPIDependencies(
postgres.NewFlowRepository(logger, dbc), mailDialer, tokenService, sessionService, userService, serviceUserService, webAuthConfig, patValidator)
groupService := group.NewService(groupRepository, relationService, authnService, policyService)
organizationService := organization.NewService(organizationRepository, relationService, userService,
authnService, policyService, preferenceService, auditRecordRepository)
authnService, policyService, preferenceService, auditRecordRepository, roleService)

userPATService := userpat.NewService(logger, userPATRepo, cfg.App.PAT, organizationService, roleService, policyService, auditRecordRepository)

Expand Down
15 changes: 9 additions & 6 deletions core/organization/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ package organization
import "errors"

var (
ErrNotExist = errors.New("org doesn't exist")
ErrInvalidUUID = errors.New("invalid syntax of uuid")
ErrInvalidID = errors.New("org id is invalid")
ErrConflict = errors.New("org already exist")
ErrInvalidDetail = errors.New("invalid org detail")
ErrDisabled = errors.New("org is disabled")
ErrNotExist = errors.New("org doesn't exist")
ErrInvalidUUID = errors.New("invalid syntax of uuid")
ErrInvalidID = errors.New("org id is invalid")
ErrConflict = errors.New("org already exist")
ErrInvalidDetail = errors.New("invalid org detail")
ErrDisabled = errors.New("org is disabled")
ErrLastOwnerRole = errors.New("cannot remove the last owner role")
ErrNotMember = errors.New("user is not a member of the organization")
ErrInvalidOrgRole = errors.New("role is not valid for organization scope")
)
95 changes: 95 additions & 0 deletions core/organization/mocks/role_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

158 changes: 157 additions & 1 deletion core/organization/service.go
Loading
Loading