diff options
author | friendica <info@friendica.com> | 2014-08-17 22:53:00 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-08-17 22:53:00 -0700 |
commit | d9ff121930554aa9bcad4f4ceffeb9b5e3b83d17 (patch) | |
tree | 38ddb2fcab0f4c2c3baf6917e3544148cbe1eb9e /include/permissions.php | |
parent | 3dbc3e263d7a3c6d0ccb5da9d9927a93f777300e (diff) | |
download | volse-hubzilla-d9ff121930554aa9bcad4f4ceffeb9b5e3b83d17.tar.gz volse-hubzilla-d9ff121930554aa9bcad4f4ceffeb9b5e3b83d17.tar.bz2 volse-hubzilla-d9ff121930554aa9bcad4f4ceffeb9b5e3b83d17.zip |
beginning of permission role settings
Diffstat (limited to 'include/permissions.php')
-rw-r--r-- | include/permissions.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/include/permissions.php b/include/permissions.php index 4b68413b9..8e4676f51 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -411,3 +411,63 @@ function site_default_perms() { } return $ret; } + + +/** + * @function get_role_perms($role) + * @param string $role + * + * Given a string for the channel role ('social','forum', etc) + * return an array of all permission fields pre-filled for this role. + * This includes the channel permission scope indicators as well as + * perms_auto: The permissions to apply automatically on receipt of a connection request + * perms_follow: The permissions to apply when initiating a connection request to another channel + * perms_accept: The permissions to apply when accepting a connection request from another channel (not automatic) + * + * Any attributes may be extended (new roles defined) and modified (specific permissions altered) by plugins + * + */ + +function get_role_perms($role) { + + $ret = array(); + + $ret['role'] = $role; + + switch($role) { + case 'social': + $ret['perms_auto'] = 0; + $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK + |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT + |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE; + $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK + |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT + |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE; + $ret['channel_r_stream'] = PERMS_PUBLIC; + $ret['channel_r_profile'] = PERMS_PUBLIC; + $ret['channel_r_photos'] = PERMS_PUBLIC; + $ret['channel_r_abook'] = PERMS_PUBLIC; + $ret['channel_w_stream'] = PERMS_CONTACTS; + $ret['channel_w_wall'] = PERMS_CONTACTS; + $ret['channel_w_tagwall'] = PERMS_SPECIFIC; + $ret['channel_w_comment'] = PERMS_CONTACTS; + $ret['channel_w_mail'] = PERMS_CONTACTS; + $ret['channel_w_photos'] = 0; + $ret['channel_w_chat'] = PERMS_CONTACTS; + $ret['channel_a_delegate'] = 0; + $ret['channel_r_storage'] = PERMS_PUBLIC; + $ret['channel_r_pages'] = PERMS_PUBLIC; + $ret['channel_w_pages'] = 0; + $ret['channel_a_republish'] = PERMS_SPECIFIC; + $ret['channel_w_like'] = PERMS_NETWORK; + + break; + + } + + call_hooks('get_role_perms',$ret); + + return $ret; +} + + |