diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-03-15 14:16:43 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-04-05 12:38:39 +0200 |
commit | 8fe914f07e1b4d41c02e127e2242e0a770535455 (patch) | |
tree | b101bce725bf2b9a385077008fe4b9999285acb0 /apps/user_ldap/lib/Mapping | |
parent | feef3cbba03c4517b25a60820e8c4534b0a02b67 (diff) | |
download | nextcloud-server-8fe914f07e1b4d41c02e127e2242e0a770535455.tar.gz nextcloud-server-8fe914f07e1b4d41c02e127e2242e0a770535455.zip |
LDAP backend to emit announce and revoke signals on mapping changes
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/Mapping')
-rw-r--r-- | apps/user_ldap/lib/Mapping/AbstractMapping.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index f5f56ce03d6..c7d737a7631 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -279,6 +279,32 @@ abstract class AbstractMapping { } /** + * clears the mapping table one by one and executing a callback with + * each row's id (=owncloud_name col) + * + * @param callable $preCallback + * @param callable $postCallback + * @return bool true on success, false when at least one row was not + * deleted + */ + public function clearCb(Callable $preCallback, Callable $postCallback): bool { + $picker = $this->dbc->getQueryBuilder(); + $picker->select('owncloud_name') + ->from($this->getTableName()); + $cursor = $picker->execute(); + $result = true; + while($id = $cursor->fetchColumn(0)) { + $preCallback($id); + if($isUnmapped = $this->unmap($id)) { + $postCallback($id); + } + $result &= $isUnmapped; + } + $cursor->closeCursor(); + return $result; + } + + /** * returns the number of entries in the mappings table * * @return int |