Skip to content

Commit

Permalink
revert permission name generation for pages and widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
bezhanSalleh committed Oct 27, 2023
1 parent a8b8430 commit 47466aa
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Commands/MakeShieldGenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ protected function pageInfo(array $pages): void
return [
'#' => $key + 1,
'Page' => Str::replace(config('filament-shield.permission_prefixes.page') . '_', '', $page),
'Permission' => str($page)->lower()->toString(),
'Permission' => $page,
];
})
);
Expand All @@ -281,7 +281,7 @@ protected function widgetInfo(array $widgets): void
return [
'#' => $key + 1,
'Widget' => Str::replace(config('filament-shield.permission_prefixes.widget') . '_', '', $widget),
'Permission' => str($widget)->lower()->toString(),
'Permission' => $widget,
];
})
);
Expand Down
8 changes: 3 additions & 5 deletions src/FilamentShield.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function generateForPage(string $page): void
{
if (Utils::isPageEntityEnabled()) {
$permission = Utils::getPermissionModel()::firstOrCreate(
['name' => str($page)->lower()->toString()],
['name' => $page],
['guard_name' => Utils::getFilamentAuthGuard()]
)->name;

Expand All @@ -80,7 +80,7 @@ public static function generateForWidget(string $widget): void
{
if (Utils::isWidgetEntityEnabled()) {
$permission = Utils::getPermissionModel()::firstOrCreate(
['name' => str($widget)->lower()->toString()],
['name' => $widget],
['guard_name' => Utils::getFilamentAuthGuard()]
)->name;

Expand Down Expand Up @@ -208,7 +208,6 @@ public static function getPages(): ?array
->append('_')
->toString()
)
->lower()
->toString();

$pages["{$name}"] = "{$name}";
Expand All @@ -224,7 +223,7 @@ public static function getPages(): ?array
public static function getLocalizedPageLabel(string $page): string
{
$object = static::transformClassString($page);

$pageObject = new $object();

return $pageObject->getTitle()
Expand Down Expand Up @@ -263,7 +262,6 @@ public static function getWidgets(): ?array
->append('_')
->toString()
)
->lower()
->toString();

$widgets["{$name}"] = "{$name}";
Expand Down
1 change: 0 additions & 1 deletion src/Traits/HasPageShield.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ protected static function getPermissionName(): string
->append('_')
->toString()
)
->lower()
->toString();
}

Expand Down
1 change: 0 additions & 1 deletion src/Traits/HasWidgetShield.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ protected static function getPermissionName(): string
->append('_')
->toString()
)
->lower()
->toString();
}
}

0 comments on commit 47466aa

Please sign in to comment.