Pentaho RestAPI用户&角色管理

来源:https://help.pentaho.com/Documentation/8.3/Developer_center/REST_API_Reference/User_Role_Management/0O0以下介绍的Rest API用以PBA的安全用户&角色的管理:创建、删除用户角色给用户分配角色获得某角色下的用户列表给角色赋予权限修改用户密码Pentaho Rest API的通用格式为:[server path]/[rest path]/[query parameter
摘要由CSDN通过智能技术生成

来源:https://help.pentaho.com/Documentation/8.3/Developer_center/REST_API_Reference/User_Role_Management/0O0


以下介绍的Rest API用以PBA的安全用户&角色的管理:

  • 创建、删除用户角色
  • 给用户分配角色
  • 获得某角色下的用户列表
  • 给角色赋予权限
  • 修改用户密码

Pentaho Rest API的通用格式为:

[server path]/[rest path]/[query parameter]

调用API需进行pentaho认证,参考教程。本篇示例均以Basic Auth的认证方式实现。

1. Users

本章节列的Rest API与Pentaho用户有关。

1.1 创建用户

创建一个用户包括创建用户名和密码。此请求封装在具有用户名和密码值的user对象中,请注意创建用户不包括为其分配角色,若要分配角色需要建立另外的请求。
⚠️ 终端用户必须有管理权限才可以执行。

支持方法

Http Verb Example Request
PUT PUT /pentaho/api/userroledao/createUser

参数

Name Description Type
user 用于传递userName和password的对象 query

Request Body

user对象传递userName&password的示例如下:

{
    "userName":"cloud",
    "password":"zijin.Cloud"
}
Element Media Types
user */*
application/xml
application/octet-stream

Response Body

Response Body包含操作状态码

Element Media Types
(custom) */*
application/xml
application/octet-stream

状态码

Code Description
200* Successfully created new user(实际上是204,无返回内容)
400 Provided data has invalid format.
401 未认证
403 Only users with administrative privileges can access this method.
412 Unable to create user.

请求指令

curl   -d '{"userName":"viviran","password":"password"}' -H'Authorization:Basic YWRtaW46cGFzc3dvcmQ=' -H 'Content-Type:application/json' -X PUT http://localhost:8080/pentaho/api/userroledao/createUser

创建viviran的用户

1.2 删除用户

使用一个query parameter实现用户列表的删除,若要批量删除用户,userName以tab(\t)分隔.
⚠️ 终端用户必须有管理权限才可以执行。

支持方法

HTTP Verb Example Request
PUT PUT pentaho/api/userroledao/deleteUsers?userNames=user1%09user2%09

参数

Name Description Type
userName 用户名列表以tab (\t)分隔 query

Request Body

Response Body

Response Body包含操作状态码

Element Media Types
(custom) */*
application/xml
application/octet-stream

状态码

Code Description
200* Successfully created new user(实际上是204,无返回内容)
401 未认证
403 Only users with administrative privileges can access this method.
500 Internal server error prevented the system from properly retrieving either the user or roles.

1.3 修改用户密码

修改信息封装在ChangeUserPassword对象:userName, newPassword, oldPassword.

支持方法

HTTP Verb Example Request
PUT PUT pentaho/api/userroledao/user

参数

Name Description Type
ChangePasswordUser 封装了需要修改的用户的用户名、旧密码、新密码字段 query

Request Body

ChangePasswordUser对象传递的示例如下:

{
    "userName":"cloud",
    "newPassword":"cloud.Zijin",
    "oldPassword":"zijin.Cloud"
}

Response Body

Response Body包含操作状态码

Element Media Types
(custom) */*
application/xml
application/octet-stream

状态码

Code Description
200* Successfully created new user(实际上是204,无返回内容)
400 Provided data has invalid format.
401 未认证
403 Only users with administrative privileges can access this method.
412 Unable to create

1.4 获得用户列表

返回Pentaho资源库中的用户列表。

支持方法

HTTP Verb Example Request
GET GET pentaho/api/userroledao/users

参数

Request Body

Response Body

返回平台的用户列表。

Element Media Types
userList application/xml
application/json

示例:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<userList>
    <users>suzy</users>
    <users>pat</users>
    <users>tiffany</users>
    <users>admin</users>
    <users>vivi</users>
    <users>swran001</users>
    <users>Shipped</users>
</userList>

状态码

Code Description
200 Successfully returned the list of users.
500 An error occurred in the platform while trying to access the list of users.

1.5 获取用户的角色

获得某一个用户的所有角色。

支持方法

HTTP Verb Example Request
GET GET pentaho/api/userroledao/userRoles?userName=suzy

参数

Name Description Type
userName 需要获得角色的用户 query

Request Body

Response Body

返回平台的用户的角色。

Element Media Types
roleList application/xml
application/json

示例࿱

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Jarvis数据之路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值