@things-factory/auth-base 6.1.118 → 6.1.123
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/auth-base",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.123",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"passport-jwt": "^4.0.0",
|
|
44
44
|
"passport-local": "^1.0.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "b1440f932f519e74aca05dabf2dd7f6690fcb3cf"
|
|
47
47
|
}
|
|
@@ -36,7 +36,7 @@ export enum UserStatus {
|
|
|
36
36
|
|
|
37
37
|
@Entity()
|
|
38
38
|
@Index('ix_user_0', (user: User) => [user.email], { unique: true })
|
|
39
|
-
|
|
39
|
+
//@Index('ix_user_1', (user: User) => [user.id], { unique: true })
|
|
40
40
|
@ObjectType()
|
|
41
41
|
export class User {
|
|
42
42
|
@PrimaryGeneratedColumn('uuid')
|
|
@@ -250,17 +250,18 @@ export class User {
|
|
|
250
250
|
|
|
251
251
|
static async hasPrivilege(name: string, category: string, domain: Domain, user: User) {
|
|
252
252
|
const result = await getRepository(User).query(
|
|
253
|
-
`
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
253
|
+
`
|
|
254
|
+
SELECT COUNT(1) AS "has_privilege" FROM "privileges" "PRIVILEGES"
|
|
255
|
+
WHERE "PRIVILEGES"."category" = '${category}'
|
|
256
|
+
AND "PRIVILEGES"."name" = '${name}'
|
|
257
|
+
AND "PRIVILEGES"."id" IN (
|
|
258
|
+
SELECT "RP"."privileges_id"
|
|
259
|
+
FROM "users_roles" "UR"
|
|
260
|
+
INNER JOIN "roles_privileges" "RP" ON "UR"."roles_id" = "RP"."roles_id"
|
|
261
|
+
LEFT JOIN "roles" "R" ON "R"."id" = "UR"."roles_id"
|
|
262
|
+
WHERE "UR"."users_id" = '${user?.id}'
|
|
263
|
+
AND "R"."domain_id" = '${domain?.id}'
|
|
264
|
+
)
|
|
264
265
|
`
|
|
265
266
|
)
|
|
266
267
|
|