diff options
author | Georg Ehrke <developer@georgehrke.com> | 2019-08-14 13:38:11 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2019-08-15 15:41:28 +0200 |
commit | 63d584afb5727737fe73a0ca2ecf720022b33922 (patch) | |
tree | c3fc0a335c2f3766b61257270cdb167b9a7aa788 /apps/dav/lib/CalDAV/ResourceBooking | |
parent | 3d86537dc922083427a283e84d726d416f9ec95c (diff) | |
download | nextcloud-server-63d584afb5727737fe73a0ca2ecf720022b33922.tar.gz nextcloud-server-63d584afb5727737fe73a0ca2ecf720022b33922.zip |
use principaluri instead of userid, allowing to add delegates for rooms and things
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
!fixup add owner_id and proxy_id as db index, since we use it for querying
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
!fixup don't add ACL for each individual proxy, just use calendar-proxy groups
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
!fixup allow delegation of resources / rooms
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
!fixup fix addIndex call in migration
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
!fixup fix remaining constructor calls of Principal
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
!fixup minor fixes and unit tests
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib/CalDAV/ResourceBooking')
3 files changed, 33 insertions, 37 deletions
diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php index aab5fcab8ad..63ed3381d14 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php @@ -22,6 +22,8 @@ */ namespace OCA\DAV\CalDAV\ResourceBooking; +use OCA\DAV\CalDAV\Proxy\ProxyMapper; +use OCA\DAV\Traits\PrincipalProxyTrait; use OCP\IDBConnection; use OCP\IGroupManager; use OCP\ILogger; @@ -44,6 +46,9 @@ abstract class AbstractPrincipalBackend implements BackendInterface { /** @var ILogger */ private $logger; + /** @var ProxyMapper */ + private $proxyMapper; + /** @var string */ private $principalPrefix; @@ -72,6 +77,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { IUserSession $userSession, IGroupManager $groupManager, ILogger $logger, + ProxyMapper $proxyMapper, string $principalPrefix, string $dbPrefix, string $cuType) { @@ -79,6 +85,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $this->userSession = $userSession; $this->groupManager = $groupManager; $this->logger = $logger; + $this->proxyMapper = $proxyMapper; $this->principalPrefix = $principalPrefix; $this->dbTableName = 'calendar_' . $dbPrefix . 's'; $this->dbMetaDataTableName = $this->dbTableName . '_md'; @@ -86,6 +93,8 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $this->cuType = $cuType; } + use PrincipalProxyTrait; + /** * Returns a list of principals based on a prefix. * @@ -216,39 +225,6 @@ abstract class AbstractPrincipalBackend implements BackendInterface { } /** - * Returns the list of members for a group-principal - * - * @param string $principal - * @return string[] - */ - public function getGroupMemberSet($principal) { - return []; - } - - /** - * Returns the list of groups a principal is a member of - * - * @param string $principal - * @return array - */ - public function getGroupMembership($principal) { - return []; - } - - /** - * Updates the list of group members for a group principal. - * - * The principals should be passed as a list of uri's. - * - * @param string $principal - * @param string[] $members - * @throws Exception - */ - public function setGroupMemberSet($principal, array $members) { - throw new Exception('Setting members of the group is not supported yet'); - } - - /** * @param string $path * @param PropPatch $propPatch * @return int diff --git a/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php index 0f6e6e7b4fd..128e6c21fad 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php @@ -22,24 +22,34 @@ */ namespace OCA\DAV\CalDAV\ResourceBooking; +use OCA\DAV\CalDAV\Proxy\ProxyMapper; use OCP\IDBConnection; use OCP\IGroupManager; use OCP\ILogger; use OCP\IUserSession; +/** + * Class ResourcePrincipalBackend + * + * @package OCA\DAV\CalDAV\ResourceBooking + */ class ResourcePrincipalBackend extends AbstractPrincipalBackend { /** + * ResourcePrincipalBackend constructor. + * * @param IDBConnection $dbConnection * @param IUserSession $userSession * @param IGroupManager $groupManager * @param ILogger $logger + * @param ProxyMapper $proxyMapper */ public function __construct(IDBConnection $dbConnection, IUserSession $userSession, IGroupManager $groupManager, - ILogger $logger) { + ILogger $logger, + ProxyMapper $proxyMapper) { parent::__construct($dbConnection, $userSession, $groupManager, $logger, - 'principals/calendar-resources', 'resource', 'RESOURCE'); + $proxyMapper, 'principals/calendar-resources', 'resource', 'RESOURCE'); } } diff --git a/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php index 68a344aa0ca..3e9e8f68852 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php @@ -22,24 +22,34 @@ */ namespace OCA\DAV\CalDAV\ResourceBooking; +use OCA\DAV\CalDAV\Proxy\ProxyMapper; use OCP\IDBConnection; use OCP\IGroupManager; use OCP\ILogger; use OCP\IUserSession; +/** + * Class RoomPrincipalBackend + * + * @package OCA\DAV\CalDAV\ResourceBooking + */ class RoomPrincipalBackend extends AbstractPrincipalBackend { /** + * RoomPrincipalBackend constructor. + * * @param IDBConnection $dbConnection * @param IUserSession $userSession * @param IGroupManager $groupManager * @param ILogger $logger + * @param ProxyMapper $proxyMapper */ public function __construct(IDBConnection $dbConnection, IUserSession $userSession, IGroupManager $groupManager, - ILogger $logger) { + ILogger $logger, + ProxyMapper $proxyMapper) { parent::__construct($dbConnection, $userSession, $groupManager, $logger, - 'principals/calendar-rooms', 'room', 'ROOM'); + $proxyMapper, 'principals/calendar-rooms', 'room', 'ROOM'); } } |