-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
(WIP) Add users-permissions updateMe #8698
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
Conversation
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #8698 +/- ##
=======================================
Coverage 33.65% 33.65%
=======================================
Files 1248 1248
Lines 13765 13765
Branches 1365 1365
=======================================
Hits 4632 4632
Misses 8243 8243
Partials 890 890
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
| return ctx.badRequest('ValidationError', err); | ||
| } | ||
|
|
||
| const updatedUser = await strapi.plugins['users-permissions'].services.user.edit(ctx.state.user.id, input); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incase some one needs this
Change - services.user.edit({ id: ctx.state.user.id }, input);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't recommend using this yet, it's only a prototype with no validation or security yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
This Pointed me in the right direction , i have added my own validations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good day! But maybe we can made it this way?
async updateme (ctx) {
// Get user id from context
const { id } = ctx.state.user;
// Set id to params. strapi.plugins["users-permissions"].controllers.user.update use it.
ctx.params.id = id;
// Use default Strapi Update User function
return strapi.plugins["users-permissions"].controllers.user.update(ctx);
}
|
This pull request has been mentioned on Strapi Community Forum. There might be relevant details there: https://forum.strapi.io/t/applying-isowner-policy-to-user-permissions-plugin/1782/2 |
|
What's the plan for this one ? |
Currently nothing, I'm marking as closed as I don't have time to finish it. Someone else can pick this up if they like. |
Signed-off-by: Derrick Mehaffy derrickmehaffy@gmail.com
What does it do?
Adds a PUT /users/me route by default to the users-permissions plugin
Why is it needed?
Requested by users
Related issue(s)/PR(s)
#2818