Skip to content

Commit

Permalink
Fix custom user update reconciliation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Saratura committed Apr 15, 2024
1 parent c9d0cab commit 55529f0
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions controllers/organization_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,19 @@ func (r *OrganizationReconciler) sync(or *OrganizationReconciliation, instance s

//create read permission for public user for this organisation
roleNameCustomUser := database.Spec.AddUserForNonHiddenGraphs
permsCustomUser := getOrganizationPerms(database, org, false, true)
err = createDefaultPermissions(stardogClient, auth, roleNameCustomUser, permsCustomUser)
if err != nil {
r.Log.Error(err, "Adding permission to role failed", "role", roleNameCustomUser, "permission", permsCustomUser)
return err
}
if roleNameCustomUser != "" {
permsCustomUser := getOrganizationPerms(database, org, false, true)
err = createDefaultPermissions(stardogClient, auth, roleNameCustomUser, permsCustomUser)
if err != nil {
r.Log.Error(err, "Adding permission to role failed", "role", roleNameCustomUser, "permission", permsCustomUser)
return err
}

err = adjustPermissionsForCustomUser(org, database, stardogClient, auth, roleNameCustomUser)
if err != nil {
r.Log.Error(err, "Cannot remove permissions")
return err
err = adjustPermissionsForCustomUser(org, database, stardogClient, auth, roleNameCustomUser)
if err != nil {
r.Log.Error(err, "Cannot remove permissions")
return err
}
}

return nil
Expand Down

0 comments on commit 55529f0

Please sign in to comment.