Skip to content

Manage dashboard access rights per Group and per User - #144

Open
MichaelRodriguesOficial wants to merge 6 commits into
pluginsGLPI:mainfrom
MichaelRodriguesOficial:main
Open

Manage dashboard access rights per Group and per User#144
MichaelRodriguesOficial wants to merge 6 commits into
pluginsGLPI:mainfrom
MichaelRodriguesOficial:main

Conversation

@MichaelRodriguesOficial

Copy link
Copy Markdown

Update to better manage access to the dashboards.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

Currently, dashboard access can only be granted per Profile. This PR adds the ability to also grant (or deny) access per Group and per User, using the same rights mechanism (Profile::dropdownRight) already used for profiles.

  • Adds a new PluginMetabaseItemright class, mirroring PluginMetabaseProfileright, storing rights keyed by itemtype (Group or User) + items_id + dashboard_uuid.
  • Adds a new tab ("Metabase") on the Group and User forms, gated by the existing group/user UPDATE rights, to manage dashboard access for that group/user.
  • Access rights are now additive: a dashboard is shown on Central if the user's profile, any of their groups, or the user themselves has been granted READ access.
  • No changes to the existing profile-based rights: they keep working exactly as before, this is purely additive.

I did not add automated tests since the plugin doesn't currently have a test suite in place.

Screenshots:

Group User

Update to better manage access to the dashboards.
@stonebuzz
stonebuzz requested review from Rom1-B and stonebuzz July 17, 2026 07:28
@stonebuzz stonebuzz assigned stonebuzz and unassigned stonebuzz Jul 17, 2026
@stonebuzz stonebuzz added the enhancement New feature or request label Jul 17, 2026
Comment thread inc/itemright.class.php
*
* @return bool
*/
public function showRightsForm($itemtype, $itemsId, $options = [])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should use Twig templates instead.

Direct echo statements in PHP are no longer allowed. All output should be rendered through Twig templates to comply with the current coding standards.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the review! You are absolutely right. I will refactor the showRightsForm() method to use Twig templates, following current GLPI standards.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should use Twig to eliminate all the echo statements

Comment thread inc/itemright.class.php
Comment thread inc/dashboard.class.php Outdated
Comment thread inc/dashboard.class.php Outdated
Comment thread inc/itemright.class.php
Comment thread inc/itemright.class.php
Comment thread inc/itemright.class.php
MichaelRodriguesOficial and others added 4 commits July 23, 2026 17:42
Co-authored-by: Stanislas <skita@teclib.com>
Co-authored-by: Stanislas <skita@teclib.com>
Co-authored-by: Stanislas <skita@teclib.com>
Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com>

@Rom1-B Rom1-B left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Several errors in the CI

Comment thread inc/itemright.class.php
*
* @return bool
*/
public function showRightsForm($itemtype, $itemsId, $options = [])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should use Twig to eliminate all the echo statements

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants