Bug 773603

Summary: User with Read only permissions shouldn't be allowed change default org or raised message should be correct.
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: WebUIAssignee: Partha Aji <paji>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: mmccune, paji
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 783320 (view as bug list) Environment:
Last Closed: 2012-08-22 18:18:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 747354    
Attachments:
Description Flags
User with Read only permissions shouldn't be allowed change default org or raised message should be correct.
none
production.logs after clicking on save button.
none
unable to change user's default org as no save button is there none

Description Sachin Ghai 2012-01-12 11:56:56 UTC
Description of problem:
I added a read only user "reader" and assign "Read Everything" role.
when I login with reader and traversed  Administration ==> users ==> select any user ==> environments on right tab and changed the new default organization, got:

The default you supplied was the same as the old default.

Since I'm login with read only user so this user shouldn't be allowed to change or even select the new default org from list box.

Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1. Login with admin
2. create new user 'reader'
3. assign "read everything" role to reader
4. Login with reader and go to Administration tab
5. select user ==> environments on right tab and changed the new default organization
  
Actual results:
The default you supplied was the same as the old default

Expected results:

The list box shouldn't be available to read only user for any selection and disable the save button.

Additional info:

Started PUT "/katello//users/5/update_environment" for 10.65.193.48 at Thu Jan 12 17:22:57 +0530 2012
  Processing by UsersController#update_environment as 
  Parameters: {"id"=>"5"}
Rendered text template (0.0ms)
Completed 400 Bad Request in 46ms (Views: 0.7ms | ActiveRecord: 23.1ms)

Comment 1 Sachin Ghai 2012-01-12 11:59:02 UTC
Created attachment 552390 [details]
User with Read only permissions shouldn't be allowed change default org or raised message should be correct.

Comment 2 Sachin Ghai 2012-01-12 12:03:15 UTC
Also observed that if you simply click on "save" without even selecting the new default org raising the following message on UI:

The default you supplied was the same as the old default.

Save button shouldn't be active when I'm not selecting any option from the list box.

Comment 3 Mike McCune 2012-01-17 23:29:04 UTC
shouldn't even show the Save if you don't have rights to make the change.

Comment 5 Partha Aji 2012-01-20 01:25:07 UTC
look at bz 783328 for the behaviour to verify.

Comment 6 Sachin Ghai 2012-01-24 11:33:15 UTC
Verified with katello-0.1.194-1.el6.noarch


Found two issues:

1. Now I can not change the default org as none of the option listed under drop down list box. 
However instead of "No default organization" option,  user's default org (ACME_Corporation) should be listed there which we have given at the time of user creation.


2. On clicking save button, nothing happens on UI, no notification/message. However getting this in production.log :

Started PUT "/katello/users/2/update_environment" for 10.65.193.48 at Tue Jan 24 11:06:32 +0530 2012
  Processing by UsersController#update_environment as 
  Parameters: {"id"=>"2"}
User reader is not allowed to access users/update_environment
User reader is not allowed to access users/update_environment
#<Errors::SecurityViolation: User reader is not allowed to access users/update_environment>
/usr/share/katello/lib/authorization_rules.rb:31:in `authorize'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:453:in `_run__434435962__process_action__1602723082__callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:221:in `_conditional_callback_around_2670'
/usr/share/katello/lib/util/threadsession.rb:79:in `thread_locals'

<truncate>

For complete logs please see the production.log attached in next comment.

Comment 7 Sachin Ghai 2012-01-24 11:34:14 UTC
Created attachment 557193 [details]
production.logs after clicking on save button.

Comment 8 Partha Aji 2012-01-24 18:07:55 UTC
This second bug you are seeing is a side effect of
https://bugzilla.redhat.com/show_bug.cgi?id=784319 

To verify this fix works.. Change the environment via a user edit (as admin) -> environments and then verify as a read only user to make sure the env shows up.

Comment 9 Partha Aji 2012-01-24 18:11:02 UTC
Also wonder why you are seeing the save button. For I am not able to reproduce it. I did the following
1) Create new user (no default orgs)
2) Assigned read everything role
3) Logged in as that user and went to another user's environments.

I did not see the save button.

Save button should show up only if you are editing the Read Only user himself.

Comment 10 Sachin Ghai 2012-01-25 11:12:56 UTC
Yes..correct. Save button available only while editing the user with which we are logged in.

Otherwise no 'save' button is available for other users. Moving this to verified and will track the other issue with 784319.

Comment 11 Sachin Ghai 2012-01-25 11:14:44 UTC
Created attachment 557426 [details]
unable to change user's default org as no save button is there