3 use serde_json
::{json, Value}
;
5 use proxmox
::api
::{api, Permission}
;
6 use proxmox
::api
::router
::Router
;
8 use crate::api2
::types
::*;
9 use crate::config
::acl
::ROLE_NAMES
;
13 description
: "List of roles.",
17 description
: "User name with description.",
20 schema
: ACL_ROLE_SCHEMA
,
23 schema
: SINGLE_LINE_COMMENT_SCHEMA
,
30 permission
: &Permission
::Anybody
,
34 fn list_roles() -> Result
<Value
, Error
> {
35 let mut list
= Vec
::new();
37 for (role
, comment
) in ROLE_NAMES
.iter() {
38 list
.push(json
!({ "role": role, "comment": comment }
));
43 pub const ROUTER
: Router
= Router
::new()
44 .get(&API_METHOD_LIST_ROLES
);