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

can modify selected fields only #397

Closed
binarytracer opened this Issue Jan 16, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@binarytracer
Copy link

binarytracer commented Jan 16, 2017

using feathers-cli: 1.2.7
Ive created a feathers application via feathers-cli ..... all green ... done.
so currently im on the feathers-authentication < 1.x, where i all all the hooks here, cool legacy hooks, can be utilize.

Now, is there a way / future plan / incoming stuff, that describes ... allowing authorize users, to edit only specified fields in a document ...?

If no, how can I make it?

@eddyystop

This comment has been minimized.

Copy link
Member

eddyystop commented Jan 16, 2017

You would use before hooks for that.

@binarytracer

This comment has been minimized.

Copy link
Author

binarytracer commented Jan 17, 2017

i think ill can do this by,

hooks = {
 before: {
    update: [
      ... /* roles related hooks here */, 
      controlPerFieldHook
    ]
 }
};

function controlPerFieldHook(hook, next){

  ... /* logic here */
 if( user.roles === "limited"){
   ... /* strip fields */
}

 next();
}

is there any better implementation than this?

@daffl

This comment has been minimized.

Copy link
Member

daffl commented Jan 17, 2017

You got it. A custom hook is definitely the way to go.

For more advanced permissions you can also have a look at https://github.com/feathersjs/feathers-permissions which is currently under development.

@daffl daffl closed this Jan 17, 2017

@binarytracer

This comment has been minimized.

Copy link
Author

binarytracer commented Jan 17, 2017

thanks @daffl.
I think we need to upgrade first to feathers-authentication >= 1.x before using the feathers-permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.