From 44735cadb8ee6e1b8b865553a27db9d6cd256c0b Mon Sep 17 00:00:00 2001 From: Lukas Bestle Date: Tue, 17 Dec 2024 21:43:48 +0100 Subject: [PATCH] Use new `$app->role()` method in core code --- config/areas/languages/views.php | 2 +- src/Cms/File.php | 6 +++--- src/Cms/Page.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/areas/languages/views.php b/config/areas/languages/views.php index 2dcdcd84a3..ccc9ac3cc4 100644 --- a/config/areas/languages/views.php +++ b/config/areas/languages/views.php @@ -22,7 +22,7 @@ // TODO: update following line and adapt for update and // delete options when `languageVariables.*` permissions available - $canUpdate = $kirby->user()?->role()->permissions()->for('languages', 'update') === true; + $canUpdate = $kirby->role()?->permissions()->for('languages', 'update') === true; ksort($foundation); diff --git a/src/Cms/File.php b/src/Cms/File.php index 9bf38cd2db..3113a10c35 100644 --- a/src/Cms/File.php +++ b/src/Cms/File.php @@ -319,7 +319,7 @@ public function isAccessible(): bool } static $accessible = []; - $role = $this->kirby()->user()?->role()->id() ?? '__none__'; + $role = $this->kirby()->role()?->id() ?? '__none__'; $template = $this->template() ?? '__none__'; $accessible[$role] ??= []; @@ -343,7 +343,7 @@ public function isListable(): bool } static $listable = []; - $role = $this->kirby()->user()?->role()->id() ?? '__none__'; + $role = $this->kirby()->role()?->id() ?? '__none__'; $template = $this->template() ?? '__none__'; $listable[$role] ??= []; @@ -358,7 +358,7 @@ public function isListable(): bool public function isReadable(): bool { static $readable = []; - $role = $this->kirby()->user()?->role()->id() ?? '__none__'; + $role = $this->kirby()->role()?->id() ?? '__none__'; $template = $this->template() ?? '__none__'; $readable[$role] ??= []; diff --git a/src/Cms/Page.php b/src/Cms/Page.php index 97f7d80a1e..45e78c1b0b 100644 --- a/src/Cms/Page.php +++ b/src/Cms/Page.php @@ -523,7 +523,7 @@ public function isAccessible(): bool } static $accessible = []; - $role = $this->kirby()->user()?->role()->id() ?? '__none__'; + $role = $this->kirby()->role()?->id() ?? '__none__'; $template = $this->intendedTemplate()->name(); $accessible[$role] ??= []; @@ -695,7 +695,7 @@ public function isListable(): bool } static $listable = []; - $role = $this->kirby()->user()?->role()->id() ?? '__none__'; + $role = $this->kirby()->role()?->id() ?? '__none__'; $template = $this->intendedTemplate()->name(); $listable[$role] ??= []; @@ -753,7 +753,7 @@ public function isPublished(): bool public function isReadable(): bool { static $readable = []; - $role = $this->kirby()->user()?->role()->id() ?? '__none__'; + $role = $this->kirby()->role()?->id() ?? '__none__'; $template = $this->intendedTemplate()->name(); $readable[$role] ??= [];