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

Further info required on using 2 x instances #338

Closed
wrabit opened this issue Jun 9, 2020 · 7 comments
Closed

Further info required on using 2 x instances #338

wrabit opened this issue Jun 9, 2020 · 7 comments
Labels

Comments

@wrabit
Copy link

wrabit commented Jun 9, 2020

Hello, after some scouring I feel this plugin is almost what I need vs all the rest, but I am still missing some info in order to proceed.

image

My project has one entry, main.js but 2 areas ("dashboard" and "manager"), each with separate sets of permissions, so I don't want the various methods affecting permissions in both sides.

Where to go from here? What does ./services/ability look like? It's not a plugin file? I cannot see any sample of it in the docs or Medium walkthrough.

image

If this is where I will find out, this is a dead link.

@wrabit
Copy link
Author

wrabit commented Jun 9, 2020

In addition, is there a recommended way we can access $can for example from router?

import Vue from 'vue'

Vue.$can(..) ?

@stalniy
Copy link
Owner

stalniy commented Jun 9, 2020

Hello,

Check this example - https://github.com/stalniy/casl-examples/tree/master/packages/vue-todo

If the same user has access to both areas then I’d recommend to use single ability instance for the app. Anyway you have different entities in both areas (I guess).

Thanks for the note about dead link. I’ll check and fix today a bit later.

@stalniy
Copy link
Owner

stalniy commented Jun 9, 2020

In addition, is there a recommended way we can access $can for example from router?

import Vue from 'vue'

Vue.$can(..) ?

Use ability instance directly. You don’t need reactivity in the router. Check this comment as well https://medium.com/@sergiy.stotskiy/so-there-are-several-approaches-3ee962fb9fb5

update: alternatively define router lifecycle hook in component

@wrabit
Copy link
Author

wrabit commented Jun 9, 2020

If the same user has access to both areas then I’d recommend to use single ability instance for the app.

Yeah the same user cannot access either side.

@Olena-Stotska
Copy link
Collaborator

@wrabit read the docs on CASL's website. For vue - https://stalniy.github.io/casl/v4/en/package/casl-vue , all links there works as expected

@Olena-Stotska
Copy link
Collaborator

the links are fixed.

Thanks for the issue. Close as there is nothing to from CASL side

@wrabit
Copy link
Author

wrabit commented Jun 9, 2020

Thanks @Olena-Stotska, I never knew those docs existed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants