Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix init reset password permission #6696

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const DEFAULT_PERMISSIONS = [
type: 'users-permissions',
roleType: 'public',
},
{ action: 'changepassword', controller: 'auth', type: 'users-permissions', roleType: 'public' },
{ action: 'resetPassword', controller: 'auth', type: 'users-permissions', roleType: 'public' },
Copy link

@nicksp nicksp Jul 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexandrebodin I know this is merged already, but this seems might not work as one might expect. The correct action name is resetpassword. 🤔 Or is it case insensitive?

I also noticed that bug mentioin in the ticket a while ago and what I did was setting this permission programmatically. And I used exactly a lowercased action name:

const permissionQuery = strapi.query('permission', 'users-permissions')
const params = {
  role: ID,
  type: 'users-permissions',
  controller: 'auth',
  action: 'resetpassword'
}
<..>

if (!existingPermission) {
  await permissionQuery.create({
        ...params,
        enabled: true
    })
}

This is also the name used in a DB:

image

{ action: 'init', controller: 'userspermissions', type: null, roleType: null },
{ action: 'me', controller: 'user', type: 'users-permissions', roleType: null },
{ action: 'autoreload', controller: null, type: null, roleType: null },
Expand Down