61 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
Alexandre Bodin
469991f9f2 Merge branch 'master' into features/i18n 2021-02-18 14:36:32 +01:00
Convly
9f01afca88 Add useSSORegistration option for gold users on admin creation 2021-02-10 11:57:11 +01:00
Pierre Noël
ce3482025a add preferedLanguage 2021-02-08 15:03:12 +01:00
Alexandre Bodin
07e7cfc0bd Make lint stricter and fix the errors
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-11-02 19:41:42 +01: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
Jean-Sébastien Herbaux
e77679e7bb
Fix author role for the publish permission action (#8153)
* Prevent Author role to have access to the publish permission in CE

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

* Fix CE test on role's permissions update

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

* Fix unit tests

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-10-02 18:34:13 +02:00
Convly
a5df905e00 Fix pr comments
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-09-22 17:39:17 +02:00
Convly
a559047e77 Fix e2e and unit tests
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-09-22 17:39:17 +02:00
Convly
28beaaa932 Refactor validators and add better messages
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-09-22 17:39:16 +02:00
Convly
72aaa16d3d Rename fieldsGranularity to fieldsRestriction, various bug fixes
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-09-22 17:39:14 +02:00
Convly
310a0d16f3 Add Publish permission & action
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-09-22 17:39:14 +02:00
Bobby Glidwell
5af64a3837
set email validator to lowercase (#7645)
* set email validator to lowercase

Yup .lowercase() converts the string to lowercase which should be done in all instances of email across the application.

Fixes bug where users created inside Strapi admin panel end up with mixed case emails in database.

Signed-off-by: bglidwell <sintex+github@gmail.com>

* match front-end profile validation to backend

Removed .min(5) from backend validation due to redundancy with .email() check

Signed-off-by: bglidwell <sintex+github@gmail.com>

* cleanup redundant email.toLowerCase()

Signed-off-by: Bobby Glidwell <sintex+github@gmail.com>

* Revert "cleanup redundant email.toLowerCase()"

This reverts commit 4565054b298e4518e4ddf41ca602c5960bd9cc28.

Signed-off-by: Bobby Glidwell <sintex+github@gmail.com>

* fix email case in admin user controller

Signed-off-by: Bobby Glidwell <sintex+github@gmail.com>

* fix email case in api user controller

Signed-off-by: Bobby Glidwell <sintex+github@gmail.com>

* fix for graphql tests

Signed-off-by: Bobby Glidwell <sintex+github@gmail.com>
2020-09-14 09:30:12 +02:00
Pierre Noël
9983d3b44e clean conditions at get and update
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-20 17:40:01 +02:00
soupette
11afd28f35 Allow name edition in CE
Signed-off-by: soupette <cyril.lpz@gmail.com>
2020-07-17 12:37:21 +02:00
Pierre Noël
c73aadbed5 add batch delete for users
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-16 12:57:54 +02:00
Alexandre Bodin
8d92bf8a0a Add min validator
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-07-09 18:10:16 +02:00
Convly
11ba971302 Rework policy handling, add util to create policy factories, allow array declaration for hasPermissions
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-07-08 11:48:16 +02:00
Convly
b3f602d207 Rework policies resolving (allow policy generators) / Add hasPermissions policy
Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
2020-07-08 11:48:16 +02:00
Pierre Noël
96c68df220 simplify validator
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:47:46 +02:00
Pierre Noël
4d4c7678c0 refacto
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:47:46 +02:00
Pierre Noël
f5a0308d5c filter instead of slice
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:47:45 +02:00
Pierre Noël
d6536ba556 handle fields null for delete perm
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:47:45 +02:00
Pierre Noël
b6a5e78fe3 fix bad nesting
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:47:19 +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
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
6ab7669365 rename plugins::content-manager.create to plugins::content-manager.explorer.create and others
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:51 +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
8c1aa2999a fix tests
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:09:51 +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
Convly
765d7aaa52 Add check many permissions route/controller / Add userAbility to the context's state / Add isAuthenticatedAdmin.js
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
3aec039698 refacto
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:05:09 +02:00
Pierre Noël
91a7f1a6cb remove use of conditions inside actions
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:05:09 +02:00
Pierre Noël
42e3b64689 refacto
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:05:08 +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
ae0dcb9745 add route GET /admin/permissions
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
Convly
d69101427f Fix PR: Refactor user e2e tests, fix domain logic, add user::deleteOne route 2020-07-08 11:04:22 +02:00
Convly
65f0e7e3f3 Use custom type for strapiID & move it to strapi-utils 2020-07-08 11:04:21 +02:00
Convly
483457cafd Add GET /admin/users/:id route 2020-07-08 11:04:21 +02:00
Convly
ede7fd0b90 Add custom strapiID type to yup 2020-07-08 11:04:20 +02:00
Convly
6897cbf6ad Add update user route in the user api 2020-07-08 11:04:20 +02:00
Alexandre Bodin
7346b983c5 Add domain model for permission
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-07-08 10:59:37 +02:00
Alexandre Bodin
c6e08dcb57 Add assign permission
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-07-08 10:59:37 +02:00
Pierre Noël
9d431ee8ff add single delete + refacto batch-delete
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 10:58:07 +02:00
Pierre Noël
308beddb24 add DELETE /admin/roles
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 10:58:07 +02:00