32 Commits

Author SHA1 Message Date
Jean-Sébastien Herbaux
1e5b1c99f6
I18n/ permissions rework (#9535)
* Add a domain layer for the permission, rework the engine handling of the permissions

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Add permissions-fields-to-properties migration for the admin

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Removes useless console.log

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Remove debug logLevel from provider-login.test.e2e.js

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Adds the new layout for the GET permissions, allow to subscribe to actionRegistered events, adds i18n handlers

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Fix typo

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Update permissions validators

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Update unit tests

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Update integrations test + fix some validation issues

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Change plugins & settings section format for the permissions layout

* only return locales property to localized subjects for the permission's layout

* Do not send the locales property to the permission's layout when there is no locales created

* Add the 'locales' property to publish & delete routes

* Fix unwanted mutation of the sections builder states on multiple builds

* Fix units tests with (new engine)

* Fix admin-role e2e test - Add locales property to the update payload

* fix e2e testsé

* Update e2e snapshots

* Fix unit test for i18n bootstrap

* Add mocks for i18n/bootstrap test

* Fix has-locale condition & updatePermission validator

* Avoid mutation in migration, always authorize super admin for has-locales condition

* Rework rbac domain objects, add a hook module and a provider factory

* Remove old providers

* Update the admin services & tests for the new rbac domain & providers

* Fix tests, bootstrap functions & services following rbac domain rework

* Update migration runner

* PR comments

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Remove useless console.log

* Fix sanitizeCondition bug

* Section builder rework

* Add test for the section-builder section & add jsdoc for the permission domain

* pr comments (without the migrations)

* fix fields-to-properties migration

* Add jsdoc for the sections-builder

* Moves createBoundAbstractDomain from permission domain to the engine service

* Remove debug logLevel for admin role test (e2e)

* Fix core-store

* Fix hooks & move business logic from i18n bootstrap to dedicated services

* add route get-non-localized-fields

* use write and read permission

* refacto

* add input validator

* add route doc

* handle ST

Co-authored-by: Pierre Noël <petersg83@gmail.com>
Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com>
2021-03-25 14:59:44 +01:00
Convly
531c926dfd Authentication events, sso gold only 2021-01-27 11:52:02 +01:00
Convly
5228236246 Merge branch 'master' into features/sso 2021-01-12 11:36:11 +01:00
Convly
c3a2c7024d PR review adjustments 2021-01-08 10:09:10 +01:00
Convly
c8a3d29e9c Reimplements register checks / Clear the maps on admin destroy
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2021-01-08 10:09:07 +01:00
Convly
2f7615092a Fix snapshots
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2021-01-08 10:09:06 +01:00
Convly
62b52a604d Provider's connection implementation
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-12-28 15:05:24 +01:00
Pierre Noël
907d6c9d33 refacto
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-10-19 17:01:46 +02:00
Jean-Sébastien Herbaux
eb5a94501e
Ensure bound permissions in database (#8180)
* Ensure bound permissions in database

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>

* Refactor, handle missing fields & fix e2e tests

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-10-05 16:26:55 +02:00
Pierre Noël
2be4f8047a migrate users for new column isActive
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:48:15 +02:00
Pierre Noël
047a0be908 move function from bootstrap to service
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:10:11 +02:00
Pierre Noël
1ee5b7f189 fifth refacto
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:10:09 +02:00
Pierre Noël
8598cee8d0 fourth refacto
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:52 +02:00
Pierre Noël
6a1d65bc37 third refacto
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:52 +02:00
Pierre Noël
243c4ccc4e add upload permissions to default roles + second refacto
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:52 +02:00
Pierre Noël
dd88c00514 use new condition format
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:52 +02:00
Pierre Noël
b893501552 first refacto
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:51 +02:00
Pierre Noël
93fc900e10 create admin permissions at startup
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:50 +02:00
Pierre Noël
3b8cab0621 add conditions logic for author/editor
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:50 +02:00
Pierre Noël
a6e090d991 prevent modification and delete of super admin role
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:49 +02:00
Pierre Noël
711c58b05e create role at startup + warning
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:49 +02:00
Alexandre Bodin
a83c34e72e Add default category
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-07-08 11:09:45 +02:00
Alexandre Bodin
24d4bad10c Add displayName
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-07-08 11:09:45 +02:00
Convly
ed6a68d9be Add category to conditions
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-07-08 11:09:45 +02:00
Convly
e745903112 Fix pr comments
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-07-08 11:09:44 +02:00
Convly
27c2ff9c0a Add /admin/users/me/permissions route (+ findUserPermissions & sanitizePermission)
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-07-08 11:05:50 +02:00
Convly
ef94229d81 Add Condition Provider & Permissions Engine 2020-07-08 11:05:49 +02:00
Pierre Noël
7e1a91dda6 add use strict
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:05:08 +02:00
Pierre Noël
0330aba229 clean permissions in db at startup
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:05:07 +02:00
Pierre Noël
e078c0b022 rename permissions to actions, inverted params of provider.get, separated formatter, add possibility to not specigy pluginName for ::application
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:05:07 +02:00
Pierre Noël
707746ef45 refacto
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:05:06 +02:00
Pierre Noël
5fffffa72d add permission registry provider
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:05:06 +02:00