feat: several owners per organization, and handing ownership over
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 9m19s
ci / test (pull_request) Successful in 9m25s
ci / build (pull_request) Successful in 15m40s
ci / image (pull_request) Successful in 4m26s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 9m19s
ci / test (pull_request) Successful in 9m25s
ci / build (pull_request) Successful in 15m40s
ci / image (pull_request) Successful in 4m26s
An organization may now have several owners; the unique index allowing only one is gone. Owners make members owners or take it back, their own included, through PUT /api/v1/org/members/:user/owner; handing an organization over is making someone else owner and stepping down. The last owner cannot step down, and changes serialize on a per-organization lock so two owners stepping down at once cannot leave none. A former owner without roles keeps working as Admin. Owners still cannot be removed while they are owners. Deleting an account now takes along only the organizations it is the last owner of, counted under the same lock; it just leaves those with further owners. The members page offers "Make owner", "Remove as owner" and "Step down as owner" to owners. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
8d7c1f856c
commit
db3ff19983
23 files changed
+558
-115
No files matched your search
@@ -256,7 +256,7 @@ func (s *Server) securityPage(c *gin.Context) {
|
||||
internalError(c, err)
|
||||
return
|
||||
}
|
||||
if me.DeletesOrgs, err = s.ownedOrgs(ctx, sess.UserID); err != nil {
|
||||
if me.DeletesOrgs, err = s.lastOwnedOrgs(ctx, sess.UserID); err != nil {
|
||||
internalError(c, err)
|
||||
return
|
||||
}
|
||||
@@ -400,19 +400,26 @@ func (s *Server) membersView(c *gin.Context, p *principal, page web.Page, me web
|
||||
var (
|
||||
roles []store.Role
|
||||
pending []store.ListPendingInvitationsRow
|
||||
owners int64
|
||||
)
|
||||
err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
|
||||
var err error
|
||||
if roles, err = q.ListRoles(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
if owners, err = q.CountOwners(ctx, p.Org.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
pending, err = q.ListPendingInvitations(ctx)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v := web.MembersView{CanManage: p.Grants.Can(authz.MembersManage), Pager: pager(c, info)}
|
||||
v := web.MembersView{
|
||||
CanManage: p.Grants.Can(authz.MembersManage), Pager: pager(c, info),
|
||||
IsOwner: p.Grants.Owner, Self: p.UserID.String(), Owners: int(owners),
|
||||
}
|
||||
scopeNames, scopes, err := s.scopeOptions(ctx, p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in new issue
Block a user