]> git.proxmox.com Git - proxmox-backup.git/blob - src/api2/access/domain.rs
f899e59f2965d44f23afedb65c47e71beef67c8e
[proxmox-backup.git] / src / api2 / access / domain.rs
1 use failure::*;
2
3 use serde_json::{json, Value};
4
5 use proxmox::api::{api, Permission};
6 use proxmox::api::router::Router;
7
8 use crate::api2::types::*;
9
10 #[api(
11 returns: {
12 description: "List of realms.",
13 type: Array,
14 items: {
15 type: Object,
16 description: "User configuration (without password).",
17 properties: {
18 realm: {
19 description: "Realm ID.",
20 type: String,
21 },
22 comment: {
23 schema: SINGLE_LINE_COMMENT_SCHEMA,
24 optional: true,
25 },
26 default: {
27 description: "Default realm.",
28 type: bool,
29 }
30 },
31 }
32 },
33 access: {
34 description: "Anyone can access this, because we need that list for the login box (before the user is authenticated).",
35 permission: &Permission::World,
36 }
37 )]
38 /// Authentication domain/realm index.
39 fn list_domains() -> Result<Value, Error> {
40 let mut list = Vec::new();
41 list.push(json!({ "realm": "pam", "comment": "Linux PAM standard authentication", "default": true }));
42 list.push(json!({ "realm": "pbs", "comment": "Proxmox Backup authentication server" }));
43 Ok(list.into())
44 }
45
46 pub const ROUTER: Router = Router::new()
47 .get(&API_METHOD_LIST_DOMAINS);