summaryrefslogtreecommitdiffstats
path: root/lib/api/kolab_api_service_domains.php
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-16 23:51:40 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-16 23:55:28 +0100
commit1ac387f72636d716432722218fade7e82d39a03f (patch)
tree56e4224a95b0b7397236f3a29027e1432bc541e2 /lib/api/kolab_api_service_domains.php
parent5de35c49682d7f7579a715eee57197c5eb74ed7d (diff)
downloadwebadmin-1ac387f72636d716432722218fade7e82d39a03f.tar.gz
Apply effective rights to capabilities on API 'domains' service
Diffstat (limited to 'lib/api/kolab_api_service_domains.php')
-rw-r--r--lib/api/kolab_api_service_domains.php35
1 files changed, 32 insertions, 3 deletions
diff --git a/lib/api/kolab_api_service_domains.php b/lib/api/kolab_api_service_domains.php
index 439e865..d322ef0 100644
--- a/lib/api/kolab_api_service_domains.php
+++ b/lib/api/kolab_api_service_domains.php
@@ -38,9 +38,38 @@ class kolab_api_service_domains extends kolab_api_service
*/
public function capabilities($domain)
{
- return array(
- 'list' => 'r',
- );
+ $auth = Auth::get_instance();
+ $conf = Conf::get_instance();
+
+ $domain_base_dn = $conf->get('domain_base_dn');
+
+ if (empty($domain_base_dn)) {
+ return array();
+ }
+
+ $effective_rights = $auth->list_rights($domain_base_dn);
+
+ $rights = array();
+
+ if (in_array('add', $effective_rights['entryLevelRights'])) {
+ $rights['list'] = "r";
+ }
+
+ if (in_array('delete', $effective_rights['entryLevelRights'])) {
+ $rights['list'] = "r";
+ }
+
+ if (in_array('modrdn', $effective_rights['entryLevelRights'])) {
+ $rights['list'] = "r";
+ }
+
+ if (in_array('read', $effective_rights['entryLevelRights'])) {
+ $rights['list'] = "r";
+ }
+
+ $rights['effective_rights'] = "r";
+
+ return $rights;
}
/**