Add ability to manage admin users. #3507
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new "owner" concept to the system, allowing for the designation of a specific administrative user as the owner of the installation. It adds support for managing ownership, including validation rules, configuration changes, and UI updates. Additionally, it enhances user management by introducing a
may_administrate
permission for more granular control over administrative rights.Ownership Management
owner_id
in theconfigs
table to track the owner of the installation, along with a migration to initialize this value based on existing administrators (database/migrations/2025_06_29_080951_create_owner.php
).OwnerConfigRule
to restrict changes to theowner_id
configuration to the current owner only (app/Rules/OwnerConfigRule.php
).OwnerIdRule
to enforce that only the owner can perform specific actions, such as deleting or modifying the owner account (app/Rules/OwnerIdRule.php
).Administrative Permissions
may_administrate
permission for users, allowing fine-grained control over administrative capabilities in user creation and update workflows (app/Actions/User/Create.php
,app/Actions/User/Save.php
). [1] [2]AddUserRequest
,SetUserSettingsRequest
) to handle themay_administrate
attribute, including validation and processing (app/Http/Requests/UserManagement/AddUserRequest.php
,app/Http/Requests/UserManagement/SetUserSettingsRequest.php
). [1] [2]Frontend Updates
may_administrate
permission, with a warning icon and special styling to indicate the significance of this permission (resources/js/components/forms/users/CreateEditUser.vue
).Additional Enhancements
UserManagementResource
to include anis_owner
field, which identifies if a user is the owner of the installation (app/Http/Resources/Models/UserManagementResource.php
).Configs
model to validate theowner_id
value against existing administrative users (app/Models/Configs.php
).