You are here

function space_user::access_feature in Spaces 7.3

Same name and namespace in other branches
  1. 6.3 spaces_user/plugins/space_user.inc \space_user::access_feature()
  2. 7 spaces_user/plugins/space_user.inc \space_user::access_feature()

Override of access_feature().

Overrides space_type::access_feature

File

spaces_user/plugins/space_user.inc, line 54

Class

space_user
User integration for Spaces.

Code

function access_feature($op = 'view', $feature, $account = NULL) {
  $site_features = spaces_features('site');
  $user_features = spaces_features('user');

  // If feature can be used in "site space" but not user space, ensure we
  // still allow access since user spaces are only active "locally" under
  // user/x.
  //
  // Features that can be used in both user and site spaces should implement
  // their own access callbacks (rather than using spaces_access_feature())
  // to manage access control rules when in a user space.
  if (isset($site_features[$feature]) && !isset($user_features[$feature])) {
    $enabled = $this->controllers->variable
      ->get('spaces_features', 'original');
    return user_access('access content') && !empty($enabled[$feature]);
  }
  return parent::access_feature($op, $feature, $account);
}