diff --git a/lib/Db/Acl.php b/lib/Db/Acl.php index d977f3f06..f4355ade8 100644 --- a/lib/Db/Acl.php +++ b/lib/Db/Acl.php @@ -82,11 +82,7 @@ class Acl extends RelationalEntity implements \JsonSerializable { 'owner' => $this->getOwner() ]; } - - /* - * FIXME: migrate other code to const PERMISSION_TYPE_ instead of strings - * iirc js uses those strings as well - */ + public function getTypeString() { if ($this->type === Acl::PERMISSION_TYPE_GROUP) { return 'group'; diff --git a/lib/Service/PermissionService.php b/lib/Service/PermissionService.php index ca1badae5..bd3985a51 100644 --- a/lib/Service/PermissionService.php +++ b/lib/Service/PermissionService.php @@ -127,14 +127,14 @@ class PermissionService { public function userCan(array $acls, $permission) { // check for users foreach ($acls as $acl) { - if ($acl->getType() === "user" && $acl->getParticipant() === $this->userId) { + if ($acl->getType() === Acl::PERMISSION_TYPE_USER && $acl->getParticipant() === $this->userId) { return $acl->getPermission($permission); } } // check for groups $hasGroupPermission = false; foreach ($acls as $acl) { - if (!$hasGroupPermission && $acl->getType() === "group" && $this->groupManager->isInGroup($this->userId, $acl->getParticipant())) { + if (!$hasGroupPermission && $acl->getType() === Acl::PERMISSION_TYPE_GROUP && $this->groupManager->isInGroup($this->userId, $acl->getParticipant())) { $hasGroupPermission = $acl->getPermission($permission); } }