mushroom-cli 1.2.0-alpha.10 → 1.2.0-alpha.11

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 CHANGED
@@ -132,6 +132,18 @@ npx mushroom-cli parameters --no-check-update
132
132
 
133
133
  ## Version
134
134
 
135
+ ### 1.2.0-alpha.11
136
+
137
+ Improvement:
138
+
139
+ * gen-docs:
140
+ * allow user add and change API root url
141
+ * filter role list
142
+ * fornat cURL to easy to copy and paste to Postman
143
+ * lighten font on MacOS
144
+ * gen-ts:
145
+ * export type for object fields
146
+
135
147
  ### 1.2.0-alpha.10
136
148
 
137
149
  Improvement:
package/common.js CHANGED
@@ -49,7 +49,7 @@ function getEntities(projectApiConfiguration, roles, getAll) {
49
49
  if (!action.grant || !action.enabled || action.codeHint && action.codeHint.disabled)
50
50
  return;
51
51
 
52
- var allow = roles.indexOf("*") !== -1 || action.grant === "*";
52
+ var allow = roles.includes("*") || action.grant === "*";
53
53
 
54
54
  if (!allow)
55
55
  action.grant.split("|").forEach(function (roleGroup) {
@@ -129,6 +129,15 @@ function getEntities(projectApiConfiguration, roles, getAll) {
129
129
  return entities;
130
130
  }
131
131
 
132
+ function filterRoles(roleList, allowRoleList) {
133
+ const roles = !allowRoleList || allowRoleList.includes("*") ? [...roleList] : roleList.filter(role => allowRoleList.includes(role.name));
134
+ roles.push({
135
+ name: "[Mọi người dùng]",
136
+ description: "Tất cả người dùng (kể cả chưa đăng nhập)"
137
+ });
138
+ return roles;
139
+ }
140
+
132
141
  function processTemplate(basePath, templatePath) {
133
142
  const templateJsonContent = fs.readFileSync(path.join(basePath, templatePath)).toString();
134
143
  const template = JSON.parse(templateJsonContent);
@@ -269,5 +278,6 @@ module.exports = {
269
278
  ensureFolder: ensureFolder,
270
279
  getRootUrl: getRootUrl,
271
280
  getEntities: getEntities,
281
+ filterRoles:filterRoles,
272
282
  processTemplate: processTemplate
273
283
  };