@universis/janitor 2.5.0 → 2.5.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/README.md +20 -0
- package/dist/index.esm.js +24 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/EnableReadAccessScope.js +24 -0
package/package.json
CHANGED
|
@@ -87,6 +87,30 @@ class EnableReadAccessScope extends ApplicationService {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
// get views with scope based privileges
|
|
92
|
+
// noinspection JSUnresolvedReference
|
|
93
|
+
if (Array.isArray(definition.views)) {
|
|
94
|
+
// noinspection JSUnresolvedReference
|
|
95
|
+
const views = definition.views.filter((item) => {
|
|
96
|
+
return Array.isArray(item.privileges);
|
|
97
|
+
});
|
|
98
|
+
for (const view of views) {
|
|
99
|
+
const privileges = view.privileges.filter((privilege) => {
|
|
100
|
+
return privilege.mask === 1 && Array.isArray(privilege.scope) && privilege.scope.includes(searchScope);
|
|
101
|
+
});
|
|
102
|
+
if (privileges.length > 0) {
|
|
103
|
+
shouldUpdate = true;
|
|
104
|
+
for (const privilege of privileges) {
|
|
105
|
+
if (!privilege.scope.includes((targetScope))) {
|
|
106
|
+
privilege.scope.push(targetScope);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
90
114
|
if (shouldUpdate) {
|
|
91
115
|
updated++;
|
|
92
116
|
// update model definition
|