Commit df9beac8 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Function to check if user is an institutional admin for a particular institution

parent 103884b7
...@@ -362,9 +362,12 @@ class User { ...@@ -362,9 +362,12 @@ class User {
&& (is_null($role) || $institutions[$institution]->{$role}); && (is_null($role) || $institutions[$institution]->{$role});
} }
public function is_institutional_admin() { public function is_institutional_admin($institution = null) {
$a = $this->get('admininstitutions'); $a = $this->get('admininstitutions');
return !empty($a); if (is_null($institution)) {
return !empty($a);
}
return isset($a[$institution]);
} }
public function set_admin_institutions($institutions) { public function set_admin_institutions($institutions) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment