我有一个nuxt应用程序,用户可以在其中创建自定义角色。例如CustomRoleA,CustomRoleB等。是否可以使用vue-kindergarten处理此问题。有没有办法动态生成周长?
这是我到目前为止所拥有的。如您所见,我只能使用预定义的角色
import { Perimeter } from 'vue-kindergarten'
export default class BasePerimeter extends Perimeter {
isSuperAdmin () {
return this.child === 'SuperAdministrator'
}
isPartyAdmin () {
return this.child === 'PartyAdministrator'
}
isTeamAdmin () {
return this.child === 'TeamAdministrator'
}
isPartyUser () {
return this.child === 'PartyUser'
}
}
示例外围类别
import BasePerimeter from './base'
export default new BasePerimeter({
purpose: 'user',
can: {
read: () => true,
add () {
return this.isSuperAdmin() || this.isPartyAdmin() || this.isTeamAdmin()
},
update () {
return this.isSuperAdmin() || this.isPartyAdmin() || this.isTeamAdmin()
},
allowDelete () {
return this.isSuperAdmin() || this.isPartyAdmin() || this.isTeamAdmin()
},
changePassword () {
return this.isSuperAdmin() || this.isPartyAdmin() || this.isTeamAdmin()
}
}
})