nest-access-control icon indicating copy to clipboard operation
nest-access-control copied to clipboard

Unclear what the video - title attribute does in the example

Open spotlesscoder opened this issue 4 years ago • 2 comments

The sample contains this code

roles
  .grant(AppRoles.USER_CREATE_ANY_VIDEO) // define new or modify existing role. also takes an array.
    .createOwn('video') // equivalent to .createOwn('video', ['*'])
    .deleteOwn('video')
    .readAny('video')
  .grant(AppRoles.ADMIN_UPDATE_OWN_VIDEO) // switch to another role without breaking the chain
    .extend(AppRoles.USER_CREATE_ANY_VIDEO) // inherit role capabilities. also takes an array
    .updateAny('video', ['title']) // explicitly defined attributes
    .deleteAny('video');

What exactly does the title attribute do in the "updateAny" line? Where is it checked?

spotlesscoder avatar Nov 07 '21 18:11 spotlesscoder

it would allow you to define which attribute that role can update, for example, you can define they can only update the title of the video, but say, not the description of the video.

shekohex avatar Nov 08 '21 09:11 shekohex

Could you please add a code sample? Still don't get it exactly how I would use it

spotlesscoder avatar Nov 08 '21 19:11 spotlesscoder