adminizer 4.3.0-build.135 → 4.3.0-build.136

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.
@@ -53,6 +53,9 @@ export default async function login(req, res) {
53
53
  //Here we use the captchaSolution key to output messages unrelated to the form fields.
54
54
  return inertiaAdminMessage(req, "Profile expired, contact the administrator", 'captchaSolution');
55
55
  }
56
+ if (!req.adminizer.accessRightsHelper.hasPermission('access-to-adminpanel', user)) {
57
+ return inertiaAdminMessage(req, "The user is not allowed to enter, please contact the administrator", 'captchaSolution');
58
+ }
56
59
  const token = signUser(user, req.adminizer.jwtSecret);
57
60
  res.setHeader('Set-Cookie', serialize('adminizer_jwt', token, {
58
61
  httpOnly: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.3.0-build.135",
4
+ "version": "4.3.0-build.136",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": "./index.js",
@@ -60,6 +60,13 @@ export default async function bindAccessRights(adminizer) {
60
60
  id: `widgets`, name: "Widgets",
61
61
  description: "Access to widgets", department: "Widgets"
62
62
  });
63
+ // Allow access login
64
+ adminizer.accessRightsHelper.registerToken({
65
+ id: 'access-to-adminpanel',
66
+ name: "Allowed log in",
67
+ description: "Are users allowed to log in to the admin panel?",
68
+ department: "Admin panel"
69
+ });
63
70
  // Default user group
64
71
  if (adminizer.config.registration && adminizer.config.registration.enable) {
65
72
  // TODO refactor CRUD functions for DataAccessor usage