-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rework permission UI #23959
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
base: main
Are you sure you want to change the base?
Rework permission UI #23959
Changes from all commits
4d88b6a
7d63562
c5e0dee
8bb88fd
411b0f0
571ec20
d5c97e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: this file should be replaced by proper controllers + templates. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,33 +55,26 @@ | |
| $_POST['prefix'] = ''; | ||
| } | ||
|
|
||
| echo "<div class='d-flex'>"; | ||
| switch ($_POST['type']) { | ||
| case 'User': | ||
| $params = [ | ||
| 'right' => isset($_POST['allusers']) ? 'all' : $_POST['right'], | ||
| 'name' => $prefix . 'users_id' . $suffix, | ||
| 'name' => $prefix . 'users_id' . $suffix, | ||
| 'width' => '100%', | ||
| 'aria_label' => User::getTypeName(1), | ||
| ]; | ||
| User::dropdown($params); | ||
| $display = true; | ||
| break; | ||
|
|
||
| case 'Group': | ||
| $params = ['rand' => $rand, | ||
| 'name' => $prefix . 'groups_id' . $suffix, | ||
| ]; | ||
| $params['toupdate'] = ['value_fieldname' | ||
| => 'value', | ||
| 'to_update' => "subvisibility$rand", | ||
| 'url' => $CFG_GLPI["root_doc"] . "/ajax/subvisibility.php", | ||
| 'moreparams' => ['items_id' => '__VALUE__', | ||
| 'type' => $_POST['type'], | ||
| 'prefix' => $_POST['prefix'], | ||
| ], | ||
| $params = [ | ||
| 'rand' => $rand, | ||
| 'name' => $prefix . 'groups_id' . $suffix, | ||
| 'width' => '100%', | ||
| 'aria_label' => Group::getTypeName(1), | ||
| ]; | ||
|
Comment on lines
-73
to
81
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see no related changes in other implementations of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, I thought this feature was only used for the KB (I searched for usage and found nothing but now I clearly see that it is used elsewhere, weird). I'll work on it, probably create some dedicated controllers and twig files for the KB then since the original was heavily modified. |
||
|
|
||
| Group::dropdown($params); | ||
| echo "<span id='subvisibility$rand'></span>"; | ||
| $display = true; | ||
| break; | ||
|
|
||
|
|
@@ -91,9 +84,9 @@ | |
| 'name' => $prefix . 'entities_id' . $suffix, | ||
| 'entity' => $_POST['entity'] ?? -1, | ||
| 'entity_sons' => $_POST['is_recursive'] ?? false, | ||
| 'width' => '100%', | ||
| 'aria_label' => Entity::getTypeName(1), | ||
| ]); | ||
| echo '<div class="ms-3">' . __s('Child entities') . '</div>'; | ||
| Dropdown::showYesNo($prefix . 'is_recursive' . $suffix); | ||
| $display = true; | ||
| break; | ||
|
|
||
|
|
@@ -104,26 +97,17 @@ | |
| $righttocheck = 'knowbase'; | ||
| $checkright = KnowbaseItem::READFAQ; | ||
| } | ||
| $params = [ | ||
| $params = [ | ||
| 'rand' => $rand, | ||
| 'name' => $prefix . 'profiles_id' . $suffix, | ||
| 'width' => '100%', | ||
| 'condition' => [ | ||
| 'glpi_profilerights.name' => $righttocheck, | ||
| 'glpi_profilerights.rights' => ['&', $checkright], | ||
| ], | ||
| 'aria_label' => Profile::getTypeName(1), | ||
| ]; | ||
| $params['toupdate'] = ['value_fieldname' | ||
| => 'value', | ||
| 'to_update' => "subvisibility$rand", | ||
| 'url' => $CFG_GLPI["root_doc"] . "/ajax/subvisibility.php", | ||
| 'moreparams' => ['items_id' => '__VALUE__', | ||
| 'type' => $_POST['type'], | ||
| 'prefix' => $_POST['prefix'], | ||
| ], | ||
| ]; | ||
|
|
||
| Profile::dropdown($params); | ||
| echo "<span id='subvisibility$rand'></span>"; | ||
| $display = true; | ||
| break; | ||
| } | ||
|
|
@@ -132,5 +116,4 @@ | |
| echo "<input type='submit' name='addvisibility' value=\"" . _sx('button', 'Add') . "\" | ||
| class='btn btn-primary ms-3'>"; | ||
| } | ||
| echo "</div>"; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this file should be replaced by proper controllers + templates.
I've added it to the backlog so it can be done separately.