@plusscommunities/pluss-core-aws 2.0.6-beta.0 → 2.0.7-beta.0
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.
|
@@ -7,12 +7,10 @@ const getSiteUserTypes = require("../../db/auth/getSiteUserTypes");
|
|
|
7
7
|
* @param {string[]} permissions - The permissions to filter user types by.
|
|
8
8
|
* @returns {Object[]} - An array of filtered user types.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
module.exports = async (site, permissions) => {
|
|
11
11
|
const siteUserTypes = await getSiteUserTypes(site);
|
|
12
12
|
const filteredUserTypes = siteUserTypes.filter((userType) =>
|
|
13
13
|
userType.Permissions.some((permission) => permissions.includes(permission))
|
|
14
14
|
);
|
|
15
15
|
return filteredUserTypes;
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
module.exports = getUserTypesByPermission;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const getUserTypesByPermission = require("./getUserTypesByPermission");
|
|
2
|
+
const getAudience = require("../audience/getAudience");
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Retrieves users by permission.
|
|
@@ -8,7 +8,7 @@ import getAudience from "../audience/getAudience";
|
|
|
8
8
|
* @param {Array<string>} permissions - The permissions to filter users by.
|
|
9
9
|
* @returns {Promise<Array<object>>} - A promise that resolves to an array of users matching the given permissions.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
module.exports = async (site, permissions) => {
|
|
12
12
|
const userTypes = await getUserTypesByPermission(site, permissions);
|
|
13
13
|
const audienceMatches = userTypes.map((ut) => {
|
|
14
14
|
return {
|
|
@@ -19,5 +19,3 @@ const getUsersByPermission = async (site, permissions) => {
|
|
|
19
19
|
const audience = await getAudience(site, "Custom", audienceMatches);
|
|
20
20
|
return audience;
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
module.exports = getUsersByPermission;
|
package/package.json
CHANGED