diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-01-19 15:19:20 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-01-19 15:19:20 +0100 |
commit | 1f7b08bd19dd37bec73903679b3e0bfdaed71927 (patch) | |
tree | be790bbce3d66cdeb4e0137c29bcea7909a7cb89 /apps/user_ldap/lib/Controller | |
parent | f2c9d04eac7c0875040b3e46cc1dccc7d290789f (diff) | |
download | nextcloud-server-1f7b08bd19dd37bec73903679b3e0bfdaed71927.tar.gz nextcloud-server-1f7b08bd19dd37bec73903679b3e0bfdaed71927.zip |
LDAP OCS Api for show config
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/Controller')
-rw-r--r-- | apps/user_ldap/lib/Controller/ConfigAPIController.php | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/Controller/ConfigAPIController.php b/apps/user_ldap/lib/Controller/ConfigAPIController.php index 371ca899c26..5256b0d8aad 100644 --- a/apps/user_ldap/lib/Controller/ConfigAPIController.php +++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php @@ -214,6 +214,100 @@ class ConfigAPIController extends OCSController { } /** + * retrieves a configuration + * + * <?xml version="1.0"?> + * <ocs> + * <meta> + * <status>ok</status> + * <statuscode>200</statuscode> + * <message>OK</message> + * </meta> + * <data> + * <ldapHost>ldaps://my.ldap.server</ldapHost> + * <ldapPort>7770</ldapPort> + * <ldapBackupHost></ldapBackupHost> + * <ldapBackupPort></ldapBackupPort> + * <ldapBase>ou=small,dc=my,dc=ldap,dc=server</ldapBase> + * <ldapBaseUsers>ou=users,ou=small,dc=my,dc=ldap,dc=server</ldapBaseUsers> + * <ldapBaseGroups>ou=small,dc=my,dc=ldap,dc=server</ldapBaseGroups> + * <ldapAgentName>cn=root,dc=my,dc=ldap,dc=server</ldapAgentName> + * <ldapAgentPassword>clearTextWithShowPassword=1</ldapAgentPassword> + * <ldapTLS>1</ldapTLS> + * <turnOffCertCheck>0</turnOffCertCheck> + * <ldapIgnoreNamingRules/> + * <ldapUserDisplayName>displayname</ldapUserDisplayName> + * <ldapUserDisplayName2>uid</ldapUserDisplayName2> + * <ldapUserFilterObjectclass>inetOrgPerson</ldapUserFilterObjectclass> + * <ldapUserFilterGroups></ldapUserFilterGroups> + * <ldapUserFilter>(&(objectclass=nextcloudUser)(nextcloudEnabled=TRUE))</ldapUserFilter> + * <ldapUserFilterMode>1</ldapUserFilterMode> + * <ldapGroupFilter>(&(|(objectclass=nextcloudGroup)))</ldapGroupFilter> + * <ldapGroupFilterMode>0</ldapGroupFilterMode> + * <ldapGroupFilterObjectclass>nextcloudGroup</ldapGroupFilterObjectclass> + * <ldapGroupFilterGroups></ldapGroupFilterGroups> + * <ldapGroupDisplayName>cn</ldapGroupDisplayName> + * <ldapGroupMemberAssocAttr>memberUid</ldapGroupMemberAssocAttr> + * <ldapLoginFilter>(&(|(objectclass=inetOrgPerson))(uid=%uid))</ldapLoginFilter> + * <ldapLoginFilterMode>0</ldapLoginFilterMode> + * <ldapLoginFilterEmail>0</ldapLoginFilterEmail> + * <ldapLoginFilterUsername>1</ldapLoginFilterUsername> + * <ldapLoginFilterAttributes></ldapLoginFilterAttributes> + * <ldapQuotaAttribute></ldapQuotaAttribute> + * <ldapQuotaDefault></ldapQuotaDefault> + * <ldapEmailAttribute>mail</ldapEmailAttribute> + * <ldapCacheTTL>20</ldapCacheTTL> + * <ldapUuidUserAttribute>auto</ldapUuidUserAttribute> + * <ldapUuidGroupAttribute>auto</ldapUuidGroupAttribute> + * <ldapOverrideMainServer></ldapOverrideMainServer> + * <ldapConfigurationActive>1</ldapConfigurationActive> + * <ldapAttributesForUserSearch>uid;sn;givenname</ldapAttributesForUserSearch> + * <ldapAttributesForGroupSearch></ldapAttributesForGroupSearch> + * <ldapExperiencedAdmin>0</ldapExperiencedAdmin> + * <homeFolderNamingRule></homeFolderNamingRule> + * <hasPagedResultSupport></hasPagedResultSupport> + * <hasMemberOfFilterSupport></hasMemberOfFilterSupport> + * <useMemberOfToDetectMembership>1</useMemberOfToDetectMembership> + * <ldapExpertUsernameAttr>uid</ldapExpertUsernameAttr> + * <ldapExpertUUIDUserAttr>uid</ldapExpertUUIDUserAttr> + * <ldapExpertUUIDGroupAttr></ldapExpertUUIDGroupAttr> + * <lastJpegPhotoLookup>0</lastJpegPhotoLookup> + * <ldapNestedGroups>0</ldapNestedGroups> + * <ldapPagingSize>500</ldapPagingSize> + * <turnOnPasswordChange>1</turnOnPasswordChange> + * <ldapDynamicGroupMemberURL></ldapDynamicGroupMemberURL> + * </data> + * </ocs> + * + * @param string $configID + * @param bool|string $showPassword + * @return DataResponse + * @throws OCSException + */ + public function show($configID, $showPassword = false) { + $this->ensureConfigIDExists($configID); + + try { + $config = new Configuration($configID); + $data = $config->getConfiguration(); + if(!boolval(intval($showPassword))) { + $data['ldapAgentPassword'] = '***'; + } + foreach ($data as $key => $value) { + if(is_array($value)) { + $value = implode(';', $value); + $data[$key] = $value; + } + } + } catch (\Exception $e) { + $this->logger->logException($e); + throw new OCSException('An issue occurred when modifying the config.'); + } + + return new DataResponse($data); + } + + /** * if the given config ID is not available, an exception is thrown * * @param string $configID |