@laura-wert/vue-user-management
v3.0.2
Published
## Instalation
Downloads
12
Readme
User management
Instalation
make a plugin in your project
import client from 'src/domains/api/client'
import { addApiCallsToClient } from 'uw-vue-user-management'
export default ({router}) => {
addApiCallsToClient(client, router)
}
add the routes to you route file
import { userManagementRoutes } from 'uw-vue-user-management/src/routes'
export default [
{
path: '/auth',
component: () => import('layouts/Login'),
children: [
userManagementRoutes.login,
userManagementRoutes.register,
],
},
]
import the store modules
import { userManagementStorePlugins } from 'uw-vue-user-management'
Vue.use(Vuex)
Vue.use(VueXhrState)
const xhrPlugins = [...userManagementStorePlugins]
...
add the extra vee-validate dictionairy
import VeeValidate, { Validator } from 'vee-validate'
import { userManagementNl } from 'uw-vue-user-management'
export default ({Vue}) => {
Validator.localize('nl', userManagementNl)
Vue.use(VeeValidate, {
locale: 'nl',
})
}
vue-browser-acl add the isAuthenticated and getCurrentUser
import VueAcl from 'vue-browser-acl'
import Acl from 'browser-acl'
import { isAutenticated, getCurrentUser } from 'uw-vue-user-management'
import setPolicies from 'src/domains/acl/policies'
export default async ({Vue, store, router}) => {
const myAcl = new Acl()
setPolicies(myAcl)
const userResolver = () => {
if (!isAutenticated()) {
return null
}
return store.getters[getCurrentUser]
}
Vue.use(
VueAcl,
userResolver,
myAcl,
{
caseMode: false,
strict: true,
router,
},
)
}
See Cr-Portal for implementation examples with the ACL in src/domains/acl
Todo
permissions should be moved to external packages