@laura-wert/vue-user-management

## Instalation

Stats

StarsIssuesVersionUpdatedCreatedSize
@laura-wert/vue-user-management
3.0.2a year ago3 years agoMinified + gzip package size for @laura-wert/vue-user-management in KB

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

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.