You are here

function opigno_quiz_app_update_7103 in Opigno Quiz App 7

Updating permissions

File

./opigno_quiz_app.install, line 677
Defines module install logic.

Code

function opigno_quiz_app_update_7103($sandbox) {

  // All users should be able to view their own results / Achievements page
  $permission = array(
    'access own results',
  );
  $role_name = 'authenticated user';
  $role = user_role_load_by_name($role_name);
  if ($role->rid) {
    user_role_grant_permissions($role->rid, $permission);
  }

  // Admin users should be able to see all user results / Achievements page
  $permission = array(
    'access all results',
  );
  $role_name = 'administrator';
  $role = user_role_load_by_name($role_name);
  if ($role->rid) {
    user_role_grant_permissions($role->rid, $permission);
  }
}