首页 > 其他 > 详细

ngAalin中Acl 实现 字符串型权限点

时间:2020-02-05 16:33:07      阅读:298      评论:0      收藏:0      [点我收藏+]

介绍:https://ng-alain.com/acl/control/zh

 

1. 在src/app/delon.module.ts 文件中 增加或修改 fnDelonACLConfig() 函数

export function fnDelonACLConfig(): DelonACLConfig {
return {
...new DelonACLConfig(),
...{
preCan: (roleOrAbility: ACLCanType) => {
const str = roleOrAbility+"";
return str.startsWith(‘ability.‘) ? { ability: [str] } : null;
}
} as DelonACLConfig
};
}

2 在const GLOBAL_CONFIG_PROVIDES中追加

{ provide: DelonACLConfig, useFactory: fnDelonACLConfig },

 

3。在页面使用如:<button acl="ability.user.edit">edit</button>

4. startup.service.ts 中测试加一入条 this.aclService.data.abilities.push("ability.user.edit");

完成

 

ngAalin中Acl 实现 字符串型权限点

原文:https://www.cnblogs.com/tiandidao/p/12263902.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!