aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Access
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Access')
-rw-r--r--Zotlabs/Access/PermissionRoles.php70
-rw-r--r--Zotlabs/Access/Permissions.php53
2 files changed, 123 insertions, 0 deletions
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 @@
+<?php
+
+
+namespace Zotlabs\Access;
+
+use Zotlabs\Lib as Zlib;
+
+class PermissionRoles {
+
+ static private role_limits = array();
+ static private role_perms = array();
+
+ static public function roles() {
+ $roles = [
+ t('Social Networking') => [
+ '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
new file mode 100644
index 000000000..4c3c634fd
--- /dev/null
+++ b/Zotlabs/Access/Permissions.php
@@ -0,0 +1,53 @@
+<?php
+
+
+namespace Zotlabs\Access;
+
+use Zotlabs\Lib as Zlib;
+
+class Permissions {
+
+ static public function Perms($filter) {
+
+ $perms = [
+ [ 'view_stream' => t('Can view my normal stream and posts') ],
+ [ 'send_stream' => t('Can send me their channel stream and posts') ],
+ [ 'view_profile' => t('Can view my default channel profile') ],
+ [ 'view_contacts' => t('Can view my connections') ],
+ [ 'view_storage' => t('Can view my file storage and photos') ],
+ [ 'write_storage' => t('Can upload/modify my file storage and photos') ],
+ [ 'view_pages' => t('Can view my channel webpages') ],
+ [ 'write_pages' => t('Can create/edit my channel webpages') ],
+ [ 'post_wall' => t('Can post on my channel (wall) page') ],
+ [ 'post_comments' => t('Can comment on or like my posts') ],
+ [ 'post_mail' => t('Can send me private mail messages') ],
+ [ 'post_like' => t('Can like/dislike profiles and profile things') ],
+ [ 'tag_deliver' => t('Can forward to all my channel connections via @+ mentions in posts') ],
+ [ 'chat' => t('Can chat with me (when available)') ],
+ [ 'republish' => t('Can source my public posts in derived channels') ],
+ [ 'delegate' => t('Can administer my channel') ]
+ ];
+
+ $x = array('permissions' => $perms, 'filter' => $filter);
+ call_hooks('permissions_list',$x);
+ return($x['permissions']);
+
+ }
+
+ static public function OwnerLimitSet($channel_id,$permission,$limit) {
+ return Zlib\PConfig::Set($channel_id,'perms',$permission,$limit);
+ }
+
+ static public function OwnerLimitGet($channel_id,$permission) {
+ return Zlib\PConfig::Get($channel_id,'perms',$permission);
+ }
+
+ static public function Set($channel_id,$xchan_hash,$permission,$value) {
+ return Zlib\AbConfig::Set($channel_id,$xchan_hash,'perms',$permission,$value);
+ }
+
+ static public function Get($channel_id,$xchan_hash,$permission) {
+ return Zlib\AbConfig::Get($channel_id,$xchan_hash,'perms',$permission);
+ }
+
+} \ No newline at end of file