class space_user in Spaces 6.3
Same name and namespace in other branches
- 7.3 spaces_user/plugins/space_user.inc \space_user
- 7 spaces_user/plugins/space_user.inc \space_user
User integration for Spaces.
Hierarchy
- class \space
- class \space_type
- class \space_user
- class \space_type
Expanded class hierarchy of space_user
2 string references to 'space_user'
- spaces_user_spaces_plugins in spaces_user/
spaces_user.module - Implementation of hook_spaces_plugins().
- spaces_user_spaces_registry in spaces_user/
spaces_user.module - Implementation of hook_spaces_registry().
File
- spaces_user/
plugins/ space_user.inc, line 6
View source
class space_user extends space_type {
/**
* Override of load().
* Load the user account object for this space and bail if it can't be loaded.
*/
function load() {
parent::load();
$account = user_load(array(
'uid' => $this->id,
));
if ($account) {
$this->user = $account;
return TRUE;
}
return FALSE;
}
/**
* Override of deactivate().
* We don't have too many good options here except to leave the user/x path.
* If the site frontpage has also been set to a user/x path, we just need
* to fail miserably.
*/
function deactivate() {
if (strpos(variable_get('site_frontpage', 'node'), 'user') !== 0) {
drupal_goto('<front>');
}
return;
}
/**
* Override of title().
*/
function title() {
return $this->user->name;
}
/**
* Override of access_admin().
*/
function access_admin($account = NULL) {
global $user;
$account = isset($account) ? $account : $user;
$access = $account->uid == $this->id && user_access('configure own user space');
return $access || parent::access_admin($account);
}
/**
* Override of access_feature().
*/
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);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
space:: |
property | |||
space:: |
property | |||
space:: |
property | |||
space:: |
property | |||
space:: |
function | Called from spaces_init_space(). Determine whether this space can be set as the current active space. Override to provide custom logic for bailing the spaces bootstrap. | 1 | |
space:: |
protected | function | Instantiate controllers for this space. | |
space:: |
function | Initialize any overrides as necessary. | ||
space:: |
function | Constructor. | ||
space_type:: |
function | Grant a user access to anything in this space. This method can be used to deny access to any page where this space is active. | 1 | |
space_type:: |
function | Grant a user access to the given account in this space. | 1 | |
space_type:: |
function | Get the possible feature setting values for this space. | ||
space_type:: |
function | Route the user as necessary. | 2 | |
space_type:: |
function | Views filter callback. | 2 | |
space_user:: |
function |
Override of access_admin(). Overrides space_type:: |
||
space_user:: |
function |
Override of access_feature(). Overrides space_type:: |
||
space_user:: |
function |
Override of deactivate().
We don't have too many good options here except to leave the user/x path.
If the site frontpage has also been set to a user/x path, we just need
to fail miserably. Overrides space:: |
||
space_user:: |
function |
Override of load().
Load the user account object for this space and bail if it can't be loaded. Overrides space:: |
||
space_user:: |
function |
Override of title(). Overrides space_type:: |