DDClient_Role.java 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package com.malk.service.dingtalk;
  2. import java.util.Collection;
  3. import java.util.List;
  4. import java.util.Map;
  5. /**
  6. * 钉钉应用 + 角色管理
  7. * <p>
  8. * Phase 1:getMicroAppVisibleScopes + roleGroupCreate(数据落库 + 全局角色组)
  9. * Phase 2:roleCreate + roleAddUsers + roleDeleteUsers(每应用一角色 + 全量绑人员)
  10. *
  11. * @apiNote https://open.dingtalk.com/document/orgapp/contacts-overview
  12. */
  13. public interface DDClient_Role {
  14. /**
  15. * 获取微应用可见范围
  16. *
  17. * @return Map { deptVisibleScopes: List<Long>, userVisibleScopes: List<String>, isHidden: Boolean }
  18. * @apiNote https://open.dingtalk.com/document/orgapp/queries-the-visible-range-of-a-microapp
  19. */
  20. Map getMicroAppVisibleScopes(String access_token, long agentId);
  21. /**
  22. * 创建角色组
  23. *
  24. * @return groupId(字符串形式)
  25. * @apiNote https://open.dingtalk.com/document/development/add-a-role-group
  26. */
  27. String roleGroupCreate(String access_token, String name);
  28. /**
  29. * 创建角色
  30. *
  31. * @return roleId(字符串形式)
  32. * @apiNote https://open.dingtalk.com/document/development/add-roles
  33. */
  34. String roleCreate(String access_token, String roleName, String groupId);
  35. /**
  36. * 批量增加员工角色(单批最多 100 用户;impl 内部自动分批)
  37. *
  38. * @apiNote https://open.dingtalk.com/document/development/add-role-information-to-employees-in-batches
  39. */
  40. void roleAddUsers(String access_token, String roleId, Collection<String> userIds);
  41. /**
  42. * 批量删除员工角色(单批最多 100 用户;impl 内部自动分批)
  43. *
  44. * @apiNote https://open.dingtalk.com/document/development/delete-the-color-information-of-employee-corners-in-batches
  45. */
  46. void roleDeleteUsers(String access_token, String roleId, Collection<String> userIds);
  47. /**
  48. * 更新角色名
  49. *
  50. * @apiNote https://open.dingtalk.com/document/development/update-role-information
  51. */
  52. void roleUpdate(String access_token, String roleId, String roleName);
  53. /**
  54. * 设置应用可见范围(支持 dept/user/role 三种维度 add/del)
  55. * <p>
  56. * 钉钉单次 delUserIds 上限约 50,业务方需自行分批
  57. *
  58. * @apiNote https://open.dingtalk.com/document/development/update-the-visible-range-of-micro-applications
  59. */
  60. void setMicroAppVisibleScopes(String access_token, long agentId,
  61. List<Long> addDeptIds, List<String> addUserIds, List<String> addRoleIds,
  62. List<Long> delDeptIds, List<String> delUserIds, List<String> delRoleIds);
  63. /**
  64. * 获取企业自建应用列表(返回 [ {agentId, appKey, name}, ... ])
  65. *
  66. * @apiNote https://open.dingtalk.com/document/development/obtain-the-list-of-internal-h5-applications-created-by-the
  67. */
  68. List<Map> listMicroApp(String access_token);
  69. }