aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Access/PermissionRoles.php
blob: e3b16a66c460b489edfbf46aba7ced80875ae73e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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;
		}
	}


}