mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:07:31 +00:00
fix(console): general fixes, project grants for owned and granted context (#425)
* update and delete project grants * fix: user grant id (#421) * fix: verboser logging on sql err (#412) * fix(eventstore): improve insert statement * fix: verbose logging on error * fix: simplify insertEvents * fix: project grant delete (#417) * fix: add grant id to user grant if needed * fix: add grant id to user grant if needed Co-authored-by: Silvan <silvan.reusser@gmail.com> * fix user grant context * lint * role validators * fix: usergrantid (#424) * fix: verboser logging on sql err (#412) * fix(eventstore): improve insert statement * fix: verbose logging on error * fix: simplify insertEvents * fix: project grant delete (#417) * fix: add grant id to user grant if needed * fix: add grant id to user grant if needed * fix: add bulk remove * fix: merge Co-authored-by: Silvan <silvan.reusser@gmail.com> Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> Co-authored-by: Silvan <silvan.reusser@gmail.com>
This commit is contained in:
@@ -99,6 +99,7 @@ func userGrantViewFromModel(grant *grant_model.UserGrantView) *auth.UserGrantVie
|
||||
OrgName: grant.OrgName,
|
||||
ProjectId: grant.ProjectID,
|
||||
Roles: grant.RoleKeys,
|
||||
GrantId: grant.GrantID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -27,21 +27,6 @@ func (s *Server) UserGrantByID(ctx context.Context, request *management.UserGran
|
||||
return userGrantViewFromModel(user), nil
|
||||
}
|
||||
|
||||
func (s *Server) CreateUserGrant(ctx context.Context, in *management.UserGrantCreate) (*management.UserGrant, error) {
|
||||
user, err := s.usergrant.AddUserGrant(ctx, userGrantCreateToModel(in))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return usergrantFromModel(user), nil
|
||||
}
|
||||
|
||||
func (s *Server) UpdateUserGrant(ctx context.Context, in *management.UserGrantUpdate) (*management.UserGrant, error) {
|
||||
user, err := s.usergrant.ChangeUserGrant(ctx, userGrantUpdateToModel(in))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return usergrantFromModel(user), nil
|
||||
}
|
||||
func (s *Server) DeactivateUserGrant(ctx context.Context, in *management.UserGrantID) (*management.UserGrant, error) {
|
||||
user, err := s.usergrant.DeactivateUserGrant(ctx, in.Id)
|
||||
if err != nil {
|
||||
@@ -62,16 +47,6 @@ func (s *Server) RemoveUserGrant(ctx context.Context, in *management.UserGrantID
|
||||
return &empty.Empty{}, err
|
||||
}
|
||||
|
||||
func (s *Server) BulkCreateUserGrant(ctx context.Context, in *management.UserGrantCreateBulk) (*empty.Empty, error) {
|
||||
err := s.usergrant.BulkAddUserGrant(ctx, userGrantCreateBulkToModel(in)...)
|
||||
return &empty.Empty{}, err
|
||||
}
|
||||
|
||||
func (s *Server) BulkUpdateUserGrant(ctx context.Context, in *management.UserGrantUpdateBulk) (*empty.Empty, error) {
|
||||
err := s.usergrant.BulkChangeUserGrant(ctx, userGrantUpdateBulkToModel(in)...)
|
||||
return &empty.Empty{}, err
|
||||
}
|
||||
|
||||
func (s *Server) BulkRemoveUserGrant(ctx context.Context, in *management.UserGrantRemoveBulk) (*empty.Empty, error) {
|
||||
err := s.usergrant.BulkRemoveUserGrant(ctx, userGrantRemoveBulkToModel(in)...)
|
||||
return &empty.Empty{}, err
|
||||
|
@@ -80,6 +80,7 @@ func projectGrantUserGrantCreateToModel(u *management.ProjectGrantUserGrantCreat
|
||||
UserID: u.UserId,
|
||||
ProjectID: u.ProjectId,
|
||||
RoleKeys: u.RoleKeys,
|
||||
GrantID: u.ProjectGrantId,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,6 +173,7 @@ func userGrantViewFromModel(grant *grant_model.UserGrantView) *management.UserGr
|
||||
ProjectId: grant.ProjectID,
|
||||
OrgId: grant.ResourceOwner,
|
||||
DisplayName: grant.DisplayName,
|
||||
GrantId: grant.GrantID,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user