From 17e161006a9ddbfbea3e0b6d5f7776ad7b8101e2 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 27 Jun 2016 04:44:10 -0700 Subject: added permissionroles --- Zotlabs/Access/PermissionRoles.php | 70 ++++++++++++++++++++++++++++++++++++++ Zotlabs/Access/Permissions.php | 32 ++--------------- 2 files changed, 72 insertions(+), 30 deletions(-) create mode 100644 Zotlabs/Access/PermissionRoles.php diff --git a/Zotlabs/Access/PermissionRoles.php b/Zotlabs/Access/PermissionRoles.php new file mode 100644 index 000000000..32a72d3ae --- /dev/null +++ b/Zotlabs/Access/PermissionRoles.php @@ -0,0 +1,70 @@ + [ + 'social' => t('Social - Mostly Public'), + 'social_restricted' => t('Social - Restricted'), + 'social_private' => t('Social - Private') + ], + + t('Community Forum') => [ + 'forum' => t('Forum - Mostly Public'), + 'forum_restricted' => t('Forum - Restricted'), + 'forum_private' => t('Forum - Private') + ], + + t('Feed Republish') => [ + 'feed' => t('Feed - Mostly Public'), + 'feed_restricted' => t('Feed - Restricted') + ], + + t('Special Purpose') => [ + 'soapbox' => t('Special - Celebrity/Soapbox'), + 'repository' => t('Special - Group Repository') + ], + + t('Other') => [ + 'custom' => t('Custom/Expert Mode') + ] + + ]; + + return $roles; + } + + + static public function LimitSet($permission,$limit,$roles) { + if(is_array($roles)) { + foreach($roles as $role) { + self::$role_limits[$role][$permission] = $limit; + } + } + else { + self::$role_limits[$role][$permission] = $limit; + } + } + + static public function PermSet($permission,$roles) { + if(is_array($roles)) { + foreach($roles as $role) { + self::$role_perms[$role][] = $permission; + } + } + else { + self::$role_perms[$role][] = $permission; + } + } + + +} \ No newline at end of file diff --git a/Zotlabs/Access/Permissions.php b/Zotlabs/Access/Permissions.php index eac3cb4b6..4c3c634fd 100644 --- a/Zotlabs/Access/Permissions.php +++ b/Zotlabs/Access/Permissions.php @@ -7,7 +7,6 @@ use Zotlabs\Lib as Zlib; class Permissions { - static public function Perms($filter) { $perms = [ @@ -43,39 +42,12 @@ class Permissions { return Zlib\PConfig::Get($channel_id,'perms',$permission); } - static public function Set($channel_id,$xchan_hash,$permission,$value) { - $channel = channelx_by_n($channel_id); - if($channel) { - return Zlib\AbConfig::Set($channel['channel_hash'],$xchan_hash,'perms',$permission,$value); - } - return false; + return Zlib\AbConfig::Set($channel_id,$xchan_hash,'perms',$permission,$value); } static public function Get($channel_id,$xchan_hash,$permission) { - $channel = channelx_by_n($channel_id); - if($channel) { - return Zlib\AbConfig::Get($channel['channel_hash'],$xchan_hash,'perms',$permission); - } - return false; - } - - static public function SetHash($channel_hash,$xchan_hash,$permission,$value) { - return Zlib\AbConfig::Set($channel_hash,$xchan_hash,'perms',$permission,$value); + return Zlib\AbConfig::Get($channel_id,$xchan_hash,'perms',$permission); } - - static public function GetHash($channel_hash,$xchan_hash,$permission) { - return Zlib\AbConfig::Get($channel_hash,$xchan_hash,'perms',$permission); - } - - - - - - - - - - } \ No newline at end of file -- cgit v1.2.3