Skip to content

Commit

Permalink
Debug permissions in com_users (#14408)
Browse files Browse the repository at this point in the history
* Add a fieldset in the component config to support disabling the debug users and groups view. The defaullt is to on

* Add code to read the params from the config.xml
If not set then it defaults to ON

Change the IF statement use to turn on the display of the debug link to use the param instead of the JDEBUG

* Add code to read the params from the config.xml
If not set then it defaults to ON

* Change the IF statement use to turn on the display of the debug link to use the param instead of the JDEBUG

* fix the params IF statement

* Fix the params fallback

* Add language strings

* Add missing Cancel button from toolbar (replaces PR14384)

Add missing Options button from toolbar

* Simplify param check

* Simplify param check #2

* change the strings from debug to advanced

* fix toolbar permissions check

* Update config.xml

* Update default.php

* Update default.php
  • Loading branch information
Thomas Hunziker authored and rdeutz committed Mar 10, 2017
1 parent e72cb97 commit e354185
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 9 deletions.
31 changes: 31 additions & 0 deletions administrator/components/com_users/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,37 @@

</fieldset>

<fieldset
name="debug"
label="COM_USERS_DEBUG_LABEL"
description="COM_USERS_DEBUG_DESC">

<field
name="debugUsers"
type="radio"
class="btn-group btn-group-yesno"
default="1"
label="COM_USERS_DEBUG_USERS_LABEL"
description="COM_USERS_DEBUG_USERS_DESC"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>

<field
name="debugGroups"
type="radio"
class="btn-group btn-group-yesno"
default="1"
label="COM_USERS_DEBUG_GROUPS_LABEL"
description="COM_USERS_DEBUG_GROUPS_DESC"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>

</fieldset>

<fieldset name="integration"
label="JGLOBAL_INTEGRATION_LABEL"
description="COM_USERS_CONFIG_INTEGRATION_SETTINGS_DESC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,17 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
$canDo = JHelperContent::getActions('com_users');

JToolbarHelper::title(JText::sprintf('COM_USERS_VIEW_DEBUG_GROUP_TITLE', $this->group->id, $this->group->title), 'users groups');
JToolbarHelper::cancel('group.cancel', 'JTOOLBAR_CLOSE');

if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
JToolbarHelper::preferences('com_users');
JToolbarHelper::divider();
}

JToolbarHelper::help('JHELP_USERS_DEBUG_GROUPS');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,17 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
$canDo = JHelperContent::getActions('com_users');

JToolbarHelper::title(JText::sprintf('COM_USERS_VIEW_DEBUG_USER_TITLE', $this->user->id, $this->user->name), 'users user');
JToolbarHelper::cancel('user.cancel', 'JTOOLBAR_CLOSE');

if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
JToolbarHelper::preferences('com_users');
JToolbarHelper::divider();
}

JToolbarHelper::help('JHELP_USERS_DEBUG_USERS');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');

$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$debugGroups = $this->state->get('params')->get('debugGroups', 1);

JText::script('COM_USERS_GROUPS_CONFIRM_DELETE');

Expand Down Expand Up @@ -112,7 +113,7 @@
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
<?php if (JDEBUG) : ?>
<?php if ($debugGroups) : ?>
<div class="small"><a href="<?php echo JRoute::_('index.php?option=com_users&view=debuggroup&group_id=' . (int) $item->id); ?>">
<?php echo JText::_('COM_USERS_DEBUG_GROUP'); ?></a></div>
<?php endif; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$loggeduser = JFactory::getUser();
$debugUsers = $this->state->get('params')->get('debugUsers', 1);
?>
<form action="<?php echo JRoute::_('index.php?option=com_users&view=users'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
Expand Down Expand Up @@ -113,7 +114,7 @@
<?php if ($item->requireReset == '1') : ?>
<span class="label label-warning"><?php echo JText::_('COM_USERS_PASSWORD_RESET_REQUIRED'); ?></span>
<?php endif; ?>
<?php if (JDEBUG) : ?>
<?php if ($debugUsers) : ?>
<div class="small"><a href="<?php echo JRoute::_('index.php?option=com_users&view=debuguser&user_id=' . (int) $item->id); ?>">
<?php echo JText::_('COM_USERS_DEBUG_USER'); ?></a></div>
<?php endif; ?>
Expand Down
14 changes: 10 additions & 4 deletions administrator/language/en-GB/en-GB.com_users.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,18 @@ COM_USERS_CONFIG_USER_OPTIONS="User Options"
COM_USERS_CONFIGURATION="Users: Options"
COM_USERS_COUNT_ENABLED_USERS="Enabled users"
COM_USERS_COUNT_DISABLED_USERS="Disabled users"
COM_USERS_DEBUG_DESC="Display the Advanced Permission Reports."
COM_USERS_DEBUG_EXPLICIT_ALLOW="Allowed"
COM_USERS_DEBUG_EXPLICIT_DENY="Forbidden"
COM_USERS_DEBUG_GROUP="Debug Permissions Report"
COM_USERS_DEBUG_GROUP="Advanced Permissions Report"
COM_USERS_DEBUG_GROUPS_LABEL="Advanced Groups Permissions"
COM_USERS_DEBUG_GROUPS_DESC="Display the Advanced Groups Permissions Reports."
COM_USERS_DEBUG_IMPLICIT_DENY="Not Allowed"
COM_USERS_DEBUG_LABEL="Advanced"
COM_USERS_DEBUG_LEGEND="Legend:"
COM_USERS_DEBUG_USER="Debug Permissions Report"
COM_USERS_DEBUG_USER="Advanced Permissions Report"
COM_USERS_DEBUG_USERS_LABEL="Advanced Users Permissions"
COM_USERS_DEBUG_USERS_DESC="Display the Advanced Users Permissions Reports."
COM_USERS_DELETE_ERROR_INVALID_GROUP="You can't delete user groups to which you belong."
COM_USERS_DESIRED_PASSWORD="Enter your desired password."
COM_USERS_EDIT_NOTE="Edit Note"
Expand Down Expand Up @@ -356,8 +362,8 @@ COM_USERS_USERS_MULTIPLE_GROUPS="Multiple groups"
COM_USERS_USERS_N_ITEMS_DELETED="%d users successfully deleted."
COM_USERS_USERS_N_ITEMS_DELETED_1="1 user successfully deleted."
COM_USERS_USERS_NO_ITEM_SELECTED="No Users selected."
COM_USERS_VIEW_DEBUG_GROUP_TITLE="Debug Permissions Report for Group #%d, %s"
COM_USERS_VIEW_DEBUG_USER_TITLE="Debug Permissions Report for User #%d, %s"
COM_USERS_VIEW_DEBUG_GROUP_TITLE="Advanced Permissions Report for Group #%d, %s"
COM_USERS_VIEW_DEBUG_USER_TITLE="Advanced Permissions Report for User #%d, %s"
COM_USERS_VIEW_EDIT_GROUP_TITLE="Users: Edit Group"
COM_USERS_VIEW_EDIT_LEVEL_TITLE="Users: Edit Viewing Access Level"
COM_USERS_VIEW_EDIT_PROFILE_TITLE="Users: Edit Profile"
Expand Down

0 comments on commit e354185

Please sign in to comment.