← Back to team overview

mahara-contributors team mailing list archive

[Bug 2002921] [NEW] Need a wrapper function for working out permissions easier

 

Public bug reported:

Currently we have things like:

$USER->get('admin') || $USER->get('staff')

or

$USER->is_institutional_admin($institution) ||
$USER->is_institutional_supportadmin($institution) ||
$USER->is_institutional_staff($institution);

or combos of the above to work out if a person should have access to
something.

We should make a wrapper function that can take some parameters so we
don't always have to chain things like we currently do.

for example:
$USER->admin_permissions('site', 'any') could be the equivalent to $USER->get('admin') || $USER->get('staff')

$USER->admin_permissions($institution, 'any') could be the equivalent to
$USER->is_institutional_admin($institution) ||
$USER->is_institutional_supportadmin($institution) ||
$USER->is_institutional_staff($institution);

** Affects: mahara
     Importance: Wishlist
         Status: Confirmed

** Changed in: mahara
   Importance: Undecided => Wishlist

** Changed in: mahara
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/2002921

Title:
  Need a wrapper function for working out permissions easier

Status in Mahara:
  Confirmed

Bug description:
  Currently we have things like:

  $USER->get('admin') || $USER->get('staff')

  or

  $USER->is_institutional_admin($institution) ||
  $USER->is_institutional_supportadmin($institution) ||
  $USER->is_institutional_staff($institution);

  or combos of the above to work out if a person should have access to
  something.

  We should make a wrapper function that can take some parameters so we
  don't always have to chain things like we currently do.

  for example:
  $USER->admin_permissions('site', 'any') could be the equivalent to $USER->get('admin') || $USER->get('staff')

  $USER->admin_permissions($institution, 'any') could be the equivalent
  to $USER->is_institutional_admin($institution) ||
  $USER->is_institutional_supportadmin($institution) ||
  $USER->is_institutional_staff($institution);

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/2002921/+subscriptions