1 | import { Cluster } from './cluster';
|
2 | import { NodeCallback } from './utilities';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export declare class Origin {
|
9 | |
10 |
|
11 |
|
12 | type: string;
|
13 | |
14 |
|
15 |
|
16 | name: string;
|
17 | |
18 |
|
19 |
|
20 | constructor(data: Origin);
|
21 | /**
|
22 | * @internal
|
23 | */
|
24 | static _fromNsData(data: any): Origin;
|
25 | }
|
26 | /**
|
27 | * Contains information about a role.
|
28 | *
|
29 | * @category Management
|
30 | */
|
31 | export declare class Role {
|
32 | |
33 |
|
34 |
|
35 | name: string;
|
36 | |
37 |
|
38 |
|
39 | bucket: string | undefined;
|
40 | |
41 |
|
42 |
|
43 | scope: string | undefined;
|
44 | |
45 |
|
46 |
|
47 | collection: string | undefined;
|
48 | |
49 |
|
50 |
|
51 | constructor(data: Role);
|
52 | /**
|
53 | * @internal
|
54 | */
|
55 | static _fromNsData(data: any): Role;
|
56 | /**
|
57 | * @internal
|
58 | */
|
59 | static _toNsStr(role: string | Role): string;
|
60 | }
|
61 | /**
|
62 | * Contains information about a role along with its description.
|
63 | *
|
64 | * @category Management
|
65 | */
|
66 | export declare class RoleAndDescription extends Role {
|
67 | |
68 |
|
69 |
|
70 | displayName: string;
|
71 | |
72 |
|
73 |
|
74 | description: string;
|
75 | |
76 |
|
77 |
|
78 | constructor(data: RoleAndDescription);
|
79 | /**
|
80 | * @internal
|
81 | */
|
82 | static _fromNsData(data: any): RoleAndDescription;
|
83 | }
|
84 | /**
|
85 | * Contains information about a role along with its origin.
|
86 | *
|
87 | * @category Management
|
88 | */
|
89 | export declare class RoleAndOrigin extends Role {
|
90 | |
91 |
|
92 |
|
93 | origins: Origin[];
|
94 | |
95 |
|
96 |
|
97 | constructor(data: RoleAndOrigin);
|
98 | /**
|
99 | * @internal
|
100 | */
|
101 | static _fromNsData(data: any): RoleAndOrigin;
|
102 | }
|
103 | /**
|
104 | * Specifies information about a user.
|
105 | *
|
106 | * @category Management
|
107 | */
|
108 | export interface IUser {
|
109 | |
110 |
|
111 |
|
112 | username: string;
|
113 | |
114 |
|
115 |
|
116 | displayName?: string;
|
117 | |
118 |
|
119 |
|
120 | groups?: string[];
|
121 | |
122 |
|
123 |
|
124 | roles?: (Role | string)[];
|
125 | |
126 |
|
127 |
|
128 | password?: string;
|
129 | }
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | export declare class User implements IUser {
|
136 | |
137 |
|
138 |
|
139 | username: string;
|
140 | |
141 |
|
142 |
|
143 | displayName: string;
|
144 | |
145 |
|
146 |
|
147 | groups: string[];
|
148 | |
149 |
|
150 |
|
151 | roles: Role[];
|
152 | |
153 |
|
154 |
|
155 | password: undefined;
|
156 | |
157 |
|
158 |
|
159 | constructor(data: User);
|
160 | /**
|
161 | * @internal
|
162 | */
|
163 | static _fromNsData(data: any): User;
|
164 | /**
|
165 | * @internal
|
166 | */
|
167 | static _toNsData(user: IUser): any;
|
168 | }
|
169 | /**
|
170 | * Contains information about a user along with some additional meta-data
|
171 | * about that user.
|
172 | *
|
173 | * @category Management
|
174 | */
|
175 | export declare class UserAndMetadata extends User {
|
176 | |
177 |
|
178 |
|
179 | domain: string;
|
180 | |
181 |
|
182 |
|
183 | effectiveRoles: RoleAndOrigin[];
|
184 | |
185 |
|
186 |
|
187 | passwordChanged: Date;
|
188 | |
189 |
|
190 |
|
191 | externalGroups: string[];
|
192 | |
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 | get effectiveRolesAndOrigins(): RoleAndOrigin[];
|
199 | |
200 |
|
201 |
|
202 | constructor(data: UserAndMetadata);
|
203 | /**
|
204 | * @internal
|
205 | */
|
206 | static _fromNsData(data: any): UserAndMetadata;
|
207 | }
|
208 | /**
|
209 | * Specifies information about a group.
|
210 | *
|
211 | * @category Management
|
212 | */
|
213 | export interface IGroup {
|
214 | |
215 |
|
216 |
|
217 | name: string;
|
218 | |
219 |
|
220 |
|
221 | description?: string;
|
222 | |
223 |
|
224 |
|
225 | roles?: (Role | string)[];
|
226 | |
227 |
|
228 |
|
229 | ldapGroupReference?: string;
|
230 | }
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 | export declare class Group {
|
237 | |
238 |
|
239 |
|
240 | name: string;
|
241 | |
242 |
|
243 |
|
244 | description: string;
|
245 | |
246 |
|
247 |
|
248 | roles: Role[];
|
249 | |
250 |
|
251 |
|
252 | ldapGroupReference: string | undefined;
|
253 | |
254 |
|
255 |
|
256 | constructor(data: Group);
|
257 | /**
|
258 | * @internal
|
259 | */
|
260 | static _fromNsData(data: any): Group;
|
261 | /**
|
262 | * @internal
|
263 | */
|
264 | static _toNsData(group: IGroup): any;
|
265 | }
|
266 | /**
|
267 | * @category Management
|
268 | */
|
269 | export interface GetUserOptions {
|
270 | |
271 |
|
272 |
|
273 | domainName?: string;
|
274 | |
275 |
|
276 |
|
277 | timeout?: number;
|
278 | }
|
279 |
|
280 |
|
281 |
|
282 | export interface GetAllUsersOptions {
|
283 | |
284 |
|
285 |
|
286 | domainName?: string;
|
287 | |
288 |
|
289 |
|
290 | timeout?: number;
|
291 | }
|
292 |
|
293 |
|
294 |
|
295 | export interface UpsertUserOptions {
|
296 | |
297 |
|
298 |
|
299 | domainName?: string;
|
300 | |
301 |
|
302 |
|
303 | timeout?: number;
|
304 | }
|
305 |
|
306 |
|
307 |
|
308 | export interface ChangePasswordOptions {
|
309 | |
310 |
|
311 |
|
312 | timeout?: number;
|
313 | }
|
314 |
|
315 |
|
316 |
|
317 | export interface DropUserOptions {
|
318 | |
319 |
|
320 |
|
321 | domainName?: string;
|
322 | |
323 |
|
324 |
|
325 | timeout?: number;
|
326 | }
|
327 |
|
328 |
|
329 |
|
330 | export interface GetRolesOptions {
|
331 | |
332 |
|
333 |
|
334 | timeout?: number;
|
335 | }
|
336 |
|
337 |
|
338 |
|
339 | export interface GetGroupOptions {
|
340 | |
341 |
|
342 |
|
343 | timeout?: number;
|
344 | }
|
345 |
|
346 |
|
347 |
|
348 | export interface GetAllGroupsOptions {
|
349 | |
350 |
|
351 |
|
352 | timeout?: number;
|
353 | }
|
354 |
|
355 |
|
356 |
|
357 | export interface UpsertGroupOptions {
|
358 | |
359 |
|
360 |
|
361 | timeout?: number;
|
362 | }
|
363 |
|
364 |
|
365 |
|
366 | export interface DropGroupOptions {
|
367 | |
368 |
|
369 |
|
370 | timeout?: number;
|
371 | }
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 | export declare class UserManager {
|
379 | private _cluster;
|
380 | |
381 |
|
382 |
|
383 | constructor(cluster: Cluster);
|
384 | private get _http();
|
385 | /**
|
386 | * Returns a specific user by their username.
|
387 | *
|
388 | * @param username The username of the user to fetch.
|
389 | * @param options Optional parameters for this operation.
|
390 | * @param callback A node-style callback to be invoked after execution.
|
391 | */
|
392 | getUser(username: string, options?: GetUserOptions, callback?: NodeCallback<UserAndMetadata>): Promise<UserAndMetadata>;
|
393 | /**
|
394 | * Returns a list of all existing users.
|
395 | *
|
396 | * @param options Optional parameters for this operation.
|
397 | * @param callback A node-style callback to be invoked after execution.
|
398 | */
|
399 | getAllUsers(options?: GetAllUsersOptions, callback?: NodeCallback<UserAndMetadata[]>): Promise<UserAndMetadata[]>;
|
400 | /**
|
401 | * Creates or updates an existing user.
|
402 | *
|
403 | * @param user The user to update.
|
404 | * @param options Optional parameters for this operation.
|
405 | * @param callback A node-style callback to be invoked after execution.
|
406 | */
|
407 | upsertUser(user: IUser, options?: UpsertUserOptions, callback?: NodeCallback<void>): Promise<void>;
|
408 | /**
|
409 | * Change password for the currently authenticatd user.
|
410 | *
|
411 | * @param newPassword The new password to be applied.
|
412 | * @param options Optional parameters for this operation.
|
413 | * @param callback A node-style callback to be invoked after execution.
|
414 | */
|
415 | changePassword(newPassword: string, options?: ChangePasswordOptions, callback?: NodeCallback<void>): Promise<void>;
|
416 | /**
|
417 | * Drops an existing user.
|
418 | *
|
419 | * @param username The username of the user to drop.
|
420 | * @param options Optional parameters for this operation.
|
421 | * @param callback A node-style callback to be invoked after execution.
|
422 | */
|
423 | dropUser(username: string, options?: DropUserOptions, callback?: NodeCallback<void>): Promise<void>;
|
424 | /**
|
425 | * Returns a list of roles available on the server.
|
426 | *
|
427 | * @param options Optional parameters for this operation.
|
428 | * @param callback A node-style callback to be invoked after execution.
|
429 | */
|
430 | getRoles(options?: GetRolesOptions, callback?: NodeCallback<Role[]>): Promise<Role[]>;
|
431 | /**
|
432 | * Returns a group by it's name.
|
433 | *
|
434 | * @param groupName The name of the group to retrieve.
|
435 | * @param options Optional parameters for this operation.
|
436 | * @param callback A node-style callback to be invoked after execution.
|
437 | */
|
438 | getGroup(groupName: string, options?: GetGroupOptions, callback?: NodeCallback<Group>): Promise<Group>;
|
439 | /**
|
440 | * Returns a list of all existing groups.
|
441 | *
|
442 | * @param options Optional parameters for this operation.
|
443 | * @param callback A node-style callback to be invoked after execution.
|
444 | */
|
445 | getAllGroups(options?: GetAllGroupsOptions, callback?: NodeCallback<Group[]>): Promise<Group[]>;
|
446 | /**
|
447 | * Creates or updates an existing group.
|
448 | *
|
449 | * @param group The group to update.
|
450 | * @param options Optional parameters for this operation.
|
451 | * @param callback A node-style callback to be invoked after execution.
|
452 | */
|
453 | upsertGroup(group: IGroup, options?: UpsertGroupOptions, callback?: NodeCallback<void>): Promise<void>;
|
454 | /**
|
455 | * Drops an existing group.
|
456 | *
|
457 | * @param groupName The name of the group to drop.
|
458 | * @param options Optional parameters for this operation.
|
459 | * @param callback A node-style callback to be invoked after execution.
|
460 | */
|
461 | dropGroup(groupName: string, options?: DropGroupOptions, callback?: NodeCallback<void>): Promise<void>;
|
462 | }
|