1
0
This commit is contained in:
Romain LE DISEZ 2010-11-28 16:09:18 +01:00
parent a34f257b50
commit f4cc3ba886

View File

@ -21,22 +21,27 @@
class access extends access_Core { class access extends access_Core {
/** /**
* Does the active user have this permission on this item? * If the user is chrooted, deny access outside of the chroot.
* */
* @param string $perm_name static function user_can($user, $perm_name, $item) {
* @param Item_Model $item if( $user->id == identity::active_user()->id && user_chroot::album() ) {
* @return boolean if( $item->left_ptr < user_chroot::album()->left_ptr || user_chroot::album()->right_ptr < $item->right_ptr ) {
return false;
}
}
return parent::user_can($user, $perm_name, $item);
}
/**
* Copied from modules/gallery/helpers/access.php because of the usage of self::
*/ */
static function can($perm_name, $item) { static function can($perm_name, $item) {
return self::user_can(identity::active_user(), $perm_name, $item); return self::user_can(identity::active_user(), $perm_name, $item);
} }
/** /**
* If the active user does not have this permission, failed with an access::forbidden(). * Copied from modules/gallery/helpers/access.php because of the usage of self::
*
* @param string $perm_name
* @param Item_Model $item
* @return boolean
*/ */
static function required($perm_name, $item) { static function required($perm_name, $item) {
if (!self::can($perm_name, $item)) { if (!self::can($perm_name, $item)) {
@ -48,14 +53,4 @@ class access extends access_Core {
} }
} }
} }
static function user_can($user, $perm_name, $item) {
if( $user->id == identity::active_user()->id && user_chroot::album() ) {
if( $item->left_ptr < user_chroot::album()->left_ptr || user_chroot::album()->right_ptr < $item->right_ptr ) {
return false;
}
}
return parent::user_can($user, $perm_name, $item);
}
} }