Lines Matching +full:- +full:- +full:group
10 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
19 $this->virtualGroups = new VirtualGroups();
30 if ($INPUT->has('addusergroups')) {
31 $this->addUserGroups($INPUT->str('user'), $INPUT->str('groups'));
32 } elseif ($INPUT->has('addgroupusers')) {
33 $this->addGroupUsers($INPUT->str('group'), $INPUT->str('users'));
34 } elseif ($INPUT->has('deleteuser')) {
35 $this->deleteUser($INPUT->str('user'));
36 } elseif ($INPUT->has('deletegroup')) {
37 $this->deleteGroup($INPUT->str('group'));
38 } elseif ($INPUT->has('editusergroups')) {
39 $this->editUserGroups($INPUT->str('user'), $INPUT->str('groups'));
40 } elseif ($INPUT->has('editgroupusers')) {
41 $this->editGroupUsers($INPUT->str('group'), $INPUT->str('users'));
44 // remove all input to avoid re-submitting on reload
45 $INPUT->remove('user');
46 $INPUT->remove('users');
47 $INPUT->remove('group');
48 $INPUT->remove('groups');
51 if ($INPUT->has('loaduser')) {
52 $INPUT->set('user', $auth->cleanUser($INPUT->str('loaduser')));
53 $INPUT->set('groups', implode(
55 $this->virtualGroups->getUserGroups($auth->cleanUser($INPUT->str('loaduser')))
59 // load group data if requested
60 if ($INPUT->has('loadgroup')) {
61 $INPUT->set('group', $auth->cleanGroup($INPUT->str('loadgroup')));
62 $INPUT->set('users', implode(
64 $this->virtualGroups->getGroupUsers($auth->cleanGroup($INPUT->str('loadgroup')))
81 $user = $auth->cleanUser($user);
83 static fn($group) => $auth->cleanGroup($group),
88 $this->virtualGroups->addGroupsToUser($user, $groups);
93 * Add users to a group
95 * @param string $group group name
99 protected function addGroupUsers($group, $users) argument
104 $group = $auth->cleanGroup($group);
106 static fn($user) => $auth->cleanUser($user),
110 if ($group && $users) {
111 $this->virtualGroups->addUsersToGroup($group, $users);
126 $user = $auth->cleanUser($user);
129 $this->virtualGroups->removeUser($user);
134 * Delete a group
136 * @param string $group group name
139 protected function deleteGroup($group) argument
144 $group = $auth->cleanGroup($group);
146 if ($group) {
147 $this->virtualGroups->removeGroup($group);
163 $user = $auth->cleanUser($user);
165 static fn($group) => $auth->cleanGroup($group),
170 $this->virtualGroups->setUserGroups($user, $groups);
175 * Set the users of a group
177 * @param string $group group name
181 protected function editGroupUsers($group, $users) argument
186 $group = $auth->cleanGroup($group);
188 static fn($user) => $auth->cleanUser($user),
192 if ($group && $users) {
193 $this->virtualGroups->setGroupUsers($group, $users);
206 $tab = $INPUT->str('tab', 'byuser');
208 echo '<div class="plugin-virtualgroup">';
209 echo '<h1>' . hsc($this->getLang('menu')) . '</h1>';
210 $this->tabNavigation($tab);
212 $this->listByGroup();
214 $this->listByUser();
233 wl($ID, ['do' => 'admin', 'page' => $this->getPluginName(), 'tab' => 'byuser']),
234 $this->getLang('byuser')
239 wl($ID, ['do' => 'admin', 'page' => $this->getPluginName(), 'tab' => 'bygroup']),
240 $this->getLang('bygroup')
255 if ($INPUT->has('loaduser')) {
256 echo $this->formEditUserGroups();
258 echo $this->formAddUserGroups();
263 echo ' <th class="user">' . hsc($this->getLang('user')) . '</th>';
264 echo ' <th class="grp">' . hsc($this->getLang('grps')) . '</th>';
268 foreach ($this->virtualGroups->getUserStructure() as $user => $groups) {
273 echo $this->buttonDeleteUser($user);
281 echo '<span>' . $this->getLang('edit') . '</span>';
290 * Print the by group tab
299 if ($INPUT->has('loadgroup')) {
300 echo $this->formEditGroupUsers();
302 echo $this->formAddGroupUsers();
307 echo ' <th class="grp">' . hsc($this->getLang('grp')) . '</th>';
308 echo ' <th class="user">' . hsc($this->getLang('users')) . '</th>';
312 foreach ($this->virtualGroups->getGroupStructure() as $group => $users) {
314 echo ' <td>' . hsc($group) . '</td>';
317 echo $this->buttonDeleteGroup($group);
322 'loadgroup' => $group
325 echo '<span>' . $this->getLang('edit') . '</span>';
344 $form->addFieldsetOpen($this->getLang('addUserGroups'));
345 … $form->addTextInput('user', $this->getLang('user'))->attr('placeholder', $this->getLang('user'));
346 …$form->addTextInput('groups', $this->getLang('grps'))->attr('placeholder', $this->getLang('grpsSam…
347 $form->addButton('addusergroups', $this->getLang('add'))->attr('type', 'submit');
348 $form->addFieldsetClose();
349 return $form->toHTML();
363 $form->addFieldsetOpen($this->getLang('editUserGroups'));
364 $form->addTextInput('user', $this->getLang('user'))->attr('readonly', 'readonly');
365 …$form->addTextInput('groups', $this->getLang('grps'))->attr('placeholder', $this->getLang('grpsSam…
366 $form->addButton('editusergroups', $this->getLang('change'))->attr('type', 'submit');
367 $form->addFieldsetClose();
368 return $form->toHTML();
382 $form->setHiddenField('user', $user);
383 $form->addButtonHTML(
385 inlineSVG(__DIR__ . '/images/delete.svg') . '<span>' . $this->getLang('del') . '</span>'
386 )->attr('type', 'submit');
387 return $form->toHTML();
391 * Return the form to add users to a group
401 $form->addFieldsetOpen($this->getLang('addGroupUsers'));
402 … $form->addTextInput('group', $this->getLang('grp'))->attr('placeholder', $this->getLang('grp'));
403 …$form->addTextInput('users', $this->getLang('users'))->attr('placeholder', $this->getLang('usersSa…
404 $form->addButton('addgroupusers', $this->getLang('add'))->attr('type', 'submit');
405 $form->addFieldsetClose();
406 return $form->toHTML();
410 * Return the form to edit the users of a group
420 $form->addFieldsetOpen($this->getLang('editGroupUsers'));
421 $form->addTextInput('group', $this->getLang('grp'))->attr('readonly', 'readonly');
422 …$form->addTextInput('users', $this->getLang('users'))->attr('placeholder', $this->getLang('usersSa…
423 $form->addButton('editgroupusers', $this->getLang('change'))->attr('type', 'submit');
424 $form->addFieldsetClose();
425 return $form->toHTML();
429 * Return the form to delete a group
433 protected function buttonDeleteGroup($group) argument
439 $form->setHiddenField('group', $group);
440 $form->addButtonHTML(
442 inlineSVG(__DIR__ . '/images/delete.svg') . '<span>' . $this->getLang('del') . '</span>'
443 )->attr('type', 'submit');
444 return $form->toHTML();