Skip to content

Commit

Permalink
Use new $app->role() method in core code
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbestle committed Dec 17, 2024
1 parent 023eace commit 44735ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/areas/languages/views.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/Cms/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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] ??= [];

Expand All @@ -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] ??= [];

Expand All @@ -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] ??= [];

Expand Down
6 changes: 3 additions & 3 deletions src/Cms/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -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] ??= [];

Expand Down Expand Up @@ -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] ??= [];

Expand Down Expand Up @@ -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] ??= [];

Expand Down

0 comments on commit 44735ca

Please sign in to comment.