permission plugin hooks

This commit is contained in:
friendica 2013-02-19 14:22:10 -08:00
parent d1190efe92
commit 8a474cbff5

View File

@ -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;