Skip to content

Conversation

@rodriquelca
Copy link
Contributor

refactor Permission module

Solution

  • improve permissionPerformance adding cache and optimize query
image

How to Test

Describe how to test that this solution works.

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@rodriquelca rodriquelca changed the title POC Permission Performance first commit improve performance of permissions and groups POC - Permission Performance (do not merge) Aug 25, 2025
@caleeli caleeli changed the title POC - Permission Performance (do not merge) Improve Users and Groups - Permission Performance Sep 11, 2025
@processmaker-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@caleeli caleeli requested a review from pmPaulis September 18, 2025 13:25
@rodriquelca rodriquelca changed the title Improve Users and Groups - Permission Performance (POC)Improve Users and Groups - Permission Performance Oct 27, 2025
cursor[bot]

This comment was marked as outdated.

$this->loadUserPermissions(),
$this->loadGroupPermissions()
);
// return array_merge(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this comments please?

public function hasPermission($permissionString)
{
$permissionStrings = $this->loadPermissions();
// $permissionStrings = $this->loadPermissions();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the comments please?

/**
* Check if user has any of the given permissions
*/
// public function hasAnyPermission(array $permissions): bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the commented methods please?

*/
private function addCategoryViewPermissions(array $permissions): array
{
$addFor = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be applied to other assets that have categories, like decision tables, data connectors, flow genies, etc?

*/
public function boot(): void
{
// Publish configuration if needed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the comment code please?

$this->loadUserPermissions(),
$this->loadGroupPermissions()
);
// return array_merge(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code, delete it.

$user->is_administrator = true;
$user->save();
$user->refresh();
$user->invalidatePermissionCache(); // ✅ Invalidar cache para que los permisos tomen efecto
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change it to English.

/**
* Check if user has any of the given permissions
*/
// public function hasAnyPermission(array $permissions): bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review the commented code.

cursor[bot]

This comment was marked as outdated.

@processmaker-sonarqube
Copy link

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.

4 participants