mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Remove the link between the principals table and the sabre principals connector.
This commit is contained in:
parent
503e5cada3
commit
90e2962c91
2 changed files with 0 additions and 48 deletions
|
|
@ -316,10 +316,6 @@ class OC{
|
|||
OC_App::loadApps();
|
||||
}
|
||||
|
||||
// Last part: connect some hooks
|
||||
OC_HOOK::connect('OC_User', 'post_createUser', 'OC_Connector_Sabre_Principal', 'addPrincipal');
|
||||
OC_HOOK::connect('OC_User', 'post_deleteUser', 'OC_Connector_Sabre_Principal', 'deletePrincipal');
|
||||
|
||||
//make sure temporary files are cleaned up
|
||||
register_shutdown_function(array('OC_Helper','cleanTmp'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,50 +8,6 @@
|
|||
*/
|
||||
|
||||
class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend {
|
||||
/**
|
||||
* TODO: write doc
|
||||
*/
|
||||
public static function addPrincipal($params){
|
||||
// Add the user
|
||||
$uri = 'principals/'.$params['uid'];
|
||||
$displayname = $params['uid'];
|
||||
$query = OC_DB::prepare('INSERT INTO *PREFIX*principals (uri,displayname) VALUES(?,?)');
|
||||
$query->execute(array($uri,$displayname));
|
||||
|
||||
// Add calendar and addressbook read and write support (sharing calendars)
|
||||
$uri = 'principals/'.$params['uid'].'/calendar-proxy-read';
|
||||
$displayname = null;
|
||||
$query->execute(array($uri,$displayname));
|
||||
$uri = 'principals/'.$params['uid'].'/calendar-proxy-write';
|
||||
$query->execute(array($uri,$displayname));
|
||||
$uri = 'principals/'.$params['uid'].'/addressbook-proxy-read';
|
||||
$query->execute(array($uri,$displayname));
|
||||
$uri = 'principals/'.$params['uid'].'/addressbook-proxy-write';
|
||||
$query->execute(array($uri,$displayname));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: write doc
|
||||
*/
|
||||
public static function deletePrincipal($params){
|
||||
$query = OC_DB::prepare('SELECT * FROM *PREFIX*principals');
|
||||
$result = $query->execute();
|
||||
|
||||
$deleteprincipal = OC_DB::prepare('DELETE FROM *PREFIX*principals WHERE id = ?');
|
||||
$deletegroup = OC_DB::prepare('DELETE FROM *PREFIX*principalgroups WHERE principal_id = ? OR member_id = ?');
|
||||
// We have to delete the principals and relations! Principals include
|
||||
while($row = $result->fetchRow()){
|
||||
// Checking if the principal is in the prefix
|
||||
$array = explode('/',$row['uri']);
|
||||
if ($array[1] != $params['uid']) continue;
|
||||
$deleteprincipal->execute(array($row['id']));
|
||||
$deletegroup->execute(array($row['id'],$row['id']));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of principals based on a prefix.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue