1 | <?php |
||
33 | class ConfigService { |
||
34 | |||
35 | |||
36 | const CIRCLES_ALLOW_CIRCLES = 'allow_circles'; |
||
37 | const CIRCLES_SWAP_TO_TEAMS = 'swap_to_teams'; |
||
38 | |||
39 | private $defaults = [ |
||
40 | self::CIRCLES_ALLOW_CIRCLES => Circle::CIRCLES_ALL, |
||
41 | self::CIRCLES_SWAP_TO_TEAMS => '0' |
||
42 | ]; |
||
43 | |||
44 | /** @var string */ |
||
45 | private $appName; |
||
46 | |||
47 | /** @var IConfig */ |
||
48 | private $config; |
||
49 | |||
50 | /** @var string */ |
||
51 | private $userId; |
||
52 | |||
53 | /** @var MiscService */ |
||
54 | private $miscService; |
||
55 | |||
56 | /** @var int */ |
||
57 | private $allowedCircle = -1; |
||
58 | |||
59 | public function __construct($appName, IConfig $config, $userId, MiscService $miscService) { |
||
65 | |||
66 | |||
67 | /** |
||
68 | * returns if this type of circle is allowed by the current configuration. |
||
69 | * |
||
70 | * @param $type |
||
71 | * |
||
72 | * @return int |
||
73 | */ |
||
74 | public function isCircleAllowed($type) { |
||
81 | |||
82 | /** |
||
83 | * Get a value by key |
||
84 | * |
||
85 | * @param string $key |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getAppValue($key) { |
||
98 | |||
99 | /** |
||
100 | * Set a value by key |
||
101 | * |
||
102 | * @param string $key |
||
103 | * @param string $value |
||
104 | * |
||
105 | * @return void |
||
106 | */ |
||
107 | public function setAppValue($key, $value) { |
||
110 | |||
111 | /** |
||
112 | * remove a key |
||
113 | * |
||
114 | * @param string $key |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | public function deleteAppValue($key) { |
||
121 | |||
122 | /** |
||
123 | * Get a user value by key |
||
124 | * |
||
125 | * @param string $key |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | public function getUserValue($key) { |
||
132 | |||
133 | /** |
||
134 | * Set a user value by key |
||
135 | * |
||
136 | * @param string $key |
||
137 | * @param string $value |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | public function setUserValue($key, $value) { |
||
144 | |||
145 | /** |
||
146 | * Get a user value by key and user |
||
147 | * |
||
148 | * @param string $userId |
||
149 | * @param string $key |
||
150 | * |
||
151 | * @return string |
||
152 | */ |
||
153 | public function getValueForUser($userId, $key) { |
||
156 | |||
157 | /** |
||
158 | * Set a user value by key |
||
159 | * |
||
160 | * @param string $userId |
||
161 | * @param string $key |
||
162 | * @param string $value |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | public function setValueForUser($userId, $key, $value) { |
||
169 | |||
170 | /** |
||
171 | * return the cloud version. |
||
172 | * if $complete is true, return a string x.y.z |
||
173 | * |
||
174 | * @param boolean $complete |
||
175 | * |
||
176 | * @return string|integer |
||
177 | */ |
||
178 | public function getCloudVersion($complete = false) { |
||
187 | } |
||
188 |