mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-03 21:02:15 +00:00
feat: user grants command side (#1191)
* fix: user grant command side * fix: user grant command side * fix: user grant command side check permissions * fix: unique constraint on user grants * fix: add usergrant * fix: add usergrant * fix: add usergrant * fix: user grant remove * Update internal/v2/command/auth_checks.go Co-authored-by: Livio Amstutz <[email protected]> * Update internal/v2/command/auth_checks.go Co-authored-by: Livio Amstutz <[email protected]> * Update internal/v2/command/project.go Co-authored-by: Livio Amstutz <[email protected]> * Update internal/v2/command/user_grant.go Co-authored-by: Livio Amstutz <[email protected]> * fix: project events Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
@@ -54,6 +54,17 @@ func (r *CommandSide) getProjectByID(ctx context.Context, projectID, resourceOwn
|
||||
return projectWriteModelToProject(projectWriteModel), nil
|
||||
}
|
||||
|
||||
func (r *CommandSide) checkProjectExists(ctx context.Context, projectID, resourceOwner string) error {
|
||||
projectWriteModel, err := r.getProjectWriteModelByID(ctx, projectID, resourceOwner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if projectWriteModel.State == domain.ProjectStateUnspecified || projectWriteModel.State == domain.ProjectStateRemoved {
|
||||
return caos_errs.ThrowPreconditionFailed(nil, "COMMAND-4M0fs", "Errors.Project.NotFound")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *CommandSide) getProjectWriteModelByID(ctx context.Context, projectID, resourceOwner string) (*ProjectWriteModel, error) {
|
||||
projectWriteModel := NewProjectWriteModel(projectID, resourceOwner)
|
||||
err := r.eventstore.FilterToQueryReducer(ctx, projectWriteModel)
|
||||
|
||||
Reference in New Issue
Block a user