Skip to content

Commit

Permalink
fix(calendar): Fix getting the permissions of the user
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Dec 11, 2024
1 parent 6f3ee6b commit 4fd84e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/dav/lib/CalDAV/CalendarImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ public function getPermissions(): int {
$permissions = $this->calendar->getACL();
$result = 0;
foreach ($permissions as $permission) {
if ($this->calendarInfo['principaluri'] !== $permission['principal']) {
continue;
}

switch ($permission['privilege']) {
case '{DAV:}read':
$result |= Constants::PERMISSION_READ;
Expand All @@ -133,7 +137,7 @@ public function getPermissions(): int {
public function isWritable(): bool {
return $this->calendar->canWrite();
}

/**
* @since 26.0.0
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Calendar/ICalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getDisplayColor(): ?string;
public function search(string $pattern, array $searchProperties = [], array $options = [], ?int $limit = null, ?int $offset = null): array;

/**
* @return int build up using \OCP\Constants
* @return int build up using {@see \OCP\Constants}
* @since 13.0.0
*/
public function getPermissions(): int;
Expand Down

0 comments on commit 4fd84e4

Please sign in to comment.