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

Fixes #5816 - allow editing and displaying self via API #3379

Closed
wants to merge 1 commit into from

Conversation

ares
Copy link
Member

@ares ares commented Mar 30, 2016

No description provided.

@@ -351,7 +351,10 @@ def can_change_admin_flag?
def editing_self?(options = {})
options[:controller].to_s == 'users' &&
options[:action] =~ /edit|update/ &&
options[:id].to_i == self.id
options[:id].to_i == self.id ||
options[:controller].to_s =~ /api\/v\d+\/users/ &&
Copy link
Member

Choose a reason for hiding this comment

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

I would rather check for whole match /\A/api\/v\d+\/users/\Z/, just to prevent a case, where we would have users.+ controller in the future - not expecting but still, it's better safe than sorry.

@iNecas
Copy link
Member

iNecas commented Mar 30, 2016

Tested and works well 👍

@iNecas
Copy link
Member

iNecas commented Mar 30, 2016

one nitpick

@ares
Copy link
Member Author

ares commented Mar 31, 2016

thanks @iNecas, fixed... test failure seems unrelated

@domcleal
Copy link
Contributor

For the record, I filed that error as http://projects.theforeman.org/issues/14414 today.

@dLobatog
Copy link
Member

dLobatog commented Apr 4, 2016

Merged as 7ffb50b, thanks @ares!

@dLobatog dLobatog closed this Apr 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants