2 use serde_json
::{json, Value}
;
4 use proxmox
::api
::{api, Router, RpcEnvironment, Permission}
;
7 use crate::config
::acl
::PRIV_SYS_AUDIT
;
8 use crate::config
::cached_user_info
::CachedUserInfo
;
9 use crate::api2
::types
::{NODE_SCHEMA, Userid}
;
20 description
: "Subscription status.",
24 description
: "'NotFound', 'active' or 'inactive'."
28 description
: "Human readable problem description.",
32 description
: "The unique server ID, if permitted to access.",
36 description
: "URL to Web Shop.",
41 permission
: &Permission
::Anybody
,
44 /// Read subscription info.
47 rpcenv
: &mut dyn RpcEnvironment
,
48 ) -> Result
<Value
, Error
> {
49 let userid
: Userid
= rpcenv
.get_user().unwrap().parse()?
;
50 let user_info
= CachedUserInfo
::new()?
;
51 let user_privs
= user_info
.lookup_privs(&userid
, &[]);
52 let server_id
= if (user_privs
& PRIV_SYS_AUDIT
) != 0 {
53 tools
::get_hardware_address()?
58 let url
= "https://www.proxmox.com/en/proxmox-backup-server/pricing";
61 "message": "There is no subscription key",
62 "serverid": server_id
,
67 pub const ROUTER
: Router
= Router
::new()
68 .get(&API_METHOD_GET_SUBSCRIPTION
);