Merge pull request #14214 from strapi/api-token-v2/fix-update-checks

Fix API tokens' update due to wrong enum values
This commit is contained in:
Jean-Sébastien Herbaux 2022-08-25 14:12:46 +02:00 committed by GitHub
commit 4c6c5e5218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -335,8 +335,8 @@ const update = async (id, attributes) => {
}
const changingTypeToCustom =
attributes.type === constants.API_TOKEN_TYPE.custom &&
originalToken.type !== constants.API_TOKEN_TYPE.custom;
attributes.type === constants.API_TOKEN_TYPE.CUSTOM &&
originalToken.type !== constants.API_TOKEN_TYPE.CUSTOM;
// if we're updating the permissions on any token type, or changing from non-custom to custom, ensure they're still valid
// if neither type nor permissions are changing, we don't need to validate again or else we can't allow partial update