summaryrefslogtreecommitdiffstats
path: root/modules-available/permissionmanager/page.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/permissionmanager/page.inc.php')
-rw-r--r--modules-available/permissionmanager/page.inc.php28
1 files changed, 15 insertions, 13 deletions
diff --git a/modules-available/permissionmanager/page.inc.php b/modules-available/permissionmanager/page.inc.php
index b431d9c9..7e9f17e4 100644
--- a/modules-available/permissionmanager/page.inc.php
+++ b/modules-available/permissionmanager/page.inc.php
@@ -18,13 +18,13 @@ class Page_PermissionManager extends Page
$action = Request::any('action', 'show', 'string');
if ($action === 'addRoleToUser') {
User::assertPermission('users.edit-roles');
- $users = Request::post('users', '');
- $roles = Request::post('roles', '');
+ $users = Request::post('users', [], 'array');
+ $roles = Request::post('roles', [], 'array');
PermissionDbUpdate::addRoleToUser($users, $roles);
} elseif ($action === 'removeRoleFromUser') {
User::assertPermission('users.edit-roles');
- $users = Request::post('users', '');
- $roles = Request::post('roles', '');
+ $users = Request::post('users', [], 'array');
+ $roles = Request::post('roles', [], 'array');
PermissionDbUpdate::removeRoleFromUser($users, $roles);
} elseif ($action === 'deleteRole') {
User::assertPermission('roles.edit');
@@ -115,7 +115,7 @@ class Page_PermissionManager extends Page
$roleid = Request::get("roleid", false, 'int');
if ($roleid !== false) {
$role = GetPermissionData::getRoleData($roleid);
- if ($role === false) {
+ if ($role === null) {
Message::addError('invalid-role-id', $roleid);
Util::redirect('?do=permissionmanager');
}
@@ -147,7 +147,8 @@ class Page_PermissionManager extends Page
* @param string $permString the prefix permission string with which all permissions in the permission tree should start
* @return string generated html code
*/
- private static function generatePermissionHTML($permissions, $selectedPermissions = array(), $selectAll = false, $permString = "", $tags = [])
+ private static function generatePermissionHTML(array $permissions, array $selectedPermissions = [],
+ bool $selectAll = false, string $permString = "", array $tags = []): string
{
$res = "";
$toplevel = $permString == "";
@@ -203,11 +204,12 @@ class Page_PermissionManager extends Page
*
* @param array $locations the location tree
* @param array $selectedLocations locations that should be preselected
- * @param array $selectAll true if all locations should be preselected, false if only those in $selectedLocations
- * @param array $toplevel true if the location tree are the children of the root location, false if not
+ * @param bool $selectAll true if all locations should be preselected, false if only those in $selectedLocations
+ * @param bool $toplevel true if the location tree are the children of the root location, false if not
* @return string generated html code
*/
- private static function generateLocationHTML($locations, $selectedLocations = array(), $selectAll = false, $toplevel = true, $tags = [])
+ private static function generateLocationHTML(array $locations, array $selectedLocations = [],
+ bool $selectAll = false, bool $toplevel = true, array $tags = []): string
{
$res = "";
if ($toplevel && in_array(0, $selectedLocations)) {
@@ -242,7 +244,7 @@ class Page_PermissionManager extends Page
* @param array $locations the locationid array
* @return array the locationid array without redundant locationids
*/
- private static function processLocations($locations)
+ private static function processLocations(array $locations): array
{
if (in_array(0, $locations))
return array(null);
@@ -267,7 +269,7 @@ class Page_PermissionManager extends Page
* @param array $permissions the permissionid array
* @return array the permissionid array without redundant permissionids
*/
- private static function processPermissions($permissions)
+ private static function processPermissions(array $permissions): array
{
if (in_array("*", $permissions))
return array("*");
@@ -287,7 +289,7 @@ class Page_PermissionManager extends Page
* @param array $permissions multidimensional array of permissionids
* @return array flat array of permissionids
*/
- private static function extractPermissions($permissions)
+ private static function extractPermissions(array $permissions): array
{
$result = array();
foreach ($permissions as $permission => $a) {
@@ -306,7 +308,7 @@ class Page_PermissionManager extends Page
return $result;
}
- private function denyActionIfBuiltin($roleID)
+ private function denyActionIfBuiltin(string $roleID): void
{
if ($roleID) {
$existing = GetPermissionData::getRole($roleID);