A
A
Alexey Sklyarov2018-11-25 11:44:25
Vue.js
Alexey Sklyarov, 2018-11-25 11:44:25

How can getters and actions be restricted to user groups in Vue?

The laravel+vue project uses websanova/vue-auth JWT authorization . After authorization, information about the user is stored in the storage. It contains the role field, which has two values: admin or member. In some Vue components, I only get information if role == admin. Due to the lack of understanding of the storage operation, the question arises, if I have a getter to get a list of invites, how to properly protect it from access by a regular user? In the body of the getter, just write a check about the compliance of the role? Or are there better options

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nvdfxx, 2018-11-25
@0example

Maybe it's better to load the list of invites by api if role==admin, otherwise leave it null? Why download it always, and then worry about security?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question