final changes

This commit is contained in:
root 2016-07-27 15:10:35 +08:00
parent 1fb080df2b
commit 32fb6beac3
8 changed files with 23 additions and 30 deletions

View file

@ -2,7 +2,6 @@
/**
* @author Roger Szabo <roger.szabo@web.de>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify

View file

@ -2,7 +2,6 @@
/**
* @author Roger Szabo <roger.szabo@web.de>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
@ -42,7 +41,7 @@ interface IUserLDAP {
/**
* Return the username for the given LDAP DN, if available.
* @param string $dn
* @return string|false with the name to use in ownCloud
* @return string|false with the username
*/
public function dn2UserName($dn);
}

View file

@ -2,7 +2,6 @@
/**
* @author Roger Szabo <roger.szabo@web.de>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
@ -58,8 +57,8 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
}
/**
* Translate an ownCloud user id to LDAP DN
* @param string $uid ownCloud user id
* Translate an user id to LDAP DN
* @param string $uid user id
* @return string with the LDAP DN
* @throws \Exception if translation was unsuccessful
*/
@ -75,16 +74,16 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
}
/**
* Translate a LDAP DN to an ownCloud user name. If there is no mapping between
* Translate a LDAP DN to an internal user name. If there is no mapping between
* the DN and the user name, a new one will be created.
* @param string $dn LDAP DN
* @return string with the ownCloud user name
* @return string with the internal user name
* @throws \Exception if translation was unsuccessful
*/
public function getUserName($dn) {
$result = $this->backend->dn2UserName($dn);
if(!$result){
throw new \Exception('Translation to ownCloud user name unsuccessful');
throw new \Exception('Translation to internal user name unsuccessful');
}
return $result;
}
@ -110,7 +109,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
/**
* Return a new LDAP connection resource for the specified user.
* The connection must be closed manually.
* @param string $uid ownCloud user id
* @param string $uid user id
* @return resource of the LDAP connection
* @throws \Exception if user id was not found in LDAP
*/
@ -123,7 +122,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
/**
* Get the LDAP base for users.
* @param string $uid ownCloud user id
* @param string $uid user id
* @return string the base for users
* @throws \Exception if user id was not found in LDAP
*/
@ -136,7 +135,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
/**
* Get the LDAP base for groups.
* @param string $uid ownCloud user id
* @param string $uid user id
* @return string the base for groups
* @throws \Exception if user id was not found in LDAP
*/
@ -149,7 +148,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
/**
* Clear the cache if a cache is used, otherwise do nothing.
* @param string $uid ownCloud user id
* @param string $uid user id
* @throws \Exception if user id was not found in LDAP
*/
public function clearCache($uid) {
@ -171,7 +170,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
/**
* Flag record for deletion.
* @param string $uid ownCloud user id
* @param string $uid user id
*/
public function flagRecord($uid) {
$this->deletedUsersIndex->markUser($uid);
@ -179,7 +178,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
/**
* Unflag record for deletion.
* @param string $uid ownCloud user id
* @param string $uid user id
*/
public function unflagRecord($uid) {
//do nothing

View file

@ -2,7 +2,6 @@
/**
* @author Roger Szabo <roger.szabo@web.de>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify

View file

@ -37,7 +37,7 @@ class CleanUpTest extends \Test\TestCase {
->getMock();
$mocks['ocConfig'] = $this->getMock('\OCP\IConfig');
$mocks['db'] = $this->getMock('\OCP\IDBConnection');
$mocks['helper'] = new \OCA\User_LDAP\Helper();
$mocks['helper'] = $this->getMock('\OCA\User_LDAP\Helper');
return $mocks;
}

View file

@ -2,7 +2,6 @@
/**
* @author Roger Szabo <roger.szabo@web.de>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
@ -30,14 +29,14 @@ namespace OCP\LDAP;
interface IDeletionFlagSupport {
/**
* Flag record for deletion.
* @param string $uid ownCloud user id
* @param string $uid user id
* @since 9.2.0
*/
public function flagRecord($uid);
/**
* Unflag record for deletion.
* @param string $uid ownCloud user id
* @param string $uid user id
* @since 9.2.0
*/
public function unflagRecord($uid);

View file

@ -2,7 +2,6 @@
/**
* @author Roger Szabo <roger.szabo@web.de>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
@ -29,17 +28,17 @@ namespace OCP\LDAP;
*/
interface ILDAPProvider {
/**
* Translate an ownCloud username to LDAP DN.
* @param string $uid ownCloud user id
* Translate a user id to LDAP DN.
* @param string $uid user id
* @return string
* @since 9.2.0
*/
public function getUserDN($uid);
/**
* Translate a LDAP DN to an ownCloud user name.
* Translate a LDAP DN to an internal user name.
* @param string $dn LDAP DN
* @return string with the ownCloud user name
* @return string with the internal user name
* @throws \Exception if translation was unsuccessful
* @since 9.2.0
*/
@ -63,7 +62,7 @@ interface ILDAPProvider {
/**
* Return a new LDAP connection resource for the specified user.
* @param string $uid ownCloud user id
* @param string $uid user id
* @return resource of the LDAP connection
* @since 9.2.0
*/
@ -71,7 +70,7 @@ interface ILDAPProvider {
/**
* Get the LDAP base for users.
* @param string $uid ownCloud user id
* @param string $uid user id
* @return string the base for users
* @throws \Exception if user id was not found in LDAP
* @since 9.2.0
@ -80,7 +79,7 @@ interface ILDAPProvider {
/**
* Get the LDAP base for groups.
* @param string $uid ownCloud user id
* @param string $uid user id
* @return string the base for groups
* @throws \Exception if user id was not found in LDAP
* @since 9.2.0
@ -97,7 +96,7 @@ interface ILDAPProvider {
/**
* Clear the cache if a cache is used, otherwise do nothing.
* @param string $uid ownCloud user id
* @param string $uid user id
* @since 9.2.0
*/
public function clearCache($uid);

View file

@ -2,7 +2,6 @@
/**
* @author Roger Szabo <roger.szabo@web.de>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify