Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System: new AccessManager for access control #1673

Draft
wants to merge 16 commits into
base: v25.0.00
Choose a base branch
from

Conversation

yookoala
Copy link
Member

@yookoala yookoala commented Oct 7, 2022

Description

  • A new method ModuleGateway::selectRoleModuleActionNames().
  • A new class Action to replace simple string $address parameter in isActionAccessible().
  • A new class AccessManager to provide feature of isActionAccessible().
  • Make AccessManager accessible globally as $accessManager in index.php routed scripts.
  • Mark isActionAccessible deprecated.

Motivation and Context

  • To replace isActionAccessible() function.
  • Remove unnecessary use of global variables, $guid and $connection2.

How Has This Been Tested?

  • CI environment.
  • Locally.

@yookoala yookoala force-pushed the feat/access-manager branch 4 times, most recently from 67db484 to 8ec56f3 Compare October 31, 2022 06:02
@yookoala yookoala force-pushed the feat/access-manager branch 2 times, most recently from b78c239 to 7e3b53a Compare November 4, 2022 04:50
@yookoala yookoala force-pushed the feat/access-manager branch 2 times, most recently from a05f384 to 6f5c0ae Compare November 4, 2022 11:16
@yookoala
Copy link
Member Author

yookoala commented Nov 4, 2022

I've changed the Action usage to use Action::fromRoute() instead of new Action() to initiate the instance. Should be more flexible for future changes.

@yookoala yookoala marked this pull request as draft November 4, 2022 11:41
@yookoala yookoala force-pushed the feat/access-manager branch from d1f2719 to 41b0043 Compare November 7, 2022 06:45
* Add a module capability description class Action to replace
  existing string based description.
* isActionAccessible() now can take an Action in the place of the
  originally $address string parameter. The old string still works.
* Rewrite all $address parameter from string to Action.
* Add a new AccessManager class for future access control.
* Add access manager to index globals.
* Tell developers to switch to AccessManager if possible.
* Updated variable name to better fit their nature.
* Add actionName for compatibility of internal feature.
* The method now returns database Result instead of a boolean so
  it is more generally usable.
* Rename to selectRoleModuleActionNames().
* Add compatiblity with Action class getActionName. Allow
  developers to move $sub into Action.
* New method fromRoute for creating Action from module and
  route parameter.
* rewrite to the namespace change.
* ModuleGateway::selectRoleModuleActionNames to have a new bool flag
  $activeModuleOnly to specify select active modules only.

* AccessManager to use the new flag to select only access of
  active modules. Remove obsoleted extra logics to check if module
  is ready.
@yookoala yookoala force-pushed the feat/access-manager branch from de57291 to cc779a5 Compare November 10, 2022 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant