mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +00:00
rename mapTokenPermissions to flattenTokenPermissions
This commit is contained in:
parent
d4f03c7d56
commit
c5eb2b1a9d
@ -46,8 +46,12 @@ const assertCustomTokenPermissionsValidity = (attributes) => {
|
||||
throw new ValidationError('Missing permissions attribute for custom token');
|
||||
}
|
||||
};
|
||||
|
||||
const mapTokenPermissions = (token) => {
|
||||
/**
|
||||
* @param {ApiToken} token
|
||||
*
|
||||
* @returns {ApiToken}
|
||||
*/
|
||||
const flattenTokenPermissions = (token) => {
|
||||
if (!token) return token;
|
||||
return {
|
||||
...token,
|
||||
@ -75,7 +79,7 @@ const getBy = async (whereParams = {}) => {
|
||||
.findOne({ select: SELECT_FIELDS, populate: POPULATE_FIELDS, where: whereParams });
|
||||
|
||||
if (!token) return token;
|
||||
return mapTokenPermissions(token);
|
||||
return flattenTokenPermissions(token);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -192,7 +196,7 @@ const list = async () => {
|
||||
});
|
||||
|
||||
if (!tokens) return tokens;
|
||||
return tokens.map((token) => mapTokenPermissions(token));
|
||||
return tokens.map((token) => flattenTokenPermissions(token));
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user