Fix and complete the administrator roles documentation - #353
Merged
Conversation
The list of the four standard administrator roles named "custom admin"
as the fourth role. That role does not exist. The fourth preconfigured
role is `system_admin` ("System admin" in the UI); "custom admin" is
neither a constant in `seahub/constants.py` nor a key in
`DEFAULT_ENABLED_ADMIN_ROLE_PERMISSIONS`.
Corrections and additions:
- Name all four standard roles by their configuration key
(`default_admin`, `system_admin`, `daily_admin`, `audit_admin`) and
add their actual definitions as a copy-and-paste codeblock, the same
way the standard user roles are documented.
- Fix two permissions that never existed: `can_manage_user_log` and
`can_manage_audit_log` are called `can_view_user_log` and
`can_view_audit_log`.
- Add the nine missing permissions: can_update_user, can_manage_library,
can_manage_base, can_manage_app, can_manage_form,
can_manage_organization (version corrected from 1.0 to 2.0),
can_update_organization, can_manage_sys_notification,
can_manage_plugin and other_permission.
- Point out that administrator permissions default to False, the exact
opposite of user permissions. Every admin role is merged onto the
hidden `dummy_admin` role in which everything is False.
- Note that can_manage_base/form/sys_notification/plugin/library only
guard API endpoints; the corresponding menus are reserved for
`default_admin`.
- Note that only a `default_admin` can assign administrator roles.
- Add an info box explaining that only the standard roles have a
translated display name; a custom role shows up in the dropdown with
its raw key.
- Flag both custom role sections with the Enterprise Edition badge,
since ENABLED_ROLE_PERMISSIONS and ENABLED_ADMIN_ROLE_PERMISSIONS are
ignored without a Pro license, and mention that a custom user role
inherits from `default`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DSukUw96UPeEwjXPAEQbzJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The list of standard administrator roles named
custom adminas the fourth preconfigured role. That role does not exist.The fourth role is
system_admin, displayed as "System admin" in the role dropdown of the Users' section.custom_adminis neither a constant inseahub/constants.pynor a key inDEFAULT_ENABLED_ADMIN_ROLE_PERMISSIONS. The only occurrence of that string anywhere indtable-webis the local variablecustom_admin_role_permissions, which holds the custom roles fromdtable_web_settings.py— the opposite of a preconfigured role. The sentence "They can be used […] without prior configuration" therefore contradicted itself.While verifying this against
seahub/role_permissions/settings.py, several further deviations turned up.Changes
Standard roles. All four are now named by their configuration key (
default_admin,system_admin,daily_admin,audit_admin), with their actual definitions as a copy-and-paste codeblock — the same treatment the standard user roles already get.Permissions table, 10 → 19 rows.
can_manage_user_logandcan_manage_audit_lognever existed (code search: 0 hits). They arecan_view_user_logandcan_view_audit_log.can_update_user,can_manage_library,can_manage_base,can_manage_app,can_manage_form,can_update_organization,can_manage_sys_notification,can_manage_plugin,other_permission.can_manage_organizationwas listed as 1.0; it arrived with seafileltd/dtable-web#1681 (2021-03-23) → 2.0.Three behaviours that were undocumented and regularly cause confusion:
dummy_adminrole in which everything isFalse, so each wanted permission must be listed explicitly.can_manage_base,can_manage_form,can_manage_sys_notification,can_manage_pluginandcan_manage_libraryonly guard API endpoints. The matching sidebar entries are gated byisDefaultAdmin, so "Bases", "Forms" etc. cannot be granted to any other role.default_adminmay assign administrator roles (admin_role.py:178).Display names. An info box explains that only the six standard roles have a translated label in
role-status-utils.js; everything else falls through toreturn role. A custom rolenew_admin_roletherefore appears verbatim — underscores included — in the dropdown. Since role keys are not validated beyond a membership check, pickingSupportas the key gives a clean label.Enterprise flag.
<!-- md:flag enterprise -->on both custom-role sections, where theis_procheck insettings.pysilently discardsENABLED_ROLE_PERMISSIONS/ENABLED_ADMIN_ROLE_PERMISSIONSwithout a Pro license. Also noted that a custom user role inherits fromdefault.Note on the version numbers
The older permissions could not be dated from a release list — changelog pages below 3.5 are no longer public. They were interpolated from the commit dates against the calibration points already present in the table (2021-03-25 → 2.0, 2021-06-18 → 2.2) and the published release dates:
can_update_usercan_manage_base/_form/_organization/_sys_notification/_plugincan_update_organizationcan_view_audit_logother_permissioncan_manage_app1.6 and the 2.0 group are inferred, not sourced. Worth a second look if an internal version/date list for 1.x and 2.x exists.
Testing
python3 tests/validate_docs.py --strict→ 0 errors (3 warnings, all in unrelated files)mkdocs build --strict→ builds clean; both admonitions and the Enterprise badges render🤖 Generated with Claude Code
https://claude.ai/code/session_01DSukUw96UPeEwjXPAEQbzJ