Skip to content

Commit

Permalink
Changed output role to text, check for permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico Bouthoorn committed Jul 2, 2024
1 parent 17bc79f commit 9288292
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions commands/role.bee.inc
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,29 @@ function roles_bee_callback($arguments, $options) {
if (!empty($permissions)) {
$permissions = '\'' . $permissions . '\'';
}
bee_message(bt("The !role role has the following permissions granted: !permissions", array(
'!role' => $options['role'],
'!permissions' => $permissions,
)));
if (!empty($permissions)) {
$output = array(array(
'type' => 'text',
'variables' => array(
'value' => bt("The !role role has the following permissions granted: !permissions", array(
'!role' => $options['role'],
'!permissions' => $permissions,
)),
),
),);
return $output;
}
else {
bee_message(bt("The role '!role' doesn't have any permissions?", array(
'!role' => $options['role'],
)), 'info');
return;
}
return $output;
}
else {
$output = array();
foreach ($roles as $role => $value) {
foreach ($roles as $role => $role_label) {
$permissions = implode('\' , \'', user_role_permissions(array($role)));
if (!empty($permissions)) {
$permissions = '\''.$permissions.'\'';
Expand Down

0 comments on commit 9288292

Please sign in to comment.