天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

 找回密码
 注册成为天翎用户
查看: 941|回复: 0

[常见问题] 如何判断该用户在部分下有什么角色权限?

[复制链接]
admin 发表于 2021-1-7 19:46:45 | 显示全部楼层 |阅读模式
【myApps/OBPM版本号】:4.4stable sp21
【浏览器类型】:Chrome
【技术交流Q群】:182378297
【场景】:如何判断该用户在部分下有什么角色权限?
* roleCode:角色编号   department:部门id
*userId:用户ID

  1. function isTheUserOwenTheDeptRolesByCode(userId, roleCode, department) {
  2.     var doc = getCurrentDocument();
  3.     var flag = false;
  4.     var process = new Packages.cn.myapps.designtime.role.service.RoleServiceImpl();
  5.     var role = process.findByRoleNo(roleCode, doc.getApplicationid());
  6.     var roleId = role.getId();
  7.     var sql = "select  '" + getDomainid() + "'AS DOMAINID , userid as item_userid from " + DATASOURENAME + ".t_user_department_role_set where departmentid='" + department + "' and roleid='" + roleId + "' and userid='" + userId + "' ";
  8.     var count = countBySQL(sql);
  9.     if (count > 0) {
  10.         flag = true;
  11.     }
  12.     return flag;
  13. };
复制代码

本版积分规则

QQ|手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-12 05:45

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表