Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
Refactors check_access return types
Browse files Browse the repository at this point in the history
Removes 2 as return value.
Changes return types to boolean.
  • Loading branch information
cathrinevaage committed Dec 3, 2019
1 parent 5feda37 commit be0d2a4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/functions/live/functions_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function check_login($username, $password, $groups = '99999', $field = 'mail')
*
* @param string $username = null
* @param string $groups = null
* @return int
* @return boolean
*/
function check_access($username = null, $groups = null)
{
Expand All @@ -63,18 +63,14 @@ function check_access($username = null, $groups = null)
);

if (isset($customer['id']) && $groups == '99999') {
return 1;
return true;
}

if (isset($customer['id']) && in_array($groups, $customer['groups'])) {
return 1;
}

if (isset($customer['id'])) {
return 2;
return true;
}
} catch (Exception $e) {}

return 0;
return false;
}
}

0 comments on commit be0d2a4

Please sign in to comment.