Skip to content

PermissionsManager and DefaultPermissionsProvider improvements#425

Open
OMEGA3065 wants to merge 3 commits into
northwood-studios:masterfrom
OMEGA3065:master
Open

PermissionsManager and DefaultPermissionsProvider improvements#425
OMEGA3065 wants to merge 3 commits into
northwood-studios:masterfrom
OMEGA3065:master

Conversation

@OMEGA3065

Copy link
Copy Markdown
Contributor

Provides new methods which can be used to interact with the PermissionManager and DefaultPermissionsProvider in more ways without the need for publicizing the assembly.

This PR was made because of a suggestion: #424

The changes made to the PermissionManager are mostly QoL with 1 exception.
List of changes:

  • RegisterProvider<T> using Activator.CreateInstance even though the type argument was specified as supporting a parameterless constructor. Modified code so instead of using Activator.CreateInstance<T>() it uses new T().
  • GetProvider(Type type) which allows to get a provider even if we only have it's type object (runtime) as provided by GetPermissionsByProvider
  • TryGetProvider<T>(out provider) -> T which allows the caller to automatically have the returned type be the type provided as an argument.

The changes made to the DefaultPermissionsProvider allow for more interaction concerning obtainging full lists of permissions provided by a UserGroup and allowing for runtime registration of .
List of changes:

  • RegisterProvider<T> using Activator.CreateInstance even though the type argument was specified as supporting a parameterless constructor. Modified code so instead of using Activator.CreateInstance<T>() it uses new T().
  • GetProvider(Type type) which allows to get a provider even if we only have it's type object (runtime) as provided by GetPermissionsByProvider
  • TryGetProvider<T>(out provider) -> T which allows the caller to automatically have the returned type be the type provided as an argument.
  • GetPlayerGroup was made public
  • GetPermissionGroup was added to allow the caller obtain the PermissionGroup based on a string UserGroup registry name.
  • GetPermissions was made public
  • AddPermissionGroup was added to allow the caller to add / override existing groups.
  • RemovePermissionGroup same reason as AddPermissionGroup` but for removal of groups.

@OMEGA3065

Copy link
Copy Markdown
Contributor Author

I might respond faster if receive a ping in the discord: <@799984967227670529>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant