JeffBeltran / sanctum-tokens

Simple Nova Plugin to generate a Laravel Sanctum Personal Access Token
https://novapackages.com/packages/jeffbeltran/sanctum-tokens
51 stars 25 forks source link

Fixed list of authorisations #54

Open ryanmitchell opened 2 years ago

ryanmitchell commented 2 years ago

It would be great to have an option to only allow the ui to tick from a fixed list of authorisations/privileges rathe than a free type field.

it could be an optional method so the default behaviour stays as is.

would you be interested in this?

JeffBeltran commented 2 years ago

yeah this is a cool idea, you could do something like SanctumTokens::make()->availableAbilities(['foo', 'bar-baz']),?

ryanmitchell commented 2 years ago

Yep exactly that! I can help with it if you need?

JeffBeltran commented 2 years ago

yeah if you want to give it a go im more than ok with that. Otherwise it might be a bit before i get a chance to take a look.

On a side note i did just push up some changes to the way the plugin is deployed, so if you open a PR you might get a few checks that fail and they would be related to prettier (makes PRs much easier to read) and commit messages (following https://www.conventionalcommits.org/en/v1.0.0/). Hopefully it's straight forward for you but if you get stuck just let me know

ryanmitchell commented 2 years ago

So I actually think for my needs hideAbilities() is enough as we're using policies for resource protection. If you think this is worth adding I can work on it, but it will probably take me a couple of weeks to circle back to it.

JeffBeltran commented 2 years ago

I think it's a neat idea but i'd put it on a nice to have list unless someone else comments about wanting it. There is a bit of UI work that would need to be done to handle this.

So we can just circle back around to this whenever we get the time or have a need

dbpolito commented 2 years ago

Hey guys, i would love to see this... Are someone up for doing this one? Or should i work on a PR?

JeffBeltran commented 2 years ago

Hey @dbpolito yeah im down for this feature but i currently don't have the bandwidth to get this added so if you wanted to start on a PR i would be happy to chime in.

On that note, when you do open the PR the checks might fail if you don't follow Conventional Commits and you'll need to make sure you have prettier setup or run the command before commit yarn prettier-fix. I'll try to get a more detailed description setup on the readme but if you get stuck just let me know and i'll be happy to help