@strapi/plugin-users-permissions 0.0.0-next.dff425769af4d4d006725a10c395f59637403653 → 0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71

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.
@@ -28,11 +28,12 @@ import {
28
28
  useQueryParams,
29
29
  EmptyStateLayout,
30
30
  ConfirmDialog,
31
+ useFilter,
32
+ useCollator,
31
33
  } from '@strapi/helper-plugin';
32
34
  import { useIntl } from 'react-intl';
33
35
  import { useHistory } from 'react-router-dom';
34
36
  import { useMutation, useQuery, useQueryClient } from 'react-query';
35
- import matchSorter from 'match-sorter';
36
37
 
37
38
  import { fetchData, deleteData } from './utils/api';
38
39
  import { getTrad } from '../../../utils';
@@ -42,7 +43,7 @@ import TableBody from './components/TableBody';
42
43
 
43
44
  const RoleListPage = () => {
44
45
  const { trackUsage } = useTracking();
45
- const { formatMessage } = useIntl();
46
+ const { formatMessage, locale } = useIntl();
46
47
  const { push } = useHistory();
47
48
  const toggleNotification = useNotification();
48
49
  const { notifyStatus } = useNotifyAT();
@@ -78,6 +79,17 @@ const RoleListPage = () => {
78
79
  enabled: canRead,
79
80
  });
80
81
 
82
+ const { includes } = useFilter(locale, {
83
+ sensitivity: 'base',
84
+ });
85
+
86
+ /**
87
+ * @type {Intl.Collator}
88
+ */
89
+ const formatter = useCollator(locale, {
90
+ sensitivity: 'base',
91
+ });
92
+
81
93
  const isLoading = isLoadingForData || isFetching;
82
94
 
83
95
  const handleNewRoleClick = () => {
@@ -118,7 +130,12 @@ const RoleListPage = () => {
118
130
  setIsConfirmButtonLoading(false);
119
131
  };
120
132
 
121
- const sortedRoles = matchSorter(roles || [], _q, { keys: ['name', 'description'] });
133
+ const sortedRoles = (roles || [])
134
+ .filter((role) => includes(role.name, _q) || includes(role.description, _q))
135
+ .sort(
136
+ (a, b) => formatter.compare(a.name, b.name) || formatter.compare(a.description, b.description)
137
+ );
138
+
122
139
  const emptyContent = _q && !sortedRoles.length ? 'search' : 'roles';
123
140
 
124
141
  const colCount = 4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "0.0.0-next.dff425769af4d4d006725a10c395f59637403653",
3
+ "version": "0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@strapi/design-system": "1.6.6",
33
- "@strapi/helper-plugin": "0.0.0-next.dff425769af4d4d006725a10c395f59637403653",
33
+ "@strapi/helper-plugin": "0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71",
34
34
  "@strapi/icons": "1.6.6",
35
- "@strapi/utils": "0.0.0-next.dff425769af4d4d006725a10c395f59637403653",
35
+ "@strapi/utils": "0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71",
36
36
  "bcryptjs": "2.4.3",
37
37
  "formik": "2.2.9",
38
38
  "grant-koa": "5.4.8",
@@ -42,7 +42,6 @@
42
42
  "koa": "^2.13.4",
43
43
  "koa2-ratelimit": "^1.1.2",
44
44
  "lodash": "4.17.21",
45
- "match-sorter": "^4.0.2",
46
45
  "prop-types": "^15.7.2",
47
46
  "purest": "4.0.2",
48
47
  "react-intl": "6.3.2",
@@ -81,5 +80,5 @@
81
80
  "required": true,
82
81
  "kind": "plugin"
83
82
  },
84
- "gitHead": "dff425769af4d4d006725a10c395f59637403653"
83
+ "gitHead": "f45143c5e2a8a9d85691d0abf79a3f42024a0c71"
85
84
  }
@@ -280,6 +280,12 @@ module.exports = {
280
280
  'confirmationToken',
281
281
  'resetPasswordToken',
282
282
  'provider',
283
+ 'id',
284
+ 'createdAt',
285
+ 'updatedAt',
286
+ 'createdBy',
287
+ 'updatedBy',
288
+ 'role',
283
289
  ]),
284
290
  provider: 'local',
285
291
  };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const { castArray, map, every, pipe } = require('lodash/fp');
3
+ const { castArray, map, every, pipe, isEmpty } = require('lodash/fp');
4
4
  const { ForbiddenError, UnauthorizedError } = require('@strapi/utils').errors;
5
5
 
6
6
  const { getService } = require('../utils');
@@ -80,6 +80,13 @@ const authenticate = async (ctx) => {
80
80
  const verify = async (auth, config) => {
81
81
  const { credentials: user, ability } = auth;
82
82
 
83
+ strapi.telemetry.send('didReceiveAPIRequest', {
84
+ eventProperties: {
85
+ authenticationMethod: auth?.strategy?.name,
86
+ isAuthenticated: !isEmpty(user),
87
+ },
88
+ });
89
+
83
90
  if (!config.scope) {
84
91
  if (!user) {
85
92
  // A non authenticated user cannot access routes that do not have a scope