Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a right to create, download and delete backup #42

Merged
merged 2 commits into from
Apr 30, 2023

Conversation

vincent-tarrit
Copy link
Contributor

Hello, a quick PR to add some rights on the table actions

@shuvroroy shuvroroy merged commit c359980 into shuvroroy:main Apr 30, 2023
@shuvroroy
Copy link
Owner

Thanks

@aliaswpeu
Copy link

After this I can't see the button to create and delete backup,
I'v got shield installed and I don't see where I can add those permissions, can i generate them somehow ?

@JackWH
Copy link

JackWH commented May 13, 2023

@aliaswpeu Same issue here. It can be fixed by adding the lines below to the boot() method in AuthServiceProvider.php. Adjust as needed to suit your permissions:

Gate::define('create-backup', fn(User $user) => $user->isAdmin());
Gate::define('download-backup', fn(User $user) => $user->isDeveloper());
Gate::define('delete-backup', fn(User $user) => false);

It would've been helpful if this PR was backwards-compatible, documented, and could be controlled via the config file. The ability names (e.g. create-backup) don't follow normal convention (createBackup). This prevents them from being registered in Policy classes, at least without introducing a workaround.

@aliaswpeu
Copy link

@aliaswpeu Same issue here. It can be fixed by adding the lines below to the boot() method in AuthServiceProvider.php. Adjust as needed to suit your permissions:

Gate::define('create-backup', fn(User $user) => $user->isAdmin());
Gate::define('download-backup', fn(User $user) => $user->isDeveloper());
Gate::define('delete-backup', fn(User $user) => false);

It would've been helpful if this PR was backwards-compatible, documented, and could be controlled via the config file. The ability names (e.g. create-backup) don't follow normal convention (createBackup). This prevents them from being registered in Policy classes, at least without introducing a workaround.

Thank You, I just downgraded this package in my project (it seems that it was the only thing added in the last update, so not an issue for me) and it's working fine without permission. Although it's a good feature to restrict access.

@mokhosh
Copy link
Contributor

mokhosh commented Jan 21, 2024

@aliaswpeu Same issue here. It can be fixed by adding the lines below to the boot() method in AuthServiceProvider.php. Adjust as needed to suit your permissions:

Gate::define('create-backup', fn(User $user) => $user->isAdmin());
Gate::define('download-backup', fn(User $user) => $user->isDeveloper());
Gate::define('delete-backup', fn(User $user) => false);

It would've been helpful if this PR was backwards-compatible, documented, and could be controlled via the config file. The ability names (e.g. create-backup) don't follow normal convention (createBackup). This prevents them from being registered in Policy classes, at least without introducing a workaround.

This is worth being in the docs imo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants