Skip to content

Declare the permission UUIDs and names once as constants #4053

Open

Description

@pbleser-oc

The default permissions in services/settings/pkg/store/defaults/permissions.go have their UUIDs and names as string literals. Three of the UUIDs are written a second time as constants elsewhere, and the names are repeated as literals in other services and in reva. Nothing links these copies: if one changes, or has a typo, it still compiles, and the permission check silently fails at runtime.

Current state

  • UUIDs: each permission in permissions.go has its UUID inline. services/settings/pkg/service/v0/settings.go declares AccountManagementPermissionID, RoleManagementPermissionID and SettingsManagementPermissionID with the same values, but permissions.go doesn't use them. These three are looked up by ID in auth-app, in the graph requireadmin middleware and in the settings service itself.
  • Precedent: defaults/defaults.go already declares the role and setting UUIDs as constants (BundleUUIDRoleAdmin, SettingUUIDProfileLanguage, ...). The permission UUIDs are the exception.
  • Names: everything else checks permissions by name. reva checks them in its storage drivers and share providers, and the web service here checks Announcement.ReadWrite and Logo.Write as literals. permissions.go defines the names as literals too.

Proposal

  1. Declare the permission UUIDs as constants in services/settings/pkg/store/defaults, next to the existing BundleUUID... and SettingUUID... constants, and use them in permissions.go.
  2. Make the three constants in services/settings/pkg/service/v0/settings.go refer to them (or replace their uses), so each UUID is written once.
  3. Use the permission name constants from reva's pkg/permission in permissions.go and in the web service, once reva declares all of them (see Declare all permission names as constants in pkg/permission reva#1032). Names that only opencloud checks, like Logo.Write, get constants here.

No behaviour change: the values stay the same. The example JSON in services/settings/README.md repeats the UUIDs too; it's documentation and can stay as it is.

Activity

  1. added
    Type:Maintenance
    on Nov 18, 2026
  2. added theissue type on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type:Maintenance

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions