The idea of GlobalPermissions, as well as the other GerritPermission
types, is entirely internal to PermissionBackend implementations. It
is basically a coincidence that GlobalPermissions map 1-to-1 with
strings in GlobalCapabilities. Once we get into the other
GerritPermission types like ProjectPermission, there are enum values
that simply aren't meaningful to the user. In fact, today, we are
actively confusing users by saying things like "readConfig not
permitted", since readConfig is not a traditional Gerrit permission and
not something mentioned in the documentation. To fix this, we need to
stop relying on the permission names in exception message.
This change begins that process with GlobalOrPluginPermissions. These
classes no longer depend on DefaultPermissionBackend-specific strings,
and the mappings are isolated in their own class. Implementations that
do want to use them can depend on the new DefaultPermissionMappings
class; this makes it explicit that those implementations are respecting
implementation details of the old class.
Mark GlobalOrPluginPermission#permissionName() as deprecated and throw
UnsupportedOperationException, to force callers to use the new methods.
In a future change, this method will be removed from GlobalPermission
entirealy.
Change-Id: Ic4eec72aa225676fee088a985ee0a0b89154575b