Raritan PX2/PX3 JSON-RPC API
UserManager.idl
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright 2009 Raritan Inc. All rights reserved.
4  */
5 
6 #include <User.idl>
7 #include <UserEvent.idl>
8 
9 /**
10  * %User Management
11  */
12 module usermgmt {
13 
14  /** %Account information */
15  structure Account {
16  string name; ///< %Account name
17  UserInfo info; ///< %User information
18  };
19 
20  /* event definitions */
21  /**
22  * Base type of all account event
23  */
24  valueobject AccountEvent extends event.UserEvent {
25  string username; ///< id of user which was affected
26  };
27 
28  /**
29  * This event is emitted after a new account with the
30  * provided username was added
31  */
32  valueobject AccountAdded extends AccountEvent {};
33 
34  /**
35  * This event is emitted after the account with
36  * the provided username has been removed
37  */
38  valueobject AccountRemoved extends AccountEvent {};
39 
40  /**
41  * This event is emitted after the password for
42  * an account was changed
43  */
44  valueobject PasswordChanged extends AccountEvent {};
45 
46  /**
47  * This event is emitted if the settings of an account
48  * as defined in usermgmt.UserInfo have changed
49  * (Note: we may add an indication what in the structure
50  * has changed or even split the event, if handling is difficult)
51  */
52  valueobject AccountChanged extends AccountEvent {
53  usermgmt.UserInfo oldSettings;
54  usermgmt.UserInfo newSettings;
55  };
56 
57 
58  /** %User manager interface */
59  interface UserManager_1_0_4 {
60 
61  constant int ERR_USER_DOESNT_EXIST = 1; ///< A user with the given name does not exist
62  constant int ERR_USER_NOT_DELETABLE = 2; ///< The user is not deletable
63 
64  constant int ERR_USER_ALREADY_EXISTS = 1; ///< A user with the given name already exists
65  constant int ERR_MAX_USERS_REACHED = 2; ///< Maximum number of users reached
66  constant int ERR_PASSWORD_TOO_SHORT_FOR_SNMP = 3; ///< The password is too short to be used as SNMPv3 passphrase
67  constant int ERR_INVALID_VALUE = 4; ///< Invalid arguments
68  constant int ERR_PASSWORD_EMPTY = 5; ///< The password must not be empty
69  constant int ERR_PASSWORD_TOO_SHORT = 6; ///< The password is too short
70  constant int ERR_PASSWORD_TOO_LONG = 7; ///< The password is too long
71  constant int ERR_PASSWORD_CTRL_CHARS = 8; ///< The password must not contain control characters
72  constant int ERR_PASSWORD_NEED_LOWER = 9; ///< The password must contain at least one lower-case character
73  constant int ERR_PASSWORD_NEED_UPPER = 10; ///< The password must contain at least one upper-case character
74  constant int ERR_PASSWORD_NEED_NUMERIC = 11; ///< The password must contain at least one numeric character
75  constant int ERR_PASSWORD_NEED_SPECIAL = 12; ///< The password must contain at least one special character
76  constant int ERR_SSH_PUBKEY_DATA_TOO_LARGE = 14; ///< The ssh public key data is too large.
77  constant int ERR_SSH_PUBKEY_INVALID = 15; ///< The ssh public key is invalid.
78  constant int ERR_SSH_PUBKEY_NOT_SUPPORTED = 16; ///< The ssh public key is not supported.
79  constant int ERR_SSH_RSA_PUBKEY_TOO_SHORT = 17; ///< The ssh RSA public key is too short.
80  constant int ERR_USERNAME_INVALID = 18; ///< The user name contains one or more invalid character(s).
81 
82  /**
83  * Get a list of account names available on the system.
84  *
85  * @return List of account names
86  */
87  vector<string> getAccountNames();
88 
89  /**
90  * Create a new account.
91  *
92  * @param username New user name
93  * @param password New password
94  *
95  * @return 0 if OK
96  * @return 1 if a user with the given name already exists
97  * @return 2 if the maximum number of users is reached
98  * @return 3 SNMPv3 USM is activated for the user and the
99  * password shall be used as auth passphrase. For this
100  * case, the password is too short (must be at least 8
101  * characters).
102  * @return 5 The password must not be empty.
103  * @return 6 The password is too short.
104  * @return 7 The password is too long.
105  * @return 8 The password must not contain control characters.
106  * @return 9 The password has to contain at least one lower case
107  * character.
108  * @return 10 The password has to contain at least one upper case
109  * character.
110  * @return 11 The password has to contain at least one numeric
111  * character.
112  * @return 12 The password has to contain at least one printable
113  * special character.
114  * @return 18 if the user name is invalid.
115  */
116  int createAccount(in string username, in string password);
117 
118  /**
119  * Deletes an account.
120  *
121  * @param username Name of user to delete
122  *
123  * @return 0 if OK
124  * @return 1 if a user with the given name does not exist
125  * @return 2 if the user cannot be deleted
126  */
127  int deleteAccount(in string username);
128 
129  /**
130  * Get information about all available user accounts.
131  *
132  * @return List of accounts
133  */
134  vector<Account> getAllAccounts();
135 
136  /**
137  * Create a new account with defined settings.
138  *
139  * @param username New user name
140  * @param password New password
141  * @param info New user information
142  *
143  * @return 0 if OK
144  * @return 1 if a user with the given name already exists
145  * @return 2 if the maximum number of users is reached
146  * @return 3 SNMPv3 USM is activated for the user and the
147  * password shall be used as auth passphrase. For this
148  * case, the password is too short (must be at least 8
149  * characters).
150  * @return 4 if any value in the user info is invalid.
151  * @return 5 The password must not be empty.
152  * @return 6 The password is too short.
153  * @return 7 The password is too long.
154  * @return 8 The password must not contain control characters.
155  * @return 9 The password has to contain at least one lower case
156  * character.
157  * @return 10 The password has to contain at least one upper case
158  * character.
159  * @return 11 The password has to contain at least one numeric
160  * character.
161  * @return 12 The password has to contain at least one printable
162  * special character.
163  * @return 14 The ssh public key data is too large.
164  * @return 15 The ssh public key is invalid.
165  * @return 16 The ssh public key is not supported.
166  * @return 17 The ssh RSA public key is too short.
167  * @return 18 if the user name is invalid.
168  */
169  int createAccountFull(in string username, in string password,
170  in UserInfo info);
171 
172  /**
173  * Get a list of accounts that have a given role.
174  *
175  * @param roleName Role name
176  *
177  * @return List of accounts
178  */
179  vector<Account> getAccountsByRole(in string roleName);
180 
181  /**
182  * Get default user preferences.
183  *
184  * @return Default user preferences.
185  */
186  Preferences getDefaultPreferences();
187 
188  /**
189  * Set default user preferences.
190  *
191  * @param prefs Default user preferences.
192  *
193  * @return 0 if OK
194  */
195  int setDefaultPreferences(in Preferences prefs);
196  };
197 
198 }
User manager interface
Definition: UserManager.idl:59
UserInfo info
User information
Definition: UserManager.idl:17
valueobject AccountEvent
Base type of all account event.
Definition: UserManager.idl:25
User information
Definition: User.idl:63
User preferences
Definition: User.idl:56
valueobject PasswordChanged
This event is emitted after the password for an account was changed.
Definition: UserManager.idl:44
User Management
Definition: Role.idl:12
Account information
Definition: UserManager.idl:15
valueobject AccountRemoved
This event is emitted after the account with the provided username has been removed.
Definition: UserManager.idl:38
string name
Account name
Definition: UserManager.idl:16