117 lines
1.7 KiB
PHP
117 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace davina\overwrites;
|
|
|
|
require_once('vendor/autoload.php');
|
|
require_once(DIR_LOGIC . '/helpers/list.php');
|
|
|
|
|
|
/**
|
|
*/
|
|
class class_principle_backend
|
|
implements \Sabre\DAVACL\PrincipalBackend\BackendInterface
|
|
{
|
|
|
|
/**
|
|
* @var array {map<string, \davina\sources\interface_source>}
|
|
*/
|
|
private array $sources;
|
|
|
|
|
|
/**
|
|
*/
|
|
public function __construct(
|
|
array $sources
|
|
)
|
|
{
|
|
$this->sources = $sources;
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
public function getPrincipalsByPrefix(
|
|
$prefixPath
|
|
)
|
|
{
|
|
return \davina\helpers\list_\map(
|
|
\array_keys($this->sources),
|
|
fn($source_name) => [
|
|
'uri' => \davina\helpers\string_\coin(
|
|
'principals/{{name}}',
|
|
[
|
|
'name' => $source_name,
|
|
]
|
|
),
|
|
'{DAV:}displayname' => $source_name,
|
|
]
|
|
);
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
public function getPrincipalByPath(
|
|
$path
|
|
)
|
|
{
|
|
$parts = \explode('/', $path);
|
|
$username = $parts[1];
|
|
return [
|
|
'uri' => $path,
|
|
'displayname' => $username,
|
|
];
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch)
|
|
{
|
|
throw (new \Exception('not implemented: updatePrincipal'));
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof')
|
|
{
|
|
throw (new \Exception('not implemented: searchPrincipals'));
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
public function findByUri($uri, $principalPrefix)
|
|
{
|
|
throw (new \Exception('not implemented: findByUri'));
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
public function getGroupMemberSet($principal)
|
|
{
|
|
throw (new \Exception('not implemented: getGroupMemberSet'));
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
public function getGroupMembership($principal)
|
|
{
|
|
return [];
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
public function setGroupMemberSet($principal, array $members)
|
|
{
|
|
throw (new \Exception('not implemented: setGroupMemberSet'));
|
|
}
|
|
|
|
}
|
|
|
|
?>
|