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