/// <summary> /// 允许某个用户操作某个资源 /// </summary> /// <param name="resource"></param> /// <param name="action"></param> /// <param name="userId"></param> /// <param name="role"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task <CommonMessage> Allow( string resource, string action, string userId = null, string role = null, CancellationToken cancellationToken = default) { var param = new AllowParam() { Resource = resource, Action = action, UserId = userId, RoleCode = role, }; await client.GetAccessToken(); var res = await client.Request <AllowResponse>(param.CreateRequest(), cancellationToken); return(res.Result); }
/// <summary> /// 获取用户列表 /// </summary> /// <param name="page">当前页数,默认为 1</param> /// <param name="limit">每页最大数量,默认为 10</param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task <PaginatedUsers> List( int page = 1, int limit = 10, CancellationToken cancellationToken = default) { var param = new UsersParam() { Page = page, Limit = limit, }; await client.GetAccessToken(); var res = await client.Request <UsersResponse>(param.CreateRequest(), cancellationToken); return(res.Result); }