aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-02-19 14:22:10 -0800
committerfriendica <info@friendica.com>2013-02-19 14:22:10 -0800
commit8a474cbff57971da7c911ea84a5331e0588cd65e (patch)
tree9b379988e8dae7f834a99f305750ab4540518147
parentd1190efe923649e67aada85d7aefd3a490deb76a (diff)
downloadvolse-hubzilla-8a474cbff57971da7c911ea84a5331e0588cd65e.tar.gz
volse-hubzilla-8a474cbff57971da7c911ea84a5331e0588cd65e.tar.bz2
volse-hubzilla-8a474cbff57971da7c911ea84a5331e0588cd65e.zip
permission plugin hooks
-rw-r--r--include/permissions.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/include/permissions.php b/include/permissions.php
index 55fa626a9..72e002ace 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -30,7 +30,9 @@ function get_perms() {
'delegate' => array('channel_a_delegate', intval(PERMS_A_DELEGATE), false, t('Can administer my channel resources'), t('Extremely advanced. Leave this alone unless you know what you are doing')),
);
- return $global_perms;
+ $ret = array('global_permissions' => $global_perms);
+ call_hooks('global_permissions',$ret);
+ return $ret['global_permissions'];
}
@@ -190,13 +192,29 @@ function get_all_perms($uid,$observer_xchan,$internal_use = true) {
continue;
}
+ $arr = array(
+ 'channel_id' => $uid,
+ 'observer_hash' => $observer_xchan,
+ 'permissions' => $ret);
- return $ret;
+ call_hooks('get_all_perms',$arr);
+ return $arr['permissions'];
}
function perm_is_allowed($uid,$observer_xchan,$permission) {
+
+ $arr = array(
+ 'channel_id' => $uid,
+ 'observer_hash' => $observer_xchan,
+ 'permission' => $permission,
+ 'result' => false);
+
+ call_hooks('perm_is_allowed',$arr);
+ if($arr['result'])
+ return true;
+
$global_perms = get_perms();
// First find out what the channel owner declared permissions to be.
@@ -275,6 +293,9 @@ function perm_is_allowed($uid,$observer_xchan,$permission) {
return true;
}
+
+
+
// No permissions allowed.
return false;