kuzzle 2.54.4 → 2.55.0

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.
@@ -307,6 +307,14 @@ export default class SecurityController extends NativeController {
307
307
  * @returns {Promise<Object>}
308
308
  */
309
309
  createFirstAdmin(request: KuzzleRequest): Promise<import("../../types/core/auth/formatProcessing.type").Serialized<import("../../model/security/user").User>>;
310
+ /**
311
+ * Restricted rights are applied to the `anonymous` and `default` roles
312
+ * (by default, these roles don't have any restriction).
313
+ *
314
+ * The default permissions can be found in the default configuration
315
+ * and can be modified in the `kuzzlerc`.
316
+ */
317
+ restrictDefaultRights(request: KuzzleRequest): Promise<void>;
310
318
  /**
311
319
  * Deletes multiple profiles
312
320
  *
@@ -70,6 +70,7 @@ class SecurityController extends baseController_1.NativeController {
70
70
  "createApiKey",
71
71
  "createCredentials",
72
72
  "createFirstAdmin",
73
+ "restrictDefaultRights",
73
74
  "createOrReplaceProfile",
74
75
  "createOrReplaceRole",
75
76
  "createProfile",
@@ -791,16 +792,28 @@ class SecurityController extends baseController_1.NativeController {
791
792
  humanReadableId,
792
793
  });
793
794
  if (reset) {
794
- for (const type of ["role", "profile"]) {
795
- await bluebird_1.default.map(Object.entries(global.kuzzle.config.security.standard[`${type}s`]), ([name, value]) => this.ask(`core:security:${type}:createOrReplace`, name, value, {
796
- refresh: "wait_for",
797
- userId,
798
- }));
799
- }
795
+ await this.restrictDefaultRights(request);
800
796
  }
801
797
  this.logger.info(`[SECURITY] ${SecurityController.userOrSdk(userId)} applied action "${request.input.action}".`);
802
798
  return user;
803
799
  }
800
+ /**
801
+ * Restricted rights are applied to the `anonymous` and `default` roles
802
+ * (by default, these roles don't have any restriction).
803
+ *
804
+ * The default permissions can be found in the default configuration
805
+ * and can be modified in the `kuzzlerc`.
806
+ */
807
+ async restrictDefaultRights(request) {
808
+ const userId = request.getKuid();
809
+ for (const type of ["role", "profile"]) {
810
+ await bluebird_1.default.map(Object.entries(global.kuzzle.config.security.standard[`${type}s`]), ([name, value]) => this.ask(`core:security:${type}:createOrReplace`, name, value, {
811
+ refresh: "wait_for",
812
+ userId,
813
+ }));
814
+ }
815
+ this.logger.info(`[SECURITY] ${SecurityController.userOrSdk(userId)} restricted rights of the default roles.`);
816
+ }
804
817
  /**
805
818
  * Deletes multiple profiles
806
819
  *
@@ -804,6 +804,12 @@ const routes = [
804
804
  controller: "security",
805
805
  action: "createFirstAdmin",
806
806
  },
807
+ {
808
+ verb: "post",
809
+ path: "/_restrictDefaultRights",
810
+ controller: "security",
811
+ action: "restrictDefaultRights",
812
+ },
807
813
  {
808
814
  verb: "post",
809
815
  path: "/credentials/:strategy/:_id/_create",
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kuzzle",
3
3
  "author": "The Kuzzle Team <support@kuzzle.io>",
4
- "version": "2.54.4",
4
+ "version": "2.55.0",
5
5
  "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.",
6
6
  "scripts": {
7
7
  "build": "rm -Rf ./dist && tsc && node ./bin/copy-binaries.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kuzzle",
3
3
  "author": "The Kuzzle Team <support@kuzzle.io>",
4
- "version": "2.54.4",
4
+ "version": "2.55.0",
5
5
  "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.",
6
6
  "scripts": {
7
7
  "build": "rm -Rf ./dist && tsc && node ./bin/copy-binaries.js",