diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-11-06 16:07:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-06 16:07:31 +0100 |
commit | 5411d60b249cc12b429ed8083e7f34d1415d278e (patch) | |
tree | f50b1b15040a14a663427b6868c111c7176a5eb2 /apps/user_ldap/lib/Group_Proxy.php | |
parent | 0256f68c4909ecacc1b2b515253523809a870868 (diff) | |
parent | fa565750d1f94f9d3f7e2229e7ec7aadd0d06063 (diff) | |
download | nextcloud-server-5411d60b249cc12b429ed8083e7f34d1415d278e.tar.gz nextcloud-server-5411d60b249cc12b429ed8083e7f34d1415d278e.zip |
Merge pull request #5321 from coletivoEITA/user_ldap_plugins_structure
Implement plugins infrastructure in User_LDAP
Diffstat (limited to 'apps/user_ldap/lib/Group_Proxy.php')
-rw-r--r-- | apps/user_ldap/lib/Group_Proxy.php | 76 |
1 files changed, 71 insertions, 5 deletions
diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php index e546c84a90c..50c46dfbc0b 100644 --- a/apps/user_ldap/lib/Group_Proxy.php +++ b/apps/user_ldap/lib/Group_Proxy.php @@ -26,7 +26,7 @@ namespace OCA\User_LDAP; -class Group_Proxy extends Proxy implements \OCP\GroupInterface { +class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP { private $backends = array(); private $refBackend = null; @@ -34,11 +34,11 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface { * Constructor * @param string[] $serverConfigPrefixes array containing the config Prefixes */ - public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap) { + public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap, GroupPluginManager $groupPluginManager) { parent::__construct($ldap); foreach($serverConfigPrefixes as $configPrefix) { $this->backends[$configPrefix] = - new \OCA\User_LDAP\Group_LDAP($this->getAccess($configPrefix)); + new \OCA\User_LDAP\Group_LDAP($this->getAccess($configPrefix), $groupPluginManager); if(is_null($this->refBackend)) { $this->refBackend = &$this->backends[$configPrefix]; } @@ -146,6 +146,51 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface { } /** + * @param string $gid + * @return bool + */ + public function createGroup($gid) { + return $this->handleRequest( + $gid, 'createGroup', array($gid)); + } + + /** + * delete a group + * @param string $gid gid of the group to delete + * @return bool + */ + public function deleteGroup($gid) { + return $this->handleRequest( + $gid, 'deleteGroup', array($gid)); + } + + /** + * Add a user to a group + * @param string $uid Name of the user to add to group + * @param string $gid Name of the group in which add the user + * @return bool + * + * Adds a user to a group. + */ + public function addToGroup($uid, $gid) { + return $this->handleRequest( + $gid, 'addToGroup', array($uid, $gid)); + } + + /** + * Removes a user from a group + * @param string $uid Name of the user to remove from group + * @param string $gid Name of the group from which remove the user + * @return bool + * + * removes the user from a group. + */ + public function removeFromGroup($uid, $gid) { + return $this->handleRequest( + $gid, 'removeFromGroup', array($uid, $gid)); + } + + /** * returns the number of users in a group, who match the search term * @param string $gid the internal group name * @param string $search optional, a search string @@ -157,6 +202,16 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface { } /** + * get an array with group details + * @param string $gid + * @return array|false + */ + public function getGroupDetails($gid) { + return $this->handleRequest( + $gid, 'getGroupDetails', array($gid)); + } + + /** * get a list of all groups * @return string[] with group names * @@ -190,7 +245,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface { * @return boolean * * Returns the supported actions as int to be - * compared with \OC\User\Backend::CREATE_USER etc. + * compared with \OCP\GroupInterface::CREATE_GROUP etc. */ public function implementsActions($actions) { //it's the same across all our user backends obviously @@ -203,6 +258,17 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface { * @return Access instance of Access for LDAP interaction */ public function getLDAPAccess($gid) { - return $this->handleRequest($gid, 'getLDAPAccess', []); + return $this->handleRequest($gid, 'getLDAPAccess', [$gid]); } + + /** + * Return a new LDAP connection for the specified group. + * The connection needs to be closed manually. + * @param string $gid + * @return resource of the LDAP connection + */ + public function getNewLDAPConnection($gid) { + return $this->handleRequest($gid, 'getNewLDAPConnection', array($gid)); + } + } |