用户中心服务客户端

class arkid_client.ucenter.UcenterClient(base_url, authorizer=None, **kwargs)[源代码]

基类:arkid_client.base.BaseClient

用户中心管理客户端, 用于与 ArkID 服务端用户中心管理相关接口的访问操作。

Methods

view_perm()[源代码]

获取用户权限,只返回用户拥有的权限(只读) (GET /siteapi/v1/ucenter/perm/)

Examples

>>> uc = arkid_client.UsercenterClient(...)
>>> perm = uc.query_perm()
>>> print('perm is', perm)
view_profile()[源代码]

获取用户自身信息 (GET /siteapi/v1/ucenter/profile/)

Examples

>>> uc = arkid_client.UsercenterClient(...)
>>> perm = uc.query_profile()
>>> print('perm is', perm)
view_current_org()[源代码]

获取用户当前所在组织的信息 (GET /siteapi/v1/ucenter/org/)

Examples

>>> oc = arkid_client.UsercenterClient(...)
>>> org = oc.get_current_org()
>>> print('org: ', org)
switch_current_org(json_body: dict)[源代码]

切换用户当前所在的组织 (PUT /siteapi/v1/ucenter/org/)

Parameters:

json_body (dict)

oid (str)
组织的唯一标识

Examples

>>> oc = arkid_client.UsercenterClient(...)
>>> org = oc.switch_current_org({'oid': 'example'})
>>> print('org: ', org)
query_apps(**params)[源代码]

普通用户获取可见应用列表 (GET /siteapi/v1/ucenter/apps/)

Parameters:

name (str)
应用名称

Examples

>>> oc = arkid_client.UsercenterClient(...)
>>> apps = oc.query_apps()
>>> print('apps: ', apps)