@strapi/plugin-users-permissions 4.0.0-beta.1 → 4.0.0-beta.5

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.
@@ -4,7 +4,7 @@ import styled from 'styled-components';
4
4
  import PropTypes from 'prop-types';
5
5
  import { Box } from '@strapi/parts/Box';
6
6
  import { Checkbox } from '@strapi/parts/Checkbox';
7
- import { Row } from '@strapi/parts/Row';
7
+ import { Flex } from '@strapi/parts/Flex';
8
8
  import { TableLabel } from '@strapi/parts/Text';
9
9
  import { Grid, GridItem } from '@strapi/parts/Grid';
10
10
  import CogIcon from '@strapi/icons/Cog';
@@ -59,7 +59,7 @@ const SubCategory = ({ subCategory }) => {
59
59
 
60
60
  return (
61
61
  <Box>
62
- <Row justifyContent="space-between" alignItems="center">
62
+ <Flex justifyContent="space-between" alignItems="center">
63
63
  <Box paddingRight={4}>
64
64
  <TableLabel textColor="neutral600">{subCategory.label}</TableLabel>
65
65
  </Box>
@@ -75,8 +75,8 @@ const SubCategory = ({ subCategory }) => {
75
75
  {formatMessage({ id: 'app.utils.select-all', defaultMessage: 'Select all' })}
76
76
  </Checkbox>
77
77
  </Box>
78
- </Row>
79
- <Row paddingTop={6} paddingBottom={6}>
78
+ </Flex>
79
+ <Flex paddingTop={6} paddingBottom={6}>
80
80
  <Grid gap={2} style={{ flex: 1 }}>
81
81
  {subCategory.actions.map(action => {
82
82
  const name = `${action.name}.enabled`;
@@ -104,7 +104,7 @@ const SubCategory = ({ subCategory }) => {
104
104
  );
105
105
  })}
106
106
  </Grid>
107
- </Row>
107
+ </Flex>
108
108
  </Box>
109
109
  );
110
110
  };
@@ -1,6 +1,7 @@
1
1
  import React, { memo, useCallback, useReducer } from 'react';
2
2
  import { Accordion, AccordionToggle, AccordionContent } from '@strapi/parts/Accordion';
3
3
  import { useIntl } from 'react-intl';
4
+ import { Box } from '@strapi/parts/Box';
4
5
  import { useUsersPermissions } from '../../contexts/UsersPermissionsContext';
5
6
  import formatPluginName from '../../utils/formatPluginName';
6
7
  import PermissionRow from './PermissionRow';
@@ -41,7 +42,9 @@ const Permissions = () => {
41
42
  variant={index % 2 ? 'primary' : 'secondary'}
42
43
  />
43
44
  <AccordionContent>
44
- <PermissionRow permissions={modifiedData[collapse.name]} name={collapse.name} />
45
+ <Box background="neutral0">
46
+ <PermissionRow permissions={modifiedData[collapse.name]} name={collapse.name} />
47
+ </Box>
45
48
  </AccordionContent>
46
49
  </Accordion>
47
50
  ))}
@@ -6,13 +6,10 @@
6
6
  // IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
7
7
  import { prefixPluginTranslations } from '@strapi/helper-plugin';
8
8
  import pluginPkg from '../../package.json';
9
- import pluginLogo from './assets/images/logo.svg';
10
9
  import pluginPermissions from './permissions';
11
10
  import pluginId from './pluginId';
12
11
  import getTrad from './utils/getTrad';
13
12
 
14
- const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
15
- const icon = pluginPkg.strapi.icon;
16
13
  const name = pluginPkg.strapi.name;
17
14
 
18
15
  export default {
@@ -95,13 +92,8 @@ export default {
95
92
  );
96
93
 
97
94
  app.registerPlugin({
98
- description: pluginDescription,
99
- icon,
100
95
  id: pluginId,
101
- isReady: true,
102
- isRequired: pluginPkg.strapi.required || false,
103
96
  name,
104
- pluginLogo,
105
97
  });
106
98
  },
107
99
  bootstrap() {},
@@ -18,4 +18,4 @@ export const fetchData = async toggleNotification => {
18
18
 
19
19
  export const putProvider = body => {
20
20
  return axiosInstance.put(getRequestURL('providers'), body);
21
- }
21
+ };
@@ -7,7 +7,9 @@ import { Box } from '@strapi/parts/Box';
7
7
  import { TextInput } from '@strapi/parts/TextInput';
8
8
  import { Textarea } from '@strapi/parts/Textarea';
9
9
  import { H3 } from '@strapi/parts/Text';
10
+ import BackIcon from '@strapi/icons/BackIcon';
10
11
  import CheckIcon from '@strapi/icons/CheckIcon';
12
+ import { Link } from '@strapi/parts/Link';
11
13
  import { GridItem, Grid } from '@strapi/parts/Grid';
12
14
  import { Formik } from 'formik';
13
15
  import { useIntl } from 'react-intl';
@@ -103,6 +105,14 @@ const EditPage = () => {
103
105
  }
104
106
  title={role.name}
105
107
  subtitle={role.description}
108
+ navigationAction={
109
+ <Link startIcon={<BackIcon />} to="/settings/users-permissions/roles">
110
+ {formatMessage({
111
+ id: 'app.components.go-back',
112
+ defaultMessage: 'Go back',
113
+ })}
114
+ </Link>
115
+ }
106
116
  />
107
117
  <ContentLayout>
108
118
  <Stack size={7}>
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { IconButton, Tbody, Text, Tr, Td, Row } from '@strapi/parts';
3
+ import { IconButton } from '@strapi/parts/IconButton';
4
+ import { Text } from '@strapi/parts/Text';
5
+ import { Flex } from '@strapi/parts/Flex';
6
+ import { Tbody, Tr, Td } from '@strapi/parts/Table';
4
7
  import { EditIcon, DeleteIcon } from '@strapi/icons';
5
8
  import { CheckPermissions, onRowClick, stopPropagation } from '@strapi/helper-plugin';
6
9
  import { useIntl } from 'react-intl';
@@ -44,7 +47,7 @@ const TableBody = ({ sortedRoles, canDelete, permissions, setRoleToDelete, onDel
44
47
  </Text>
45
48
  </Td>
46
49
  <Td>
47
- <Row justifyContent="end" {...stopPropagation}>
50
+ <Flex justifyContent="end" {...stopPropagation}>
48
51
  <CheckPermissions permissions={permissions.updateRole}>
49
52
  <IconButton
50
53
  onClick={() => handleClickEdit(role.id)}
@@ -69,7 +72,7 @@ const TableBody = ({ sortedRoles, canDelete, permissions, setRoleToDelete, onDel
69
72
  />
70
73
  </CheckPermissions>
71
74
  )}
72
- </Row>
75
+ </Flex>
73
76
  </Td>
74
77
  </Tr>
75
78
  ))}
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.5",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
5
  "strapi": {
6
6
  "displayName": "Roles & Permissions",
7
7
  "name": "users-permissions",
8
- "icon": "users",
9
8
  "description": "users-permissions.plugin.description",
10
9
  "required": true,
11
10
  "kind": "plugin"
@@ -15,9 +14,9 @@
15
14
  },
16
15
  "dependencies": {
17
16
  "@purest/providers": "^1.0.2",
18
- "@strapi/helper-plugin": "4.0.0-beta.1",
19
- "@strapi/utils": "4.0.0-beta.1",
20
- "bcryptjs": "^2.4.3",
17
+ "@strapi/helper-plugin": "4.0.0-beta.5",
18
+ "@strapi/utils": "4.0.0-beta.5",
19
+ "bcryptjs": "2.4.3",
21
20
  "grant-koa": "5.4.8",
22
21
  "jsonwebtoken": "^8.1.0",
23
22
  "koa2-ratelimit": "^0.9.0",
@@ -58,5 +57,5 @@
58
57
  "npm": ">=6.0.0"
59
58
  },
60
59
  "license": "SEE LICENSE IN LICENSE",
61
- "gitHead": "5e341674da4f2ef1b99a910e92128674658a80de"
60
+ "gitHead": "7e7365d347e181b34496a2ff09d810b8c43a2dcf"
62
61
  }
@@ -37,9 +37,12 @@ module.exports = async ({ strapi }) => {
37
37
  };
38
38
 
39
39
  const initGrant = async pluginStore => {
40
+ const apiPrefix = strapi.config.get('api.rest.prefix');
41
+ const baseURL = `${strapi.config.server.url}/${apiPrefix}/auth`;
42
+
40
43
  const grantConfig = {
41
44
  defaults: {
42
- prefix: '/api/connect',
45
+ prefix: `${apiPrefix}/connect`,
43
46
  },
44
47
  email: {
45
48
  enabled: true,
@@ -50,7 +53,7 @@ const initGrant = async pluginStore => {
50
53
  icon: 'discord',
51
54
  key: '',
52
55
  secret: '',
53
- callback: `${strapi.config.server.url}/api/auth/discord/callback`,
56
+ callback: `${baseURL}/discord/callback`,
54
57
  scope: ['identify', 'email'],
55
58
  },
56
59
  facebook: {
@@ -58,7 +61,7 @@ const initGrant = async pluginStore => {
58
61
  icon: 'facebook-square',
59
62
  key: '',
60
63
  secret: '',
61
- callback: `${strapi.config.server.url}/api/auth/facebook/callback`,
64
+ callback: `${baseURL}/facebook/callback`,
62
65
  scope: ['email'],
63
66
  },
64
67
  google: {
@@ -66,7 +69,7 @@ const initGrant = async pluginStore => {
66
69
  icon: 'google',
67
70
  key: '',
68
71
  secret: '',
69
- callback: `${strapi.config.server.url}/api/auth/google/callback`,
72
+ callback: `${baseURL}/google/callback`,
70
73
  scope: ['email'],
71
74
  },
72
75
  github: {
@@ -74,7 +77,7 @@ const initGrant = async pluginStore => {
74
77
  icon: 'github',
75
78
  key: '',
76
79
  secret: '',
77
- callback: `${strapi.config.server.url}/api/auth/github/callback`,
80
+ callback: `${baseURL}/github/callback`,
78
81
  scope: ['user', 'user:email'],
79
82
  },
80
83
  microsoft: {
@@ -82,7 +85,7 @@ const initGrant = async pluginStore => {
82
85
  icon: 'windows',
83
86
  key: '',
84
87
  secret: '',
85
- callback: `${strapi.config.server.url}/api/auth/microsoft/callback`,
88
+ callback: `${baseURL}/microsoft/callback`,
86
89
  scope: ['user.read'],
87
90
  },
88
91
  twitter: {
@@ -90,14 +93,14 @@ const initGrant = async pluginStore => {
90
93
  icon: 'twitter',
91
94
  key: '',
92
95
  secret: '',
93
- callback: `${strapi.config.server.url}/api/auth/twitter/callback`,
96
+ callback: `${baseURL}/twitter/callback`,
94
97
  },
95
98
  instagram: {
96
99
  enabled: false,
97
100
  icon: 'instagram',
98
101
  key: '',
99
102
  secret: '',
100
- callback: `${strapi.config.server.url}/api/auth/instagram/callback`,
103
+ callback: `${baseURL}/instagram/callback`,
101
104
  scope: ['user_profile'],
102
105
  },
103
106
  vk: {
@@ -105,7 +108,7 @@ const initGrant = async pluginStore => {
105
108
  icon: 'vk',
106
109
  key: '',
107
110
  secret: '',
108
- callback: `${strapi.config.server.url}/api/auth/vk/callback`,
111
+ callback: `${baseURL}/vk/callback`,
109
112
  scope: ['email'],
110
113
  },
111
114
  twitch: {
@@ -113,7 +116,7 @@ const initGrant = async pluginStore => {
113
116
  icon: 'twitch',
114
117
  key: '',
115
118
  secret: '',
116
- callback: `${strapi.config.server.url}/api/auth/twitch/callback`,
119
+ callback: `${baseURL}/twitch/callback`,
117
120
  scope: ['user:read:email'],
118
121
  },
119
122
  linkedin: {
@@ -121,7 +124,7 @@ const initGrant = async pluginStore => {
121
124
  icon: 'linkedin',
122
125
  key: '',
123
126
  secret: '',
124
- callback: `${strapi.config.server.url}/api/auth/linkedin/callback`,
127
+ callback: `${baseURL}/linkedin/callback`,
125
128
  scope: ['r_liteprofile', 'r_emailaddress'],
126
129
  },
127
130
  cognito: {
@@ -130,7 +133,7 @@ const initGrant = async pluginStore => {
130
133
  key: '',
131
134
  secret: '',
132
135
  subdomain: 'my.subdomain.com',
133
- callback: `${strapi.config.server.url}/api/auth/cognito/callback`,
136
+ callback: `${baseURL}/cognito/callback`,
134
137
  scope: ['email', 'openid', 'profile'],
135
138
  },
136
139
  reddit: {
@@ -139,7 +142,7 @@ const initGrant = async pluginStore => {
139
142
  key: '',
140
143
  secret: '',
141
144
  state: true,
142
- callback: `${strapi.config.server.url}/api/auth/reddit/callback`,
145
+ callback: `${baseURL}/reddit/callback`,
143
146
  scope: ['identity'],
144
147
  },
145
148
  auth0: {
@@ -148,7 +151,7 @@ const initGrant = async pluginStore => {
148
151
  key: '',
149
152
  secret: '',
150
153
  subdomain: 'my-tenant.eu',
151
- callback: `${strapi.config.server.url}/api/auth/auth0/callback`,
154
+ callback: `${baseURL}/auth0/callback`,
152
155
  scope: ['openid', 'email', 'profile'],
153
156
  },
154
157
  cas: {
@@ -156,7 +159,7 @@ const initGrant = async pluginStore => {
156
159
  icon: 'book',
157
160
  key: '',
158
161
  secret: '',
159
- callback: `${strapi.config.server.url}/api/auth/cas/callback`,
162
+ callback: `${baseURL}/cas/callback`,
160
163
  scope: ['openid email'], // scopes should be space delimited
161
164
  subdomain: 'my.subdomain.com/cas',
162
165
  },
@@ -21,10 +21,8 @@ module.exports = {
21
21
 
22
22
  async getRole(ctx) {
23
23
  const { id } = ctx.params;
24
- const { lang } = ctx.query;
25
24
 
26
- const plugins = await getService('users-permissions').getPlugins(lang);
27
- const role = await getService('role').getRole(id, plugins);
25
+ const role = await getService('role').getRole(id);
28
26
 
29
27
  if (!role) {
30
28
  return ctx.notFound();
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- module.exports = async (ctx, next) => {
3
+ module.exports = (config, { strapi }) => async (ctx, next) => {
4
4
  const ratelimit = require('koa2-ratelimit').RateLimit;
5
5
 
6
6
  const message = [
@@ -9,7 +9,7 @@ module.exports = [
9
9
  policies: [
10
10
  {
11
11
  name: 'admin::hasPermissions',
12
- options: {
12
+ config: {
13
13
  actions: ['plugin::users-permissions.roles.read'],
14
14
  },
15
15
  },
@@ -24,7 +24,7 @@ module.exports = [
24
24
  policies: [
25
25
  {
26
26
  name: 'admin::hasPermissions',
27
- options: {
27
+ config: {
28
28
  actions: ['plugin::users-permissions.roles.read'],
29
29
  },
30
30
  },
@@ -39,7 +39,7 @@ module.exports = [
39
39
  policies: [
40
40
  {
41
41
  name: 'admin::hasPermissions',
42
- options: {
42
+ config: {
43
43
  actions: ['plugin::users-permissions.roles.create'],
44
44
  },
45
45
  },
@@ -54,7 +54,7 @@ module.exports = [
54
54
  policies: [
55
55
  {
56
56
  name: 'admin::hasPermissions',
57
- options: {
57
+ config: {
58
58
  actions: ['plugin::users-permissions.roles.update'],
59
59
  },
60
60
  },
@@ -69,7 +69,7 @@ module.exports = [
69
69
  policies: [
70
70
  {
71
71
  name: 'admin::hasPermissions',
72
- options: {
72
+ config: {
73
73
  actions: ['plugin::users-permissions.roles.delete'],
74
74
  },
75
75
  },
@@ -9,7 +9,7 @@ module.exports = [
9
9
  policies: [
10
10
  {
11
11
  name: 'admin::hasPermissions',
12
- options: {
12
+ config: {
13
13
  actions: ['plugin::users-permissions.email-templates.read'],
14
14
  },
15
15
  },
@@ -24,7 +24,7 @@ module.exports = [
24
24
  policies: [
25
25
  {
26
26
  name: 'admin::hasPermissions',
27
- options: {
27
+ config: {
28
28
  actions: ['plugin::users-permissions.email-templates.update'],
29
29
  },
30
30
  },
@@ -39,7 +39,7 @@ module.exports = [
39
39
  policies: [
40
40
  {
41
41
  name: 'admin::hasPermissions',
42
- options: {
42
+ config: {
43
43
  actions: ['plugin::users-permissions.advanced-settings.read'],
44
44
  },
45
45
  },
@@ -54,7 +54,7 @@ module.exports = [
54
54
  policies: [
55
55
  {
56
56
  name: 'admin::hasPermissions',
57
- options: {
57
+ config: {
58
58
  actions: ['plugin::users-permissions.advanced-settings.update'],
59
59
  },
60
60
  },
@@ -69,7 +69,7 @@ module.exports = [
69
69
  policies: [
70
70
  {
71
71
  name: 'admin::hasPermissions',
72
- options: {
72
+ config: {
73
73
  actions: ['plugin::users-permissions.providers.read'],
74
74
  },
75
75
  },
@@ -85,7 +85,7 @@ module.exports = [
85
85
  policies: [
86
86
  {
87
87
  name: 'admin::hasPermissions',
88
- options: {
88
+ config: {
89
89
  actions: ['plugin::users-permissions.providers.update'],
90
90
  },
91
91
  },
@@ -1,14 +1,12 @@
1
1
  'use strict';
2
2
 
3
- const { rateLimit } = require('../../middlewares');
4
-
5
3
  module.exports = [
6
4
  {
7
5
  method: 'GET',
8
6
  path: '/connect/(.*)',
9
7
  handler: 'auth.connect',
10
8
  config: {
11
- middlewares: [rateLimit],
9
+ middlewares: ['plugin::users-permissions.rateLimit'],
12
10
  prefix: '',
13
11
  },
14
12
  },
@@ -17,7 +15,7 @@ module.exports = [
17
15
  path: '/auth/local',
18
16
  handler: 'auth.callback',
19
17
  config: {
20
- middlewares: [rateLimit],
18
+ middlewares: ['plugin::users-permissions.rateLimit'],
21
19
  prefix: '',
22
20
  },
23
21
  },
@@ -26,7 +24,7 @@ module.exports = [
26
24
  path: '/auth/local/register',
27
25
  handler: 'auth.register',
28
26
  config: {
29
- middlewares: [rateLimit],
27
+ middlewares: ['plugin::users-permissions.rateLimit'],
30
28
  prefix: '',
31
29
  },
32
30
  },
@@ -43,7 +41,7 @@ module.exports = [
43
41
  path: '/auth/forgot-password',
44
42
  handler: 'auth.forgotPassword',
45
43
  config: {
46
- middlewares: [rateLimit],
44
+ middlewares: ['plugin::users-permissions.rateLimit'],
47
45
  prefix: '',
48
46
  },
49
47
  },
@@ -52,7 +50,7 @@ module.exports = [
52
50
  path: '/auth/reset-password',
53
51
  handler: 'auth.resetPassword',
54
52
  config: {
55
- middlewares: [rateLimit],
53
+ middlewares: ['plugin::users-permissions.rateLimit'],
56
54
  prefix: '',
57
55
  },
58
56
  },
@@ -586,8 +586,10 @@ module.exports = ({ strapi }) => {
586
586
  });
587
587
  };
588
588
 
589
- const buildRedirectUri = (provider = '') =>
590
- `${getAbsoluteServerUrl(strapi.config)}/api/connect/${provider}/callback`;
589
+ const buildRedirectUri = (provider = '') => {
590
+ const apiPrefix = strapi.config.get('api.rest.prefix');
591
+ return `${getAbsoluteServerUrl(strapi.config)}/${apiPrefix}/connect/${provider}/callback`;
592
+ };
591
593
 
592
594
  return {
593
595
  connect,
@@ -40,7 +40,7 @@ module.exports = ({ strapi }) => ({
40
40
  await Promise.all(createPromises);
41
41
  },
42
42
 
43
- async getRole(roleID, plugins) {
43
+ async getRole(roleID) {
44
44
  const role = await strapi
45
45
  .query('plugin::users-permissions.role')
46
46
  .findOne({ where: { id: roleID }, populate: ['permissions'] });
@@ -59,12 +59,6 @@ module.exports = ({ strapi }) => ({
59
59
  enabled: true,
60
60
  policy: '',
61
61
  });
62
-
63
- if (permission.action.startsWith('plugin')) {
64
- const [, pluginName] = type.split('::');
65
-
66
- allActions[type].information = plugins.find(plugin => plugin.id === pluginName) || {};
67
- }
68
62
  });
69
63
 
70
64
  return {
@@ -28,63 +28,74 @@ const transformRoutePrefixFor = pluginName => route => {
28
28
  };
29
29
 
30
30
  module.exports = ({ strapi }) => ({
31
- getPlugins(lang = 'en') {
32
- const request = require('request');
33
- return new Promise(resolve => {
34
- request(
35
- {
36
- uri: `https://marketplace.strapi.io/plugins?lang=${lang}`,
37
- json: true,
38
- timeout: 3000,
39
- headers: {
40
- 'cache-control': 'max-age=3600',
41
- },
42
- },
43
- (err, response, body) => {
44
- if (err || response.statusCode !== 200) {
45
- return resolve([]);
46
- }
47
-
48
- resolve(body);
49
- }
50
- );
51
- });
52
- },
53
-
54
- // TODO: Filter on content-api only
55
31
  getActions({ defaultEnable = false } = {}) {
56
32
  const actionMap = {};
57
33
 
34
+ const isContentApi = action => {
35
+ if (!_.has(action, Symbol.for('__type__'))) {
36
+ return false;
37
+ }
38
+
39
+ return action[Symbol.for('__type__')].includes('content-api');
40
+ };
41
+
58
42
  _.forEach(strapi.api, (api, apiName) => {
59
- const controllers = _.mapValues(api.controllers, controller => {
60
- return _.mapValues(controller, () => {
61
- return {
62
- enabled: defaultEnable,
63
- policy: '',
64
- };
65
- });
66
- });
43
+ const controllers = _.reduce(
44
+ api.controllers,
45
+ (acc, controller, controllerName) => {
46
+ const contentApiActions = _.pickBy(controller, isContentApi);
47
+
48
+ if (_.isEmpty(contentApiActions)) {
49
+ return acc;
50
+ }
51
+
52
+ acc[controllerName] = _.mapValues(contentApiActions, () => {
53
+ return {
54
+ enabled: defaultEnable,
55
+ policy: '',
56
+ };
57
+ });
67
58
 
68
- actionMap[`api::${apiName}`] = { controllers };
59
+ return acc;
60
+ },
61
+ {}
62
+ );
63
+
64
+ if (!_.isEmpty(controllers)) {
65
+ actionMap[`api::${apiName}`] = { controllers };
66
+ }
69
67
  });
70
68
 
71
69
  _.forEach(strapi.plugins, (plugin, pluginName) => {
72
- const controllers = _.mapValues(plugin.controllers, controller => {
73
- return _.mapValues(controller, () => {
74
- return {
75
- enabled: defaultEnable,
76
- policy: '',
77
- };
78
- });
79
- });
70
+ const controllers = _.reduce(
71
+ plugin.controllers,
72
+ (acc, controller, controllerName) => {
73
+ const contentApiActions = _.pickBy(controller, isContentApi);
74
+
75
+ if (_.isEmpty(contentApiActions)) {
76
+ return acc;
77
+ }
80
78
 
81
- actionMap[`plugin::${pluginName}`] = { controllers };
79
+ acc[controllerName] = _.mapValues(contentApiActions, () => {
80
+ return {
81
+ enabled: defaultEnable,
82
+ policy: '',
83
+ };
84
+ });
85
+
86
+ return acc;
87
+ },
88
+ {}
89
+ );
90
+
91
+ if (!_.isEmpty(controllers)) {
92
+ actionMap[`plugin::${pluginName}`] = { controllers };
93
+ }
82
94
  });
83
95
 
84
96
  return actionMap;
85
97
  },
86
98
 
87
- // TODO: Filter on content-api only
88
99
  async getRoutes() {
89
100
  const routesMap = {};
90
101
 
@@ -95,7 +106,7 @@ module.exports = ({ strapi }) => ({
95
106
  }
96
107
 
97
108
  return route;
98
- });
109
+ }).filter(route => route.info.type === 'content-api');
99
110
 
100
111
  if (routes.length === 0) {
101
112
  return;
@@ -116,7 +127,7 @@ module.exports = ({ strapi }) => ({
116
127
  }
117
128
 
118
129
  return transformPrefix(route);
119
- });
130
+ }).filter(route => route.info.type === 'content-api');
120
131
 
121
132
  if (routes.length === 0) {
122
133
  return;
@@ -1 +0,0 @@
1
- <svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><text transform="translate(-24 -6)" fill="#4B515A" fill-rule="evenodd" font-size="24" font-family="AppleColorEmoji, Apple Color Emoji"><tspan x="24" y="28">🔐</tspan></text></svg>