code0-tech / sagittarius

The orchestrating backend for the Code0 application
4 stars 0 forks source link

Prevent removing :organization_administrator ability from all roles #160

Closed Taucher2003 closed 2 months ago

Taucher2003 commented 2 months ago

When an organization is created, we automatically create a role with the :organization_administrator ability and assign that role to the user.

When this ability gets removed from the role and no other role has this ability, the organization can get unmanageable, because no user has the permission for that.

To prevent this, we should add a check in OrganizationRoles::AssignAbilitiesService and OrganizationRoles::DeleteService to ensure that at least one role still has the :organization_administrator ability and that other role is assigned to a user.