You are here

function userone_access_raw in User One 6

Parameters

$mode: string: 'view' or 'edit'

2 calls to userone_access_raw()
userone_admin_settings in ./userone.module
userone_user in ./userone.module
Implementation of hook_user().

File

./userone.module, line 42
User One module.

Code

function userone_access_raw($mode) {
  static $cached, $roles;
  if (!$cached[$mode]) {
    $cached[$mode] = TRUE;
    $roles[$mode] = array();
    if ($mode == 'view') {
      $result = db_query("SELECT rid FROM {permission} WHERE perm LIKE '%%access user profiles,%%' OR perm LIKE '%%access user profiles'");
    }
    else {
      if ($mode == 'edit') {
        $result = db_query("SELECT rid FROM {permission} WHERE perm LIKE '%%administer users,%%' OR perm LIKE '%%administer users'");
      }
      else {
        return FALSE;
      }
    }
    while ($row = db_fetch_object($result)) {
      $roles[$mode][] = $row->rid;
    }
  }
  return $roles[$mode];
}