chyz 1.2.4-rc.5 → 1.2.4-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/BaseChyz.js +17 -6
  2. package/BaseChyz.js.map +1 -1
  3. package/Chyz.js +4 -2
  4. package/Chyz.js.map +1 -1
  5. package/base/ActionFilter.js +15 -4
  6. package/base/ActionFilter.js.map +1 -1
  7. package/base/BaseError.js +4 -2
  8. package/base/BaseError.js.map +1 -1
  9. package/base/BaseObject.js +4 -2
  10. package/base/BaseObject.js.map +1 -1
  11. package/base/CWebController.js +10 -2
  12. package/base/CWebController.js.map +1 -1
  13. package/base/Component.js +4 -2
  14. package/base/Component.js.map +1 -1
  15. package/base/DbConnection.js +14 -3
  16. package/base/DbConnection.js.map +1 -1
  17. package/base/Model.js +17 -6
  18. package/base/Model.js.map +1 -1
  19. package/base/index.js +28 -19
  20. package/base/index.js.map +1 -1
  21. package/decorator/index.js +13 -4
  22. package/decorator/index.js.map +1 -1
  23. package/filters/AccessControl.js +15 -4
  24. package/filters/AccessControl.js.map +1 -1
  25. package/filters/AccessRule.js +15 -4
  26. package/filters/AccessRule.js.map +1 -1
  27. package/filters/auth/AuthMethod.js +10 -2
  28. package/filters/auth/AuthMethod.js.map +1 -1
  29. package/filters/auth/HttpBasicAuth.js +14 -3
  30. package/filters/auth/HttpBasicAuth.js.map +1 -1
  31. package/filters/auth/HttpHeaderAuth.js +14 -3
  32. package/filters/auth/HttpHeaderAuth.js.map +1 -1
  33. package/filters/auth/JwtHttpBearerAuth.js +14 -3
  34. package/filters/auth/JwtHttpBearerAuth.js.map +1 -1
  35. package/filters/auth/KeyCloakHttpBearerAuth.js +15 -4
  36. package/filters/auth/KeyCloakHttpBearerAuth.js.map +1 -1
  37. package/filters/auth/index.js +14 -5
  38. package/filters/auth/index.js.map +1 -1
  39. package/filters/index.js +12 -3
  40. package/filters/index.js.map +1 -1
  41. package/index.js +19 -7
  42. package/index.js.map +1 -1
  43. package/package.json +1 -1
  44. package/rbac/AuthManager.js +29 -18
  45. package/rbac/AuthManager.js.map +1 -1
  46. package/web/WebUser.js +16 -5
  47. package/web/WebUser.js.map +1 -1
  48. package/BaseChyz.d.ts +0 -62
  49. package/Chyz.d.ts +0 -3
  50. package/base/ActionFilter.d.ts +0 -26
  51. package/base/BaseError.d.ts +0 -10
  52. package/base/BaseObject.d.ts +0 -4
  53. package/base/Behavior.d.ts +0 -3
  54. package/base/CWebController.d.ts +0 -43
  55. package/base/Component.d.ts +0 -21
  56. package/base/Configurable.d.ts +0 -2
  57. package/base/DataErrorDbException.d.ts +0 -5
  58. package/base/DbConnection.d.ts +0 -12
  59. package/base/ForbiddenHttpException.d.ts +0 -4
  60. package/base/InvalidArgumentException.d.ts +0 -5
  61. package/base/InvalidConfigException.d.ts +0 -5
  62. package/base/Model.d.ts +0 -298
  63. package/base/ModelManager.d.ts +0 -1
  64. package/base/NotFoundHttpException.d.ts +0 -5
  65. package/base/RestClient.d.ts +0 -8
  66. package/base/UnauthorizedHttpException.d.ts +0 -5
  67. package/base/ValidationHttpException.d.ts +0 -5
  68. package/base/db/Exception.d.ts +0 -6
  69. package/base/index.d.ts +0 -18
  70. package/decorator/Middleware.d.ts +0 -3
  71. package/decorator/controller.d.ts +0 -2
  72. package/decorator/enums/ControllerDecoratorParams.d.ts +0 -5
  73. package/decorator/get.d.ts +0 -2
  74. package/decorator/index.d.ts +0 -3
  75. package/decorator/post.d.ts +0 -2
  76. package/filters/AccessControl.d.ts +0 -11
  77. package/filters/AccessRule.d.ts +0 -82
  78. package/filters/auth/AuthInterface.d.ts +0 -25
  79. package/filters/auth/AuthMethod.d.ts +0 -25
  80. package/filters/auth/HttpBasicAuth.d.ts +0 -22
  81. package/filters/auth/HttpBearerAuth.d.ts +0 -17
  82. package/filters/auth/HttpHeaderAuth.d.ts +0 -14
  83. package/filters/auth/JwtHttpBearerAuth.d.ts +0 -20
  84. package/filters/auth/KeyCloakHttpBearerAuth.d.ts +0 -22
  85. package/filters/auth/index.d.ts +0 -4
  86. package/filters/index.d.ts +0 -2
  87. package/index.d.ts +0 -15
  88. package/model/RouteDefinition.d.ts +0 -6
  89. package/rbac/AuthAssignment.d.ts +0 -18
  90. package/rbac/AuthItem.d.ts +0 -26
  91. package/rbac/AuthItemChild.d.ts +0 -18
  92. package/rbac/AuthManager.d.ts +0 -111
  93. package/requiments/Glob.d.ts +0 -2
  94. package/requiments/ReflectUtil.d.ts +0 -0
  95. package/requiments/Utils.d.ts +0 -2
  96. package/validators/BooleanValidator.d.ts +0 -0
  97. package/validators/CompareValidator.d.ts +0 -0
  98. package/validators/DateValidator.d.ts +0 -0
  99. package/validators/EmailValidator.d.ts +0 -0
  100. package/validators/Validator.d.ts +0 -17
  101. package/web/IdentityInterface.d.ts +0 -54
  102. package/web/WebUser.d.ts +0 -71
@@ -1,82 +0,0 @@
1
- import { WebUser } from "../web/WebUser";
2
- import { Component } from "../base/Component";
3
- import { Request } from "express";
4
- export declare class AccessRule extends Component {
5
- /**
6
- * @var bool whether this is an 'allow' rule or 'deny' rule.
7
- */
8
- allow: any;
9
- /**
10
- * @var array list of action IDs that this rule applies to. The comparison is case-sensitive.
11
- * If not set or empty, it means this rule applies to all actions.
12
- */
13
- actions: any;
14
- /**
15
- * @var array list of the controller IDs that this rule applies to.
16
- */
17
- controllers: any;
18
- /**
19
- * - `?`: matches a guest user (not authenticated yet)
20
- * - `@`: matches an authenticated user
21
- */
22
- roles: any;
23
- /**
24
- * @var array list of RBAC (Role-Based Access Control) permissions that this rules applies to.
25
- */
26
- permissions: any;
27
- /**
28
- * @var array|Closure parameters to pass to the [[User::can()]] function for evaluating
29
- * user permissions in [[$roles]].
30
- *
31
- * If this is an array, it will be passed directly to [[User::can()]]. For example for passing an
32
- * ID from the current request, you may use the following:
33
- *
34
- * ```php
35
- * ['postId' => Yii::$app->request->get('id')]
36
- * ```
37
- *
38
- * You may also specify a closure that returns an array. This can be used to
39
- * evaluate the array values only if they are needed, for example when a model needs to be
40
- * loaded like in the following code:
41
- *
42
- * ```php
43
- * 'rules' => [
44
- * [
45
- * 'allow' => true,
46
- * 'actions' => ['update'],
47
- * 'roles' => ['updatePost'],
48
- * 'roleParams' => function($rule) {
49
- * return ['post' => Post::findOne(Yii::$app->request->get('id'))];
50
- * },
51
- * ],
52
- * ],
53
- * ```
54
- *
55
- * A reference to the [[AccessRule]] instance will be passed to the closure as the first parameter.
56
- *
57
- * @see roles
58
- * @since 2.0.12
59
- */
60
- roleParams: any;
61
- /**
62
- * @var array list of user IP addresses that this rule applies to. An IP address
63
- * can contain the wildcard `*` at the end so that it matches IP addresses with the same prefix.
64
- * For example, '192.168.*' matches all IP addresses in the segment '192.168.'.
65
- * It may also contain a pattern/mask like '172.16.0.0/12' which would match all IPs from the
66
- * 20-bit private network block in RFC1918.
67
- * If not set or empty, it means this rule applies to all IP addresses.
68
- */
69
- ips: any;
70
- allows(action: any, user: WebUser, request: Request): Promise<any>;
71
- /**
72
- * @param Action $action the action
73
- * @return bool whether the rule applies to the action
74
- */
75
- protected matchAction(action: any): any;
76
- /**
77
- * @param Controller $controller the controller
78
- * @return bool whether the rule applies to the controller
79
- */
80
- protected matchController(controller: any): boolean;
81
- protected matchRole(user: WebUser): Promise<boolean>;
82
- }
@@ -1,25 +0,0 @@
1
- import { Request, Response } from "express";
2
- export interface AuthInterface {
3
- /**
4
- * Authenticates the current user.
5
- * @param User $user
6
- * @param Request $request
7
- * @param Response $response
8
- * @return IdentityInterface the authenticated user identity. If authentication information is not provided, null will be returned.
9
- * @throws UnauthorizedHttpException if authentication information is provided but is invalid.
10
- */
11
- authenticate(user: any, request: Request, response: Response): any;
12
- /**
13
- * Generates challenges upon authentication failure.
14
- * For example, some appropriate HTTP headers may be generated.
15
- * @param Response $response
16
- */
17
- challenge(response: Response): Response;
18
- /**
19
- * Handles authentication failure.
20
- * The implementation should normally throw UnauthorizedHttpException to indicate authentication failure.
21
- * @param Response $response
22
- * @throws UnauthorizedHttpException
23
- */
24
- handleFailure(response: Response): Response;
25
- }
@@ -1,25 +0,0 @@
1
- import { ActionFilter } from "../../base/ActionFilter";
2
- import { AuthInterface } from "./AuthInterface";
3
- import { WebUser } from "../../web/WebUser";
4
- import { Request, Response } from "express";
5
- export declare abstract class AuthMethod extends ActionFilter implements AuthInterface {
6
- /**
7
- * @var User the user object representing the user authentication status. If not set, the `user` application component will be used.
8
- */
9
- user: WebUser | undefined;
10
- /**
11
- * @var Request the current request. If not set, the `request` application component will be used.
12
- */
13
- request: Request | undefined;
14
- /**
15
- * @var Response the response to be sent. If not set, the `response` application component will be used.
16
- */
17
- response: Response | undefined;
18
- optional: never[];
19
- beforeAction(action: any, request: Request, response: Response): Promise<boolean>;
20
- authenticate(user: WebUser, request: Request, response: Response): void;
21
- challenge(response: Response): void;
22
- handleFailure(response: Response): void;
23
- getHeaderByKey(headers: any, findKey: any): any;
24
- patternCheck(headerText: any, pattern: RegExp): any;
25
- }
@@ -1,22 +0,0 @@
1
- import { Request, Response } from "express";
2
- import { WebUser } from "../../web/WebUser";
3
- import { AuthMethod } from "./AuthMethod";
4
- export declare class HttpBasicAuth extends AuthMethod {
5
- /**
6
- * @var string the HTTP header name
7
- */
8
- header: string;
9
- /**
10
- * @var string a pattern to use to extract the HTTP authentication value
11
- */
12
- pattern: RegExp;
13
- /**
14
- * @throws InvalidConfigException
15
- */
16
- init(): void;
17
- authenticate(user: WebUser, request: Request, response: Response): Promise<any>;
18
- /**
19
- * @throws UnauthorizedHttpException
20
- */
21
- fail(response: Response): void;
22
- }
@@ -1,17 +0,0 @@
1
- import { HttpHeaderAuth } from "./HttpHeaderAuth";
2
- import { Response } from "express";
3
- export declare class HttpBearerAuth extends HttpHeaderAuth {
4
- /**
5
- * {@inheritdoc}
6
- */
7
- header: string;
8
- pattern: RegExp;
9
- /**
10
- * @var string the HTTP authentication realm
11
- */
12
- realm: string;
13
- /**
14
- * {@inheritdoc}
15
- */
16
- challenge(response: Response): void;
17
- }
@@ -1,14 +0,0 @@
1
- import { AuthMethod } from "./AuthMethod";
2
- import { WebUser } from "../../web/WebUser";
3
- import { Request, Response } from "express";
4
- export declare class HttpHeaderAuth extends AuthMethod {
5
- /**
6
- * @var string the HTTP header name
7
- */
8
- header: string;
9
- /**
10
- * @var string a pattern to use to extract the HTTP authentication value
11
- */
12
- pattern: string;
13
- authenticate(user: WebUser, request: Request, response: Response): Promise<any>;
14
- }
@@ -1,20 +0,0 @@
1
- import { HttpBearerAuth } from "./HttpBearerAuth";
2
- import { Response, Request } from "express";
3
- import { WebUser } from "../../web/WebUser";
4
- export declare class JwtHttpBearerAuth extends HttpBearerAuth {
5
- /**
6
- * @var string|array<string, mixed>|Jwt application component ID of the JWT handler, configuration array, or JWT handler object
7
- * itself. By default it's assumes that component of ID "jwt" has been configured.
8
- */
9
- jwt: string;
10
- auth: any;
11
- /**
12
- * @throws InvalidConfigException
13
- */
14
- init(): void;
15
- authenticate(user: WebUser, request: Request, response: Response): Promise<any>;
16
- /**
17
- * @throws UnauthorizedHttpException
18
- */
19
- fail(response: Response): void;
20
- }
@@ -1,22 +0,0 @@
1
- import { HttpBearerAuth } from "./HttpBearerAuth";
2
- import { Response, Request } from "express";
3
- import { WebUser } from "../../web/WebUser";
4
- export declare class KeyCloakHttpBearerAuth extends HttpBearerAuth {
5
- /**
6
- * @var string|array<string, mixed>|Jwt application component ID of the JWT handler, configuration array, or JWT handler object
7
- * itself. By default it's assumes that component of ID "jwt" has been configured.
8
- */
9
- jwt: string;
10
- auth: any;
11
- keycloak: any;
12
- /**
13
- * @throws InvalidConfigException
14
- */
15
- init(): void;
16
- KeyCloakCheck(token: string, request: Request, response: Response): Promise<any>;
17
- authenticate(user: WebUser, request: Request, response: Response): Promise<any>;
18
- /**
19
- * @throws UnauthorizedHttpException
20
- */
21
- fail(response: Response): void;
22
- }
@@ -1,4 +0,0 @@
1
- export * from "./JwtHttpBearerAuth";
2
- export * from "./HttpBearerAuth";
3
- export * from "./HttpHeaderAuth";
4
- export * from "./HttpBasicAuth";
@@ -1,2 +0,0 @@
1
- export * from "./AccessControl";
2
- export * from "./AccessRule";
package/index.d.ts DELETED
@@ -1,15 +0,0 @@
1
- export { Request, Response, NextFunction } from "express";
2
- export * from "./base";
3
- export * from "./filters";
4
- export * from "./filters/auth";
5
- export * from "./decorator";
6
- export * from "./requiments/Utils";
7
- export { RouteDefinition } from "./model/RouteDefinition";
8
- export { WebUser } from "./web/WebUser";
9
- import BaseChyz from "./BaseChyz";
10
- export { BaseChyz };
11
- /**
12
- *
13
- */
14
- declare const Chyz: BaseChyz;
15
- export default Chyz;
@@ -1,6 +0,0 @@
1
- export interface RouteDefinition {
2
- id: string;
3
- path: string;
4
- requestMethod: 'get' | 'post' | 'delete' | 'options' | 'put';
5
- methodName: string;
6
- }
@@ -1,18 +0,0 @@
1
- import { DataTypes, Model, Relation } from "../base";
2
- export declare class AuthAssignmentClass extends Model {
3
- [x: string]: any;
4
- tableName(): string;
5
- attributes(): {
6
- item_name: {
7
- type: DataTypes.StringDataTypeConstructor;
8
- primaryKey: boolean;
9
- allowNull: boolean;
10
- };
11
- user_id: {
12
- type: DataTypes.StringDataTypeConstructor;
13
- allowNull: boolean;
14
- };
15
- };
16
- init(): void;
17
- relations(): Relation[];
18
- }
@@ -1,26 +0,0 @@
1
- import { DataTypes, Model, Relation } from "../base";
2
- export declare class AuthItemClass extends Model {
3
- [x: string]: any;
4
- tableName(): string;
5
- attributes(): {
6
- name: {
7
- type: DataTypes.StringDataTypeConstructor;
8
- primaryKey: boolean;
9
- allowNull: boolean;
10
- };
11
- type: {
12
- type: DataTypes.IntegerDataTypeConstructor;
13
- allowNull: boolean;
14
- };
15
- description: {
16
- type: DataTypes.StringDataTypeConstructor;
17
- allowNull: boolean;
18
- };
19
- rule_name: {
20
- type: DataTypes.StringDataTypeConstructor;
21
- allowNull: boolean;
22
- };
23
- };
24
- init(): void;
25
- relations(): Relation[];
26
- }
@@ -1,18 +0,0 @@
1
- import { DataTypes, Model, Relation } from "../base";
2
- export declare class AuthItemChildClass extends Model {
3
- [x: string]: any;
4
- tableName(): string;
5
- attributes(): {
6
- parent: {
7
- type: DataTypes.StringDataTypeConstructor;
8
- primaryKey: boolean;
9
- allowNull: boolean;
10
- };
11
- child: {
12
- type: DataTypes.StringDataTypeConstructor;
13
- allowNull: boolean;
14
- };
15
- };
16
- init(): void;
17
- relations(): Relation[];
18
- }
@@ -1,111 +0,0 @@
1
- import { Component } from "../base";
2
- interface Role {
3
- type: number;
4
- name: string;
5
- description: string;
6
- ruleName: string;
7
- data: string;
8
- params: string;
9
- }
10
- export declare class AuthManager extends Component {
11
- static readonly TYPE_ROLE = 1;
12
- static readonly TYPE_PERMISSION = 2;
13
- init(): void;
14
- /**
15
- * @var Item[] all auth items (name => Item)
16
- */
17
- protected items: any;
18
- checkAccessAssignments: any;
19
- defaultRoles: any;
20
- /**
21
- *
22
- */
23
- checkAccess(userId: number, permissionName: string, params?: any[]): Promise<boolean>;
24
- checkAccessFromCache(): Promise<void>;
25
- checkAccessRecursive(user: string | number, itemname: string, params: any[], assignments: any): Promise<boolean>;
26
- /**
27
- *
28
- * @param name
29
- */
30
- getItem(name: string): Promise<any>;
31
- getItems(type: number): Promise<any>;
32
- getRolesByUser(userId: number): Promise<any>;
33
- /**
34
- *
35
- * @param roleName
36
- */
37
- getChildRoles(roleName: string): Promise<any>;
38
- /**
39
- *
40
- * @param roleName
41
- */
42
- getPermissionsByRole(roleName: string): Promise<any>;
43
- /**
44
- *
45
- * @param userId
46
- */
47
- getPermissionsByUser(userId: number): Promise<any>;
48
- /**
49
- * Returns all permissions that are directly assigned to user.
50
- * @return Permission[] all direct permissions that the user has. The array is indexed by the permission names.
51
- */
52
- protected getDirectPermissionsByUser(userId: number): Promise<any>;
53
- protected getInheritedPermissionsByUser(userId: number): Promise<any>;
54
- /**
55
- *
56
- * @param userId
57
- */
58
- getItemsByUser(userId: number): Promise<any>;
59
- /**
60
- * Returns all role assignment information for the specified role.
61
- * @param $roleName
62
- */
63
- getUserIdsByRole(roleName: number): Promise<any>;
64
- /**
65
- * {@inheritdoc}
66
- */
67
- getRole(name: string): Promise<Role | null>;
68
- /**
69
- * {@inheritdoc}
70
- */
71
- getRoles(): Promise<any>;
72
- /**
73
- * Recursively finds all children and grand children of the specified item.
74
- * @param string $name the name of the item whose children are to be looked for.
75
- * @param array $childrenList the child list built via [[getChildrenList()]]
76
- * @param array $result the children and grand children (in array keys)
77
- */
78
- protected getChildrenRecursive(name: string, childrenList: any, model: any): void;
79
- /**
80
- *
81
- * @param roleName
82
- * @param userId
83
- */
84
- getAssignment(roleName: string, userId: string): any;
85
- /**
86
- *
87
- */
88
- getAssignments(userId: number): Promise<any>;
89
- /**
90
- * Returns the children for every parent.
91
- * @return array the children list. Each array key is a parent item name,
92
- * and the corresponding array value is a list of child item names.
93
- */
94
- protected getChildrenList(): Promise<any>;
95
- /**
96
- * Check whether $userId is empty.
97
- * @param mixed $userId
98
- * @return bool
99
- * @since 2.0.26
100
- */
101
- protected isEmptyUserId(userId: string): boolean;
102
- /**
103
- * Checks whether array of $assignments is empty and [[defaultRoles]] property is empty as well.
104
- *
105
- * @param Assignment[] $assignments array of user's assignments
106
- * @return bool whether array of $assignments is empty and [[defaultRoles]] property is empty as well
107
- * @since 2.0.11
108
- */
109
- protected hasNoAssignments(assignments: any): any;
110
- }
111
- export {};
@@ -1,2 +0,0 @@
1
- declare const Glob: any;
2
- export default Glob;
File without changes
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
File without changes
File without changes
File without changes
File without changes
@@ -1,17 +0,0 @@
1
- import { Component } from "../base";
2
- export declare class Validator extends Component {
3
- static builtInValidators: {
4
- boolean: string;
5
- email: string;
6
- };
7
- /**
8
- * @var array|string attributes to be validated by this validator. For multiple attributes,
9
- * please specify them as an array; for single attribute, you may use either a string or an array.
10
- */
11
- attributes: never[];
12
- message: string;
13
- except: never[];
14
- isEmpty: never[];
15
- init(): void;
16
- static createValidator(type: any, model: any, attributes: any, params?: never[]): void;
17
- }
@@ -1,54 +0,0 @@
1
- export interface IdentityInterface {
2
- /**
3
- * Finds an identity by the given ID.
4
- * @param string|int $id the ID to be looked for
5
- * @return IdentityInterface|null the identity object that matches the given ID.
6
- * Null should be returned if such an identity cannot be found
7
- * or the identity is not in an active state (disabled, deleted, etc.)
8
- */
9
- findIdentity(id: number): any;
10
- /**
11
- * Finds an identity by the given token.
12
- * For example, [[\yii\filters\auth\HttpBearerAuth]] will set this parameter to be `yii\filters\auth\HttpBearerAuth`.
13
- * @return IdentityInterface|null the identity object that matches the given token.
14
- * Null should be returned if such an identity cannot be found
15
- * or the identity is not in an active state (disabled, deleted, etc.)
16
- * @param token
17
- * @param type
18
- */
19
- findIdentityByAccessToken(token: any, type: string): any;
20
- /**
21
- * Returns an ID that can uniquely identify a user identity.
22
- * @return string|int an ID that uniquely identifies a user identity.
23
- */
24
- getId(): number;
25
- /**
26
- * Returns a key that can be used to check the validity of a given identity ID.
27
- *
28
- * The key should be unique for each individual user, and should be persistent
29
- * so that it can be used to check the validity of the user identity.
30
- *
31
- * The space of such keys should be big enough to defeat potential identity attacks.
32
- *
33
- * The returned key is used to validate session and auto-login (if [[User::enableAutoLogin]] is enabled).
34
- *
35
- * Make sure to invalidate earlier issued authKeys when you implement force user logout, password change and
36
- * other scenarios, that require forceful access revocation for old sessions.
37
- *
38
- * @return string|null a key that is used to check the validity of a given identity ID.
39
- * @see validateAuthKey()
40
- */
41
- getAuthKey(): string;
42
- /**
43
- * Validates the given auth key.
44
- *
45
- * @param string $authKey the given auth key
46
- * @return bool|null whether the given auth key is valid.
47
- * @see getAuthKey()
48
- */
49
- validateAuthKey(authKey: string): (boolean | null);
50
- /**
51
- *
52
- */
53
- can(permissionName: string, params: any[], allowCaching: boolean): (boolean | null);
54
- }
package/web/WebUser.d.ts DELETED
@@ -1,71 +0,0 @@
1
- import { Component } from "../base/Component";
2
- import { IdentityInterface } from "./IdentityInterface";
3
- import { AuthManager } from "../rbac/AuthManager";
4
- export declare class WebUser extends Component {
5
- /**
6
- * @var string the class name of the [[identity]] object.
7
- */
8
- identityClass: any;
9
- private _identity;
10
- /**
11
- * @var CheckAccessInterface|string|array The access checker object to use for checking access or the application
12
- * component ID of the access checker.
13
- * If not set the application auth manager will be used.
14
- * @since 2.0.9
15
- */
16
- accessChecker: any;
17
- get identity(): any;
18
- set identity(value: any);
19
- init(): void;
20
- getIsGuest(): boolean;
21
- getIdentity(autoRenew?: boolean): any;
22
- loginRequired(): void;
23
- /**
24
- * Regenerates CSRF token
25
- *
26
- * @since 2.0.14.2
27
- */
28
- protected regenerateCsrfToken(): void;
29
- /**
30
- * Logs in a user by the given access token.
31
- * @param token
32
- * @param type
33
- */
34
- loginByAccessToken(token: any, type?: any): Promise<any>;
35
- login(identity: IdentityInterface, duration?: number): boolean;
36
- beforeLogin(identity: any, cookieBased: boolean, duration: number): boolean;
37
- afterLogin(): void;
38
- getId(): any;
39
- /**
40
- * Checks if the user can perform the operation as specified by the given permission.
41
- *
42
- * Note that you must configure "authManager" application component in order to use this method.
43
- * Otherwise it will always return false.
44
- *
45
- * @param string $permissionName the name of the permission (e.g. "edit post") that needs access check.
46
- * @param array $params name-value pairs that would be passed to the rules associated
47
- * with the roles and permissions assigned to the user.
48
- * @param bool $allowCaching whether to allow caching the result of access check.
49
- * When this parameter is true (default), if the access check of an operation was performed
50
- * before, its result will be directly returned when calling this method to check the same
51
- * operation. If this parameter is false, this method will always call
52
- * [[\yii\rbac\CheckAccessInterface::checkAccess()]] to obtain the up-to-date access result. Note that this
53
- * caching is effective only within the same request and only works when `$params = []`.
54
- * @return bool whether the user can perform the operation as specified by the given permission.
55
- */
56
- can(permissionName: string, params?: never[], allowCaching?: boolean): Promise<boolean>;
57
- /**
58
- * Returns auth manager associated with the user component.
59
- *
60
- * By default this is the `authManager` application component.
61
- * You may override this method to return a different auth manager instance if needed.
62
- * @return \yii\rbac\ManagerInterface
63
- * @since 2.0.6
64
- */
65
- protected getAuthManager(): AuthManager;
66
- /**
67
- * Returns the access checker used for checking access.
68
- * @return CheckAccessInterface
69
- */
70
- protected getAccessChecker(): AuthManager;
71
- }