From 8a474cbff57971da7c911ea84a5331e0588cd65e Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 19 Feb 2013 14:22:10 -0800 Subject: permission plugin hooks --- include/permissions.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'include/permissions.php') 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; -- cgit v1.2.3