diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-24 00:20:26 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-24 00:20:26 +0000 |
commit | 672eca53371b131484d00cbe6a069092d0b7f6b3 (patch) | |
tree | 507cce76fc6dc9d022455eed9075e039fa779da2 /core/helpers/access.php | |
parent | c76d730a7c07253e7cc3224a78c616ce63989f40 (diff) |
Lots of deltas rolled up into a bigger change. Sorry for the mess.
1) Deleted in-place-editing. We'll be replacing this with a real edit
system that groups settings together and is more coherent.
2) Tweaked the way that dialog boxes work to get the ajax stuff working
again. It's imperfect and does not work properly for uploading images.
This is going to get redone also, but this is a good resting point.
3) Created edit forms for albums and photos. Moved _update and _create out
of Items_Controller and into the individual subclasses.
4) Created access::required which is a shorthand for:
if (!access::can(...)) {
access::forbidden();
}
5) Added validation rules to Items_Model
6) Converted login to use the regular modal dialog approach in the theme.
Diffstat (limited to 'core/helpers/access.php')
-rw-r--r-- | core/helpers/access.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/helpers/access.php b/core/helpers/access.php index ab113375..c6ee1fcc 100644 --- a/core/helpers/access.php +++ b/core/helpers/access.php @@ -107,6 +107,19 @@ class access_Core { } /** + * If the active user does not have this permission, failed with an access::forbidden(). + * + * @param string $perm_name + * @param Item_Model $item + * @return boolean + */ + public static function required($perm_name, $item) { + if (!access::can($perm_name, $item)) { + access::forbidden(); + } + } + + /** * Terminate immediately with an HTTP 503 Forbidden response. */ public static function forbidden() { |