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

Question about integrating with baucis-gform #1

Open
stemey opened this issue Nov 1, 2014 · 1 comment
Open

Question about integrating with baucis-gform #1

stemey opened this issue Nov 1, 2014 · 1 comment

Comments

@stemey
Copy link

stemey commented Nov 1, 2014

I created a baucis extension that is similar to yours in that it relies on extra meta data. baucis-gform provides metadata to rapidly create an administration ui for mongoose data (and others).
In order to take advantage of your extension to hide/disable properties according to the current role, I need to discover the the access rule of a type/property for the current user. How do I do that?

Is there something like the following?

     var access = controller('vegetable').getCurrentAccess() // returns access for current user and type
     if (access.read==false) {
         // mongoose entities not visible to curent user.
     }
     controller('vegetable').getCurrentAccess('name') // returns access for current user and property
@hippich
Copy link
Owner

hippich commented Nov 3, 2014

I believe you should be able to do just that with something like:

var rules = controller.access().getCurrentRules(req)

and after rules will contain something like that depending on content of req:

{
  create: true,
  read: true,
  write: false,
  drop: false 
}

Is this is what you are looking for?

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

No branches or pull requests

2 participants