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

permission revoke based on ids as well #2552

Closed

Conversation

tariqali021
Copy link

No description provided.

@parallels999
Copy link
Contributor

There is no change

@tariqali021
Copy link
Author

There is no change

Added missing logic.. Need to support both using id & name when revoking permission. Ideally this can be a mixture of id & name that could also be done. Thanks to pointing out the missing code :-)

@parallels999
Copy link
Contributor

parallels999 commented Nov 13, 2023

Still, is 09ebf39 a refactor?
Needs some tests

@tariqali021
Copy link
Author

Yes I found some tweaks & fix it.. my docker is crashing & unable to test.. would be great if you review it carefully..

@parallels999
Copy link
Contributor

Seems that #2548 does the same, test it

@tariqali021
Copy link
Author

That's something else.. This change belongs to revoking permission given as int (primary key of permission table). Currently, it is only supporting based on name.

@parallels999
Copy link
Contributor

This change belongs to revoking permission given as int (primary key of permission table). Currently, it is only supporting based on name.

That is exactly what #2548 is adding

@tariqali021
Copy link
Author

Yes it is also doing the same what I'm trying to achieve but to me it seems not optimized way to do that.. correct me if I'm wrong. That code is finding each individual record from db either based on it or string. but the good thing is that it is revoking based on both primary key & name column

@parallels999
Copy link
Contributor

That code is finding each individual record from db either based on int or string

On removeRole yes, on revokePermissionTo no, permissions are getting from cache, not from DB

@tariqali021
Copy link
Author

yes but for very rare and edge case if we don't have cache stored at certain point. but still acceptable because of edge case.

@parallels999
Copy link
Contributor

parallels999 commented Nov 13, 2023

The documentation should also be updated, it says that it only accepts string or Permission object

The `givePermissionTo` and `revokePermissionTo` functions can accept a
string or a `Spatie\Permission\Models\Permission` object.

@tariqali021
Copy link
Author

yes and also enum

@spatie-bot
Copy link

Dear contributor,

because this pull request seems to be inactive for quite some time now, I've automatically closed it. If you feel this pull request deserves some attention from my human colleagues feel free to reopen it.

@spatie-bot spatie-bot closed this Mar 14, 2024
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.

3 participants