查询角色列表

使用场景:学校或教育局查询角色列表

权限说明

权限项 说明 备注
应用是否需要申请白名单 不需要
用户凭证 支持
机构凭证 支持 -

请求方式: GET(HTTPS

请求地址:https://jz.hasmartedu.com/oapi/auth/role/list

请求参数:

参数 类型 必填 说明
access_token string 接口调用凭证
appid string 应用id,默认:登录态的appid

返回参数:

参数 类型 说明
errcode 返回码,0为正常
errmsg 对返回码的文本描述内容
data_list 角色列表
data_list.app_role_id string 角色id
data_list.name string 角色名称
data_list.is_system_role bool 是否系统角色
data_list.corpid string 机构id
data_list.app_id string 创建应用 空为系统创建
data_list.restrict_condition int32 用户关联模型 0 自由添加 1 只允许关联人员 2 不允许自由添加
data_list.role_key string 系统权限唯一标识
data_list.remark string 角色介绍

请求示例:

GET https://jz.hasmartedu.com/oapi/auth/role/list?access_token=ACCESS_TOKEN&appid=50000

返回结果:

{
    "errmsg": "ok",
    "errcode": 0,
    "data_list": [
        {
            "app_role_id": "1",
            "name": "创建者",
            "is_system_role": true,
            "corpid": "1",
            "appid": "",
            "restrict_condition": 0,
            "role_key": "Creator",
            "remark": ""
        },
        {
            "app_role_id": "66869",
            "name": "测试角色333",
            "is_system_role": false,
            "corpid": "1009697",
            "appid": "50000",
            "restrict_condition": 0,
            "role_key": "",
            "remark": ""
        }
    ]
}

添加角色

权限说明

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持
机构凭证 支持 -

请求方式: POST(HTTPS

请求地址:https://jz.hasmartedu.com/oapi/auth/role/create

请求参数:

参数 必须 类型 说明
access_token string 接口调用凭证
name string 名称
remark string 描述
restrict_condition uint32 限制属性 0:自由添加 1:只允许用户添加 2:不允许自定义添加
sort uint32 排序权重 值越小在前面
status uint32 角色状态 0 有效 1 无效
appid string 应用在系统的唯一id 默认:使用登录态的appid

返回参数:

参数 类型 说明
app_role_id string 角色id
errcode uint32 返回码,0为正常
errmsg string 对返回码的文本描述内容

请求示例:

POST https://jz.hasmartedu.com/oapi/auth/role/create?access_token=ACCESS_TOKEN

请求示例:

{
  "name": "xxxx",
  "corpid": "xxxx",
  "remark": "xxxx",
  "restrict_condition": 1,
  "sort": 1,
  "status": 0,
  "appid": "xxxx"
}

返回结果:

{
  "app_role_id": "",
  "errcode": 0,
  "errmsg": "ok"
}

修改角色

权限说明

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持
机构凭证 支持 -

请求方式: POST(HTTPS

请求地址:https://jz.hasmartedu.com/oapi/auth/role/update

请求参数:

参数 必须 类型 说明
access_token string 接口调用凭证
app_role_id string 角色id
name string 名称
remark string 描述

返回参数:

参数 类型 说明
errcode uint32 返回码,0为正常
errmsg string 对返回码的文本描述内容

请求示例:

POST https://jz.hasmartedu.com/oapi/auth/role/update?access_token=ACCESS_TOKEN

请求示例:

{
  "app_role_id": "xxxx",
  "name": "xxxx",
  "remark": "xxxx"
}

返回结果:

{
  "errcode": 0,
  "errmsg": "ok"
}

删除角色

权限说明

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持
机构凭证 支持 -

请求方式: POST(HTTPS

请求地址:https://jz.hasmartedu.com/oapi/auth/role/delete

请求参数:

参数 必须 类型 说明
access_token string 接口调用凭证
app_role_id string 角色id

返回参数:

参数 类型 说明
errcode uint32 返回码,0为正常
errmsg string 对返回码的文本描述内容

请求示例:

POST https://jz.hasmartedu.com/oapi/auth/role/delete?access_token=ACCESS_TOKEN

请求示例:

{
  "app_role_id": "xxxx"
}

返回结果:

{
  "errcode": 0,
  "errmsg": "ok"
}

设置用户角色

权限说明

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持 需要机构的超级管理员
机构凭证 支持 -

请求方式: POST(HTTPS

请求地址:: https://jz.hasmartedu.com/oapi/auth/role/set_user

请求参数:

参数 必须 类型 说明
access_token string 调用接口凭证
user_roles 列表 用户的权限列表
user_roles.userid string 用户id
user_roles.corpid string 机构id,空表示当前机构
user_roles.attach_app_role_ids uint32列表 添加的角色id列表
user_roles.detach_app_role_ids uint32列表 删除的角色id列表

返回参数:

参数 说明
errcode 返回码,0为正常
errmsg 对返回码的文本描述内容

请求方法: POST

POST https://jz.hasmartedu.com/oapi/auth/role/set_user?access_token=ACCESS_TOKEN

请求示例:

{
  "user_roles": [
    {
      "userid": "xxxx",
      "corpid": "xxxx",
      "attach_app_role_ids": [2],
      "detach_app_role_ids": [1]
    }
  ]
}

返回结果:

{
  "errcode": 0,
  "errmsg": "ok"
}

用户关联角色

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持 需要机构的超级管理员
机构凭证 支持 -

请求方法: POST

请求地址: https://jz.hasmartedu.com/oapi/auth/role/attach_user

请求参数:

参数 必须 类型 说明
access_token string 调用接口凭证
app_role_id string 角色id
userids string数组 用户列表

返回参数:

参数 说明
errcode false uint32 返回码,0为正常
errmsg false string 对返回码的文本描述内容

请求方法: POST

POST https://jz.hasmartedu.com/oapi/auth/role/set_user?attach_user=ACCESS_TOKEN

请求示例:

{
  "app_role_id" :"3",
  "userids": ["100001","100002"]
}

返回结果:

{
  "errcode": 0,
  "errmsg": "ok"
}

用户取消关联角色

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持 需要机构的超级管理员
机构凭证 支持 -

请求方法: POST

请求地址: https://jz.hasmartedu.com/oapi/auth/role/detach_user

请求参数:

参数 必须 类型 说明
access_token string 调用接口凭证
app_role_id string 角色id
userids string数组 用户列表

返回参数:

参数 类型 说明
errcode uint32 返回码,0为正常
errmsg string 对返回码的文本描述内容

请求方法: POST

POST https://jz.hasmartedu.com/oapi/auth/role/set_user?detach_user=ACCESS_TOKEN

请求示例:

{
  "app_role_id" :"3",
  "userids": ["100001","100002"]
}

返回结果:

{
  "errcode": 0,
  "errmsg": "ok"
}

获取角色的用户列表

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持 需要机构的超级管理员
机构凭证 支持 -

请求方法: GET

请求地址: https://jz.hasmartedu.com/oapi/auth/role/users

请求参数:

参数 必须 类型 说明
access_token string 调用接口凭证,使用用户态access_token
app_role_id string 角色id
page_index uint32 页码 从1 开始
page_size uint32 页大小 默认 20
keyword string 搜索关键字

返回参数:

参数 类型 说明
errcode uint32 返回码,0为正常
errmsg string 对返回码的文本描述内容
total uint32 人员总数
user_list 用户列表
user_list.userid string 用户id
user_list.name string 用户名称
user_list.mobile string 用户手机号码
user_list.user_number string 职工号
user_list.corpid string 机构id

请求方法: GET

GET https://jz.hasmartedu.com/oapi/auth/role/users?access_token=ACCESS_TOKEN&app_role_id=3

返回结果:

{
  "total": 1,
  "user_list": [
    {
      "userid": "",
      "name": "",
      "mobile": "",
      "user_number": "",
      "corpid": ""
    }
  ],
  "errcode": 0,
  "errmsg": "ok"
}

获取用户的角色列表

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持 需要机构的超级管理员
机构凭证 支持 -

请求方法: GET

请求地址: https://jz.hasmartedu.com/oapi/auth/user/roles

请求参数:

参数 必须 类型 说明
access_token string 调用接口凭证,使用用户态access_token
userid string 用户id
appid string 应用id,空则拉取所有应用的

返回参数:

参数 类型 说明
errcode uint32 返回码,0为正常
errmsg string 对返回码的文本描述内容
data_list 数据列表
data_list.app_role_id string 权限id
data_list.name string 权限名称
data_list.is_system_role bool 是否系统权限
data_list.remark string 权限简介
data_list.role_key string 系统权限唯一标识
data_list.appid string 应用id
data_list.app_name string 应用名称
data_list.app_icon string 应用icon

请求方法: GET

GET https://jz.hasmartedu.com/oapi/auth/role/users?access_token=ACCESS_TOKEN&userid=10001

返回结果:

{
  "data_list": [
    {
      "app_role_id": "",
      "name": "",
      "is_system_role": false,
      "remark": "",
      "role_key": "",
      "appid": "",
      "app_name": "",
      "app_icon": ""
    }
  ],
  "errcode": 0,
  "errmsg": "ok"
}
© 1998 - 2021 Tencent Inc. All Rights Reserved all right reserved,powered by ePaaS.更新时间: 2025-01-09 17:17:38

results matching ""

    No results matching ""

    results matching ""

      No results matching ""