11import { Access , IAccessInfo , Query , IQueryInfo , Permission } from './core' ;
2- import type { ValidRoleOrArray , ValidRole } from '.' ;
32/**
43 * @classdesc
54 * AccessControl class that implements RBAC (Role-Based Access Control) basics
@@ -119,7 +118,7 @@ declare class AccessControl {
119118 * @name AccessControl#isLocked
120119 * @type {Boolean }
121120 */
122- get isLocked ( ) : boolean ;
121+ readonly isLocked : boolean ;
123122 /**
124123 * Gets the internal grants object that stores all current grants.
125124 *
@@ -235,7 +234,7 @@ declare class AccessControl {
235234 * @throws {AccessControlError } - If a role is extended by itself or a
236235 * non-existent role. Or if called after `.lock()` is called.
237236 */
238- extendRole ( roles : ValidRoleOrArray , extenderRoles : ValidRoleOrArray ) : AccessControl ;
237+ extendRole ( roles : string | string [ ] , extenderRoles : string | string [ ] ) : AccessControl ;
239238 /**
240239 * Removes all the given role(s) and their granted permissions, at once.
241240 * @chainable
@@ -247,7 +246,7 @@ declare class AccessControl {
247246 *
248247 * @throws {AccessControlError } - If called after `.lock()` is called.
249248 */
250- removeRoles ( roles : ValidRoleOrArray ) : AccessControl ;
249+ removeRoles ( roles : string | string [ ] ) : AccessControl ;
251250 /**
252251 * Removes all the given resources for all roles, at once.
253252 * Pass the `roles` argument to remove access to resources for those
@@ -264,7 +263,7 @@ declare class AccessControl {
264263 *
265264 * @throws {AccessControlError } - If called after `.lock()` is called.
266265 */
267- removeResources ( resources : ValidRoleOrArray , roles ?: ValidRoleOrArray ) : AccessControl ;
266+ removeResources ( resources : string | string [ ] , roles ?: string | string [ ] ) : AccessControl ;
268267 /**
269268 * Gets all the unique roles that have at least one access information.
270269 *
@@ -285,12 +284,12 @@ declare class AccessControl {
285284 *
286285 * @returns {Array<String> }
287286 */
288- getInheritedRolesOf ( role : ValidRole ) : ValidRole [ ] ;
287+ getInheritedRolesOf ( role : string ) : string [ ] ;
289288 /**
290289 * Alias of `getInheritedRolesOf`
291290 * @private
292291 */
293- getExtendedRolesOf ( role : ValidRole ) : ValidRole [ ] ;
292+ getExtendedRolesOf ( role : string ) : string [ ] ;
294293 /**
295294 * Gets all the unique resources that are granted access for at
296295 * least one role.
@@ -306,7 +305,7 @@ declare class AccessControl {
306305 *
307306 * @returns {Boolean }
308307 */
309- hasRole ( role : ValidRoleOrArray ) : boolean ;
308+ hasRole ( role : string | string [ ] ) : boolean ;
310309 /**
311310 * Checks whether grants include the given resource or resources.
312311 *
@@ -315,7 +314,7 @@ declare class AccessControl {
315314 *
316315 * @returns {Boolean }
317316 */
318- hasResource ( resource : ValidRoleOrArray ) : boolean ;
317+ hasResource ( resource : string | string [ ] ) : boolean ;
319318 /**
320319 * Gets an instance of `Query` object. This is used to check whether the
321320 * defined access is allowed for the given role(s) and resource. This
@@ -348,12 +347,12 @@ declare class AccessControl {
348347 * ac.can(['admin', 'user']).createOwn('profile');
349348 * // Note: when multiple roles checked, acquired attributes are unioned (merged).
350349 */
351- can ( role : ValidRoleOrArray | IQueryInfo ) : Query ;
350+ can ( role : string | string [ ] | IQueryInfo ) : Query ;
352351 /**
353352 * Alias of `can()`.
354353 * @private
355354 */
356- query ( role : ValidRoleOrArray | IQueryInfo ) : Query ;
355+ query ( role : string | string [ ] | IQueryInfo ) : Query ;
357356 /**
358357 * Gets an instance of `Permission` object that checks and defines the
359358 * granted access permissions for the target resource and role. Normally
@@ -438,12 +437,12 @@ declare class AccessControl {
438437 * // Note: when attributes is omitted, it will default to `['*']`
439438 * // which means all attributes (of the resource) are allowed.
440439 */
441- grant ( role ?: ValidRoleOrArray | IAccessInfo ) : Access ;
440+ grant ( role ?: string | string [ ] | IAccessInfo ) : Access ;
442441 /**
443442 * Alias of `grant()`.
444443 * @private
445444 */
446- allow ( role ?: ValidRoleOrArray | IAccessInfo ) : Access ;
445+ allow ( role ?: string | string [ ] | IAccessInfo ) : Access ;
447446 /**
448447 * Gets an instance of `Access` object. This is used to deny access to
449448 * specified resource(s) for the given role(s). Denying will only remove a
@@ -496,31 +495,31 @@ declare class AccessControl {
496495 * // To deny same resource for multiple roles:
497496 * ac.deny(['admin', 'user']).createOwn('profile');
498497 */
499- deny ( role ?: ValidRoleOrArray | IAccessInfo ) : Access ;
498+ deny ( role ?: string | string [ ] | IAccessInfo ) : Access ;
500499 /**
501500 * Alias of `deny()`.
502501 * @private
503502 */
504- reject ( role ?: ValidRoleOrArray | IAccessInfo ) : Access ;
503+ reject ( role ?: string | string [ ] | IAccessInfo ) : Access ;
505504 /**
506505 * @private
507506 */
508- _removePermission ( resources : ValidRoleOrArray , roles ?: ValidRoleOrArray , actionPossession ?: string ) : void ;
507+ _removePermission ( resources : string | string [ ] , roles ?: string | string [ ] , actionPossession ?: string ) : void ;
509508 /**
510509 * Documented separately in enums/Action
511510 * @private
512511 */
513- static get Action ( ) : any ;
512+ static readonly Action : any ;
514513 /**
515514 * Documented separately in enums/Possession
516515 * @private
517516 */
518- static get Possession ( ) : any ;
517+ static readonly Possession : any ;
519518 /**
520519 * Documented separately in AccessControlError
521520 * @private
522521 */
523- static get Error ( ) : any ;
522+ static readonly Error : any ;
524523 /**
525524 * A utility method for deep cloning the given data object(s) while
526525 * filtering its properties by the given attribute (glob) notations.
0 commit comments