Bug 1293791 - It's better to disable "Add to project" button if the user only has view permission for one project
Summary: It's better to disable "Add to project" button if the user only has view perm...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Management Console
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Jakub Hadvig
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-23 05:43 UTC by Wei Sun
Modified: 2016-09-19 13:54 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-19 13:54:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Wei Sun 2015-12-23 05:43:27 UTC
Description of problem:
Add a user as viewer to the project,and login web console using viewer .Click the project,and click "Add to project" button to create an application.The viewer could not create any resource successfully.
But it's better to disable "Add to project" button,then the viewer will not try to create anything.

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

How reproducible:
Always

Steps to Reproduce:
1.Create a project and add a user as viewer to the project
2.Log in web console using viewer
3.Create an application using the project

Actual results:
The viewer could use the button "Add to project",but could not create anything successfully due to the permission

Expected results:
If the viewer doesn't have permission the the "Add to project" button should be disabled.

Additional info:

Comment 1 Jessica Forrester 2016-05-02 14:45:28 UTC
General story for this is in trello https://trello.com/c/UQEUgVrY

Comment 3 Jakub Hadvig 2016-07-12 11:47:53 UTC
This should be fixed by merged PR

Comment 4 XiaochuanWang 2016-07-13 06:59:59 UTC
Still reproduced on latest origin rhel7_4552
oc v1.3.0-alpha.2-1074-g69bd399
kubernetes v1.3.0-alpha.3-599-g2746284

Comment 5 Jakub Hadvig 2016-07-13 09:04:23 UTC
I've couldn't reproduce this issue. Please could you provide info on the steps you followed and what was the outcome ?
Also we are not disabling the 'Add to project' button, we are hiding it.

Comment 7 XiaochuanWang 2016-07-14 02:08:11 UTC
I still reproduced on today's ami devenv-rhel7_4552
Here comes my reproduced step http://pastebin.test.redhat.com/392210
Here are 2 "Add to Project" buttons and now one of them is hidden which is on top of the screen , but still show the other one in the middle of page, please see the screenshot from attachment. Thanks.

Comment 8 openshift-github-bot 2016-07-15 12:46:19 UTC
Commit pushed to master at https://github.com/openshift/origin-web-console

https://github.com/openshift/origin-web-console/commit/0090e0da6f622ca6ce216bc819bcdaeafe309ea1
Bug 1293791 - Hide 'Add to project' button on overview if user cant create any resource

Comment 9 XiaochuanWang 2016-07-18 02:39:18 UTC
Tested on latest ami(devenv-rhel7_4607).

git log contains: commit 0090e0da6f622ca6ce216bc819bcdaeafe309ea1
Author: jhadvig <jhadvig>
Date:   Thu Jul 14 11:36:56 2016 +0200

    Bug 1293791 - Hide 'Add to project' button on overview if user cant create any resource


Still find button:
<a href="project/xiaocwan-t/create" ng-href="project/xiaocwan-t/create" class="btn btn-lg btn-primary">
Add to Project
</a>

There are Two add-to-project in original bug. The button on top of page is hidden but the other one in middle of page is still here since https://bugzilla.redhat.com/show_bug.cgi?id=1293791#c7 , please refer to the screenshot from attachment "Add-to-Project_button".

Thanks!

Comment 10 XiaochuanWang 2016-07-18 02:47:39 UTC
Steps to reproduce:
1. User1 create a project
2. User1 grand view role to user2: $oc policy add-role-to-user view user2 -n <user1-project>
3. User2 login, go to the project and check page on web console

Comment 11 XiaochuanWang 2016-07-20 03:01:22 UTC
Verified on latest origin
oc v1.3.0-alpha.2+6bfd721-dirty
openshift v1.3.0-alpha.2+6bfd721-dirty
kubernetes v1.3.0+57fb9ac

No "Add-to-Project" to show, used following message instead:
Welcome to project xiaocwan-t.
If you need to create resources in this project, a project administrator can grant you additional access by running this command:
oc policy add-role-to-user <role> xiaoviewer -n xiaocwan-t


Note You need to log in before you can comment on or make changes to this bug.