@visns-studio/visns-components 1.4.5 → 1.4.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.
@@ -130,14 +130,25 @@ function Navigation({ logo, logout, navConfig, setSystemAuth, userProfile }) {
130
130
  const permissions = userProfile.roles[0].permissions;
131
131
 
132
132
  setNavData((prevNavData) => {
133
- const updatedNavData = prevNavData.navigations.map((nav) => ({
133
+ const updatedNavigations = prevNavData.navigations.map((nav) => ({
134
134
  ...nav,
135
135
  permission: permissions.some(
136
136
  (permission) => permission.name === nav.permissionKey
137
137
  ),
138
138
  }));
139
139
 
140
- return { ...prevNavData, navigations: updatedNavData };
140
+ const updatedSettings = prevNavData.settings.map((nav) => ({
141
+ ...nav,
142
+ permission: permissions.some(
143
+ (permission) => permission.name === nav.permissionKey
144
+ ),
145
+ }));
146
+
147
+ return {
148
+ ...prevNavData,
149
+ navigations: updatedNavigations,
150
+ settings: updatedSettings,
151
+ };
141
152
  });
142
153
  }, [userProfile]);
143
154
 
@@ -185,11 +196,14 @@ function Navigation({ logo, logout, navConfig, setSystemAuth, userProfile }) {
185
196
  </div>
186
197
  <div className="hactions">
187
198
  <ul>
188
- {navData.settings.map((setting, settingKey) => (
189
- <React.Fragment key={`setting-${settingKey}`}>
190
- {renderSetting(setting)}
191
- </React.Fragment>
192
- ))}
199
+ {navData.settings.map((setting, settingKey) =>
200
+ nav.permission === true ||
201
+ nav.permissionKey === "" ? (
202
+ <React.Fragment key={`setting-${settingKey}`}>
203
+ {renderSetting(setting)}
204
+ </React.Fragment>
205
+ ) : null
206
+ )}
193
207
  </ul>
194
208
  </div>
195
209
  </div>
package/package.json CHANGED
@@ -34,7 +34,7 @@
34
34
  "react-dom": "^17.0.1"
35
35
  },
36
36
  "name": "@visns-studio/visns-components",
37
- "version": "1.4.5",
37
+ "version": "1.4.6",
38
38
  "description": "Various packages to assist in the development of our Custom Applications.",
39
39
  "main": "index.js",
40
40
  "devDependencies": {},