@nocobase/plugin-acl 2.0.0-alpha.8 → 2.0.0-beta.1
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/dist/externalVersion.js +8 -8
- package/dist/locale/de-DE.json +18 -7
- package/dist/locale/en-US.json +17 -13
- package/dist/locale/es-ES.json +22 -0
- package/dist/locale/fr-FR.json +22 -0
- package/dist/locale/hu-HU.json +22 -0
- package/dist/locale/id-ID.json +22 -0
- package/dist/locale/it-IT.json +18 -7
- package/dist/locale/ja-JP.json +18 -6
- package/dist/locale/ko-KR.json +21 -4
- package/dist/locale/nl-NL.json +20 -9
- package/dist/locale/pt-BR.json +22 -0
- package/dist/locale/ru-RU.json +22 -0
- package/dist/locale/tr-TR.json +22 -0
- package/dist/locale/uk-UA.json +22 -0
- package/dist/locale/vi-VN.json +22 -0
- package/dist/locale/zh-CN.json +15 -15
- package/dist/locale/zh-TW.json +22 -0
- package/dist/server/actions/user-setDefaultRole.js +5 -2
- package/dist/server/collections/roles.js +1 -0
- package/dist/server/middlewares/check-association-operate.d.ts +10 -0
- package/dist/server/middlewares/check-association-operate.js +88 -0
- package/dist/server/middlewares/with-acl-meta.js +3 -0
- package/dist/server/migrations/20251119225252-update-member-default-permission.d.ts +14 -0
- package/dist/server/migrations/20251119225252-update-member-default-permission.js +59 -0
- package/dist/server/server.js +20 -3
- package/package.json +8 -2
package/dist/externalVersion.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.0.0-
|
|
11
|
+
"@nocobase/client": "2.0.0-beta.1",
|
|
12
12
|
"antd": "5.24.2",
|
|
13
13
|
"react": "18.2.0",
|
|
14
14
|
"react-i18next": "11.18.6",
|
|
@@ -17,14 +17,14 @@ module.exports = {
|
|
|
17
17
|
"@formily/react": "2.3.7",
|
|
18
18
|
"@ant-design/icons": "5.6.1",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
|
-
"@nocobase/utils": "2.0.0-
|
|
21
|
-
"@nocobase/actions": "2.0.0-
|
|
22
|
-
"@nocobase/cache": "2.0.0-
|
|
23
|
-
"@nocobase/database": "2.0.0-
|
|
24
|
-
"@nocobase/server": "2.0.0-
|
|
25
|
-
"@nocobase/test": "2.0.0-
|
|
20
|
+
"@nocobase/utils": "2.0.0-beta.1",
|
|
21
|
+
"@nocobase/actions": "2.0.0-beta.1",
|
|
22
|
+
"@nocobase/cache": "2.0.0-beta.1",
|
|
23
|
+
"@nocobase/database": "2.0.0-beta.1",
|
|
24
|
+
"@nocobase/server": "2.0.0-beta.1",
|
|
25
|
+
"@nocobase/test": "2.0.0-beta.1",
|
|
26
26
|
"@formily/core": "2.3.7",
|
|
27
27
|
"@formily/antd-v5": "1.2.3",
|
|
28
28
|
"antd-style": "3.7.1",
|
|
29
|
-
"@nocobase/acl": "2.0.0-
|
|
29
|
+
"@nocobase/acl": "2.0.0-beta.1"
|
|
30
30
|
};
|
package/dist/locale/de-DE.json
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Datenquellen",
|
|
5
|
+
"Desktop menu": "Desktop-Menü",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "Allgemein",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
4
11
|
"New role": "Neue Rolle",
|
|
5
12
|
"Permissions": "Berechtigungen",
|
|
6
|
-
"
|
|
7
|
-
"General": "Allgemein",
|
|
8
|
-
"Desktop menu": "Desktop-Menü",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
9
14
|
"Plugin settings": "Plugin-Einstellungen",
|
|
10
|
-
"
|
|
11
|
-
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Rollen und Berechtigungen",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "Der aktuelle Benutzer hat keine Rollen. Bitte versuchen Sie es mit einem anderen Konto.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "Die Benutzerrolle existiert nicht. Bitte versuchen Sie, sich erneut anzumelden"
|
|
22
|
+
}
|
package/dist/locale/en-US.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"Permissions": "Permissions",
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Data sources",
|
|
6
5
|
"Desktop menu": "Desktop menu",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "General",
|
|
7
10
|
"Independent roles": "Independent roles",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"Role mode": "Role mode",
|
|
11
|
-
"Saved successfully": "Saved successfully",
|
|
11
|
+
"New role": "New role",
|
|
12
|
+
"Permissions": "Permissions",
|
|
12
13
|
"Please select role mode": "Please select role mode",
|
|
13
|
-
"
|
|
14
|
+
"Plugin settings": "Plugin settings",
|
|
15
|
+
"Role mode": "Role mode",
|
|
14
16
|
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
17
|
+
"Roles & Permissions": "Roles & Permissions",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "The current user has no roles. Please try another account.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "The user role does not exist. Please try signing in again"
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Data sources",
|
|
5
|
+
"Desktop menu": "Desktop menu",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "General",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "New role",
|
|
12
|
+
"Permissions": "Permissions",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "Plugin settings",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Roles & Permissions",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "The current user has no roles. Please try another account.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "The user role does not exist. Please try signing in again"
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Data sources",
|
|
5
|
+
"Desktop menu": "Desktop menu",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "General",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "New role",
|
|
12
|
+
"Permissions": "Permissions",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "Plugin settings",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Roles & Permissions",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "The current user has no roles. Please try another account.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "The user role does not exist. Please try signing in again"
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Adatforrások",
|
|
5
|
+
"Desktop menu": "Asztali menü",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "Általános",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "Új szerepkör",
|
|
12
|
+
"Permissions": "Jogosultságok",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "Bővítmény beállítások",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Szerepkörök és jogosultságok",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "A jelenlegi felhasználónak nincsenek szerepkörei. Kérjük, próbáljon meg egy másik fiókot.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "A felhasználói szerepkör nem létezik. Kérjük, próbáljon meg újra bejelentkezni"
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Sumber data",
|
|
5
|
+
"Desktop menu": "Menu desktop",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "Umum",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "Peran baru",
|
|
12
|
+
"Permissions": "Izin",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "Pengaturan plugin",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Peran & Izin",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "Pengguna saat ini tidak memiliki peran. Harap coba akun lain.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "Peran pengguna tidak ada. Harap coba masuk lagi"
|
|
22
|
+
}
|
package/dist/locale/it-IT.json
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"Permissions": "Permessi",
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Origini dati",
|
|
6
5
|
"Desktop menu": "Menu desktop",
|
|
7
|
-
"
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
8
9
|
"General": "Generale",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "Nuovo ruolo",
|
|
12
|
+
"Permissions": "Permessi",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
9
14
|
"Plugin settings": "Impostazioni plugin",
|
|
10
|
-
"
|
|
11
|
-
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Ruoli e permessi",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "L'utente corrente non ha ruoli. Per favore prova con un altro account.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "Il ruolo utente non esiste. Per favore prova ad accedere nuovamente."
|
|
22
|
+
}
|
package/dist/locale/ja-JP.json
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "データソース",
|
|
5
|
+
"Desktop menu": "デスクトップメニュー",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
7
9
|
"General": "一般",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
8
11
|
"Menu": "メニュー",
|
|
12
|
+
"New role": "新しい役割",
|
|
13
|
+
"Permissions": "権限",
|
|
14
|
+
"Please select role mode": "Please select role mode",
|
|
9
15
|
"Plugin settings": "プラグインの設定",
|
|
10
|
-
"
|
|
16
|
+
"Role mode": "Role mode",
|
|
17
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
18
|
+
"Roles & Permissions": "ロールと権限",
|
|
19
|
+
"Roles union only": "Roles union only",
|
|
20
|
+
"Saved successfully": "Saved successfully",
|
|
21
|
+
"The current user has no roles. Please try another account.": "現在のユーザーには役割がありません。他のアカウントをお試しください。",
|
|
22
|
+
"The user role does not exist. Please try signing in again": "ユーザーの役割が存在しません。もう一度サインインしてください。"
|
|
11
23
|
}
|
package/dist/locale/ko-KR.json
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "데이터 소스",
|
|
5
|
+
"Desktop menu": "데스크탑 메뉴",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "일반",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "새 역할",
|
|
12
|
+
"Permissions": "권한",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "플러그인 설정",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "역할 & 권한",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "현재 사용자는 역할이 없습니다. 다른 계정으로 시도해 주세요.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "사용자 역할이 존재하지 않습니다. 다시 로그인해 주세요."
|
|
22
|
+
}
|
package/dist/locale/nl-NL.json
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Data bronnen",
|
|
5
|
+
"Desktop menu": "Desktop menu",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "Algemeen",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "Nieuwe rol",
|
|
12
|
+
"Permissions": "Permissies",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "Plugin instellingen",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Rollen & Permissies",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "De huidige gebruiker heeft geen rol. Probeer een andere gebruikersaccount.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "De gebruikersrol bestaat niet. Probeer opnieuw in te loggen."
|
|
11
22
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Data sources",
|
|
5
|
+
"Desktop menu": "Desktop menu",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "General",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "New role",
|
|
12
|
+
"Permissions": "Permissions",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "Plugin settings",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Roles & Permissions",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "The current user has no roles. Please try another account.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "The user role does not exist. Please try signing in again"
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow roles union": "Разрешить объединение ролей",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Разрешить пользователям использовать объединение ролей, то есть они могут одновременно использовать права всех своих ролей или переключаться между отдельными ролями.",
|
|
4
|
+
"Data sources": "Источники данных",
|
|
5
|
+
"Desktop menu": "Меню рабочего стола",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Не использовать объединение ролей. Пользователям нужно переключаться между ролями по отдельности.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Принудительно использовать только объединение ролей. Переключение между отдельными ролями недоступно.",
|
|
8
|
+
"Full permissions": "Полные права",
|
|
9
|
+
"General": "Общие",
|
|
10
|
+
"Independent roles": "Независимые роли",
|
|
11
|
+
"New role": "Новая роль",
|
|
12
|
+
"Permissions": "Права доступа",
|
|
13
|
+
"Please select role mode": "Пожалуйста, выберите режим ролей",
|
|
14
|
+
"Plugin settings": "Настройки плагина",
|
|
15
|
+
"Role mode": "Режим ролей",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Роли и разрешения",
|
|
18
|
+
"Roles union only": "Только объединение ролей",
|
|
19
|
+
"Saved successfully": "Успешно сохранено",
|
|
20
|
+
"The current user has no roles. Please try another account.": "У текущего пользователя нет ролей. Попробуйте другой аккаунт.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "Роль пользователя не существует. Попробуйте войти снова."
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Data sources",
|
|
5
|
+
"Desktop menu": "Desktop menu",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "General",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "New role",
|
|
12
|
+
"Permissions": "Permissions",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "Plugin settings",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Roles & Permissions",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "The current user has no roles. Please try another account.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "The user role does not exist. Please try signing in again"
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Data sources",
|
|
5
|
+
"Desktop menu": "Desktop menu",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "General",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "New role",
|
|
12
|
+
"Permissions": "Permissions",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "Plugin settings",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Roles & Permissions",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "The current user has no roles. Please try another account.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "The user role does not exist. Please try signing in again"
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Data sources",
|
|
5
|
+
"Desktop menu": "Desktop menu",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "Tổng quát",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "New role",
|
|
12
|
+
"Permissions": "Quyền",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "Plugin settings",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Roles & Permissions",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "The current user has no roles. Please try another account.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "The user role does not exist. Please try signing in again"
|
|
22
|
+
}
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"Allow roles union": "允许角色并集",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "允许用户使用角色并集,即可以同时使用自己拥有的所有角色的权限,也允许用户逐个切换自己的角色。",
|
|
4
|
+
"Data sources": "数据源",
|
|
5
|
+
"Desktop menu": "桌面端菜单",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "不使用角色并集,用户需要逐个切换自己拥有的角色。",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "强制用户仅能使用角色并集,不能逐个切换角色。",
|
|
8
|
+
"Full permissions": "全部权限",
|
|
9
|
+
"General": "通用",
|
|
10
|
+
"Independent roles": "独立角色",
|
|
4
11
|
"New role": "新建角色",
|
|
5
12
|
"Permissions": "权限",
|
|
6
|
-
"
|
|
7
|
-
"General": "通用",
|
|
8
|
-
"Desktop menu": "桌面端菜单",
|
|
13
|
+
"Please select role mode": "请选择角色模式",
|
|
9
14
|
"Plugin settings": "插件设置",
|
|
10
|
-
"Data sources": "数据源",
|
|
11
|
-
"Independent roles": "独立角色",
|
|
12
|
-
"Allow roles union": "允许角色并集",
|
|
13
|
-
"Roles union only": "仅角色并集",
|
|
14
15
|
"Role mode": "角色模式",
|
|
15
|
-
"Saved successfully": "保存成功",
|
|
16
|
-
"Please select role mode": "请选择角色模式",
|
|
17
|
-
"Full permissions": "全部权限",
|
|
18
16
|
"Role mode doc": "https://docs-cn.nocobase.com/handbook/acl/manual",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
17
|
+
"Roles & Permissions": "角色和权限",
|
|
18
|
+
"Roles union only": "仅角色并集",
|
|
19
|
+
"Saved successfully": "保存成功",
|
|
20
|
+
"The current user has no roles. Please try another account.": "当前用户没有角色,请使用其他账号。",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "用户角色不存在,请尝试重新登录。"
|
|
22
22
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow roles union": "Allow roles union",
|
|
3
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": "Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.",
|
|
4
|
+
"Data sources": "Data sources",
|
|
5
|
+
"Desktop menu": "Desktop menu",
|
|
6
|
+
"Do not use role union. Users need to switch between their roles individually.": "Do not use role union. Users need to switch between their roles individually.",
|
|
7
|
+
"Force users to use only role union. They cannot switch between individual roles.": "Force users to use only role union. They cannot switch between individual roles.",
|
|
8
|
+
"Full permissions": "Full permissions",
|
|
9
|
+
"General": "General",
|
|
10
|
+
"Independent roles": "Independent roles",
|
|
11
|
+
"New role": "New role",
|
|
12
|
+
"Permissions": "Permissions",
|
|
13
|
+
"Please select role mode": "Please select role mode",
|
|
14
|
+
"Plugin settings": "Plugin settings",
|
|
15
|
+
"Role mode": "Role mode",
|
|
16
|
+
"Role mode doc": "https://docs.nocobase.com/handbook/acl/manual",
|
|
17
|
+
"Roles & Permissions": "Roles & Permissions",
|
|
18
|
+
"Roles union only": "Roles union only",
|
|
19
|
+
"Saved successfully": "Saved successfully",
|
|
20
|
+
"The current user has no roles. Please try another account.": "The current user has no roles. Please try another account.",
|
|
21
|
+
"The user role does not exist. Please try signing in again": "The user role does not exist. Please try signing in again"
|
|
22
|
+
}
|
|
@@ -29,6 +29,7 @@ __export(user_setDefaultRole_exports, {
|
|
|
29
29
|
setDefaultRole: () => setDefaultRole
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(user_setDefaultRole_exports);
|
|
32
|
+
var import_constants = require("../constants");
|
|
32
33
|
async function setDefaultRole(ctx, next) {
|
|
33
34
|
const {
|
|
34
35
|
values: { roleName }
|
|
@@ -72,7 +73,7 @@ async function setDefaultRole(ctx, next) {
|
|
|
72
73
|
if (targetUserRole) {
|
|
73
74
|
await repository.model.update({ default: true }, { where: { userId: currentUser.id, roleName }, transaction });
|
|
74
75
|
model = targetUserRole.set("default", true);
|
|
75
|
-
} else {
|
|
76
|
+
} else if (roleName === import_constants.UNION_ROLE_KEY) {
|
|
76
77
|
model = await repository.create({
|
|
77
78
|
values: {
|
|
78
79
|
userId: currentUser.id,
|
|
@@ -82,7 +83,9 @@ async function setDefaultRole(ctx, next) {
|
|
|
82
83
|
transaction
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
+
if (model) {
|
|
87
|
+
db.emitAsync("rolesUsers.afterSave", model);
|
|
88
|
+
}
|
|
86
89
|
});
|
|
87
90
|
ctx.body = "ok";
|
|
88
91
|
await next();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Context, Next } from '@nocobase/actions';
|
|
10
|
+
export declare function checkAssociationOperate(ctx: Context, next: Next): Promise<any>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var check_association_operate_exports = {};
|
|
28
|
+
__export(check_association_operate_exports, {
|
|
29
|
+
checkAssociationOperate: () => checkAssociationOperate
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(check_association_operate_exports);
|
|
32
|
+
var import_acl = require("@nocobase/acl");
|
|
33
|
+
async function checkAssociationOperate(ctx, next) {
|
|
34
|
+
var _a;
|
|
35
|
+
const { actionName, resourceName, sourceId } = ctx.action;
|
|
36
|
+
if (!(resourceName.includes(".") && ["add", "set", "remove", "toggle"].includes(actionName))) {
|
|
37
|
+
return next();
|
|
38
|
+
}
|
|
39
|
+
const acl = ctx.acl;
|
|
40
|
+
const roles = ctx.state.currentRoles;
|
|
41
|
+
for (const role of roles) {
|
|
42
|
+
const aclRole = acl.getRole(role);
|
|
43
|
+
if (aclRole.snippetAllowed(`${resourceName}:${actionName}`)) {
|
|
44
|
+
return next();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const [resource, association] = resourceName.split(".");
|
|
48
|
+
const result = ctx.can({
|
|
49
|
+
roles,
|
|
50
|
+
resource,
|
|
51
|
+
action: "update"
|
|
52
|
+
});
|
|
53
|
+
if (!result) {
|
|
54
|
+
ctx.throw(403, "No permissions");
|
|
55
|
+
}
|
|
56
|
+
const params = result.params || ctx.acl.fixedParamsManager.getParams(resourceName, actionName);
|
|
57
|
+
if (params.whitelist && !((_a = params.whitelist) == null ? void 0 : _a.includes(association))) {
|
|
58
|
+
ctx.throw(403, "No permissions");
|
|
59
|
+
}
|
|
60
|
+
if (params.filter) {
|
|
61
|
+
try {
|
|
62
|
+
const filteredParams = ctx.acl.filterParams(ctx, resource, params);
|
|
63
|
+
const parsedParams = await ctx.acl.parseJsonTemplate(filteredParams, ctx);
|
|
64
|
+
const repo = ctx.db.getRepository(resource);
|
|
65
|
+
const record = await repo.findOne({
|
|
66
|
+
filterByTk: sourceId,
|
|
67
|
+
filter: parsedParams.filter
|
|
68
|
+
});
|
|
69
|
+
if (!record) {
|
|
70
|
+
ctx.throw(403, "No permissions");
|
|
71
|
+
}
|
|
72
|
+
} catch (e) {
|
|
73
|
+
if (e instanceof import_acl.NoPermissionError) {
|
|
74
|
+
ctx.throw(403, "No permissions");
|
|
75
|
+
}
|
|
76
|
+
throw e;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
ctx.permission = {
|
|
80
|
+
...ctx.permission,
|
|
81
|
+
skip: true
|
|
82
|
+
};
|
|
83
|
+
await next();
|
|
84
|
+
}
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
checkAssociationOperate
|
|
88
|
+
});
|
|
@@ -95,10 +95,13 @@ function createWithACLMetaMiddleware() {
|
|
|
95
95
|
return void 0;
|
|
96
96
|
},
|
|
97
97
|
app: {
|
|
98
|
+
dataSourceManager: ctx.app.dataSourceManager,
|
|
98
99
|
getDb() {
|
|
99
100
|
return db;
|
|
100
101
|
}
|
|
101
102
|
},
|
|
103
|
+
log: ctx.log,
|
|
104
|
+
logger: ctx.logger,
|
|
102
105
|
getCurrentRepository: ctx.getCurrentRepository,
|
|
103
106
|
action: {
|
|
104
107
|
actionName: action,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Migration } from '@nocobase/server';
|
|
10
|
+
export default class extends Migration {
|
|
11
|
+
on: string;
|
|
12
|
+
appVersion: string;
|
|
13
|
+
up(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var update_member_default_permission_exports = {};
|
|
28
|
+
__export(update_member_default_permission_exports, {
|
|
29
|
+
default: () => update_member_default_permission_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(update_member_default_permission_exports);
|
|
32
|
+
var import_server = require("@nocobase/server");
|
|
33
|
+
class update_member_default_permission_default extends import_server.Migration {
|
|
34
|
+
on = "afterLoad";
|
|
35
|
+
// 'beforeLoad' or 'afterLoad'
|
|
36
|
+
appVersion = "<2.0.0";
|
|
37
|
+
async up() {
|
|
38
|
+
const repo = this.db.getRepository("roles");
|
|
39
|
+
const role = await repo.findOne({
|
|
40
|
+
filter: {
|
|
41
|
+
name: "member"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
if (!role) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
await repo.update({
|
|
48
|
+
filter: {
|
|
49
|
+
name: role.name
|
|
50
|
+
},
|
|
51
|
+
values: {
|
|
52
|
+
strategy: {
|
|
53
|
+
...role.strategy,
|
|
54
|
+
actions: ["view:own"]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/server/server.js
CHANGED
|
@@ -55,6 +55,7 @@ var import_RoleModel = require("./model/RoleModel");
|
|
|
55
55
|
var import_RoleResourceActionModel = require("./model/RoleResourceActionModel");
|
|
56
56
|
var import_RoleResourceModel = require("./model/RoleResourceModel");
|
|
57
57
|
var import_union_role = require("./actions/union-role");
|
|
58
|
+
var import_check_association_operate = require("./middlewares/check-association-operate");
|
|
58
59
|
class PluginACLServer extends import_server.Plugin {
|
|
59
60
|
get acl() {
|
|
60
61
|
return this.app.acl;
|
|
@@ -387,7 +388,7 @@ class PluginACLServer extends import_server.Plugin {
|
|
|
387
388
|
name: "member",
|
|
388
389
|
title: '{{t("Member")}}',
|
|
389
390
|
allowNewMenu: true,
|
|
390
|
-
strategy: { actions: ["view
|
|
391
|
+
strategy: { actions: ["view:own"] },
|
|
391
392
|
default: true,
|
|
392
393
|
snippets: ["!ui.*", "!pm", "!pm.*"]
|
|
393
394
|
}
|
|
@@ -411,6 +412,16 @@ class PluginACLServer extends import_server.Plugin {
|
|
|
411
412
|
]
|
|
412
413
|
});
|
|
413
414
|
});
|
|
415
|
+
this.app.on("afterStart", async (app) => {
|
|
416
|
+
app.db.on("rolesUsers.beforeSave", async (model) => {
|
|
417
|
+
if (!model._changed.has("roleName")) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
if (model.roleName === "root") {
|
|
421
|
+
throw new Error("No permissions");
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
});
|
|
414
425
|
this.app.on("cache:del:roles", ({ userId }) => {
|
|
415
426
|
this.app.cache.del(`roles:${userId}`);
|
|
416
427
|
});
|
|
@@ -485,8 +496,9 @@ class PluginACLServer extends import_server.Plugin {
|
|
|
485
496
|
} else {
|
|
486
497
|
collection = ctx.db.getCollection(resourceName);
|
|
487
498
|
}
|
|
488
|
-
|
|
489
|
-
|
|
499
|
+
const fields = ctx.permission.can.params.fields;
|
|
500
|
+
if (collection && collection.hasField("createdById") && !fields.includes("createdById")) {
|
|
501
|
+
fields.push("createdById");
|
|
490
502
|
}
|
|
491
503
|
}
|
|
492
504
|
return next();
|
|
@@ -559,6 +571,11 @@ class PluginACLServer extends import_server.Plugin {
|
|
|
559
571
|
},
|
|
560
572
|
{ after: "dataSource", group: "with-acl-meta" }
|
|
561
573
|
);
|
|
574
|
+
this.app.dataSourceManager.afterAddDataSource((dataSource) => {
|
|
575
|
+
dataSource.acl.use(import_check_association_operate.checkAssociationOperate, {
|
|
576
|
+
before: "core"
|
|
577
|
+
});
|
|
578
|
+
});
|
|
562
579
|
this.db.on("afterUpdateCollection", async (collection) => {
|
|
563
580
|
if (collection.options.loadedFromCollectionManager || collection.options.asStrategyResource) {
|
|
564
581
|
this.app.acl.appendStrategyResource(collection.name);
|
package/package.json
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-acl",
|
|
3
3
|
"displayName": "Access control",
|
|
4
|
+
"displayName.ru-RU": "Контроль доступа",
|
|
4
5
|
"displayName.zh-CN": "权限控制",
|
|
5
6
|
"description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.",
|
|
7
|
+
"description.ru-RU": "На основе ролей, ресурсов и действий система контроля доступа может точно управлять разрешениями на изменение интерфейса, работу с данными, доступ к меню и разрешениями для подключаемых модулей.",
|
|
6
8
|
"description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
|
|
7
|
-
"version": "2.0.0-
|
|
9
|
+
"version": "2.0.0-beta.1",
|
|
8
10
|
"license": "AGPL-3.0",
|
|
9
11
|
"main": "./dist/server/index.js",
|
|
10
12
|
"homepage": "https://docs.nocobase.com/handbook/acl",
|
|
13
|
+
"homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/acl",
|
|
11
14
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/acl",
|
|
12
15
|
"keywords": [
|
|
13
16
|
"Users & permissions"
|
|
14
17
|
],
|
|
18
|
+
"nocobase": {
|
|
19
|
+
"defaultEnabled": true
|
|
20
|
+
},
|
|
15
21
|
"devDependencies": {
|
|
16
22
|
"@types/jsonwebtoken": "^9.0.9",
|
|
17
23
|
"jsonwebtoken": "^9.0.2",
|
|
@@ -33,5 +39,5 @@
|
|
|
33
39
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
34
40
|
"directory": "packages/plugins/acl"
|
|
35
41
|
},
|
|
36
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "b3d1f65848fc91e673372ee734dafe6b1cf80586"
|
|
37
43
|
}
|