Skip to content

Conversation

@yadvr
Copy link
Member

@yadvr yadvr commented Mar 28, 2019

Problem: CloudStack users want the ability to share templates with other accounts or projects through the UI.

Root Cause: The ‘updateTemplatePermissions’ is only available via API and needs to be integrated with the UI in order to allow users to share templates with other accounts within the same domain, and also with projects that the sharing account has access to.

Solution: The CloudStack UI template view has been extended to include a button that allows users to update template permissions through the ‘updateTemplatePermissions’ API. This API supports 3 operations i.e. add, remove or reset. The reset operation does not require any parameters and it simply removes all permissions for a template. The add and remove parameters require either accounts or projects to be specified for sharing or stop sharing templates. The ‘listAccounts’ API has been extended to allow users to see all the accounts within the same domain if the global setting ‘allow.view.all.domain.accounts’ is set to true. This allows the accounts selection to be a multi-selection.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

Reset Operation hides the Accounts and Project ID fields as this operation does not require any additional parameters to be set.

Operation = Reset; Account and Project fields not displayed
image

Operation = Add/Remove , global setting: 'allow.user.view.all.domain.accounts' = false;
image

Operation = Add , global setting: 'allow.user.view.all.domain.accounts' = true; Domain has 3 accounts in total (bt1, bt2 and bt3). Logged in user is bt1 and so it is not shown on the dropdown list.
image

Operation = Remove , global setting: 'allow.user.view.all.domain.accounts' = true; Domain has 3 accounts in total (bt1, bt2 and bt3). The current template was only shared with bt2 by bt1 so dropdown menu only shows accounts that the current template has been shared with.
image

How Has This Been Tested?

  • Create 2 Accounts (acc1 and acc2) within the same domain.
  • Log in to the CloudStack UI with acc1 user account and upload a private template for this user.
  • Navigate to the newly created UI and click on the "Update Template Permissions" button.
  • A new window should pop up, select "Add" for this window and input acc2 in the Accounts input field and then click OK.
  • With CloudMonkey/CloudStack UI, check for shared templates using acc2 user account. The template from acc1 user account should now be visible to acc2 under shared templates.

@borisstoyanov
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2659

Copy link
Contributor

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

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

Thanks for this neat feature @rhtyd, I just have one issue with it
When adding a project I get an error saying 'an account or projectid needs to be passed', I suppose there's something wrong with the passing of the projectId
Here's the steps:

  1. Click on the update permission button for a template
  2. Select a project and click submit.
    Screenshot 2019-04-04 at 13 52 25
    And get the following error:
    Screenshot 2019-04-04 at 13 52 17

@borisstoyanov
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

Trillian test result (tid-3471)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 31556 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3241-t3471-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_volumes.py
Intermittent failure detected: /marvin/tests/smoke/test_host_maintenance.py
Smoke tests completed. 70 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@anuragaw
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2713

@anuragaw
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@anuragaw a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

Trillian test result (tid-3530)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 25768 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3241-t3530-kvm-centos7.zip
Smoke tests completed. 70 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@shwstppr
Copy link
Contributor

@rhtyd conflict issues with this.
For a non-public template in ROOT domain, Root admin cannot share template to a project in one of the subdomain?
Screenshot from 2019-05-29 17-07-30
Screenshot from 2019-05-29 17-15-29
Screenshot from 2019-05-29 17-15-45

@yadvr
Copy link
Member Author

yadvr commented May 30, 2019

@shwstppr @anuragaw can you fix the merge conflicts, thanks.

@anuragaw anuragaw force-pushed the allow-ui-template-sharing branch from 3202fec to 60ab5f8 Compare June 4, 2019 08:25
@anuragaw
Copy link
Contributor

anuragaw commented Jun 4, 2019

Fixed merge conflicts and cleaned up some code left over. @rhtyd , @shwstppr

@anuragaw
Copy link
Contributor

anuragaw commented Jun 4, 2019

@rhtyd conflict issues with this.
For a non-public template in ROOT domain, Root admin cannot share template to a project in one of the subdomain?
Screenshot from 2019-05-29 17-07-30
Screenshot from 2019-05-29 17-15-29
Screenshot from 2019-05-29 17-15-45

We may have to ask @rhtyd or @PaulAngus if this is the expected behaviour or not.

@yadvr
Copy link
Member Author

yadvr commented Jun 7, 2019

@anuragaw can you address this bug if you've time today?

@anuragaw
Copy link
Contributor

anuragaw commented Jun 7, 2019

Looking now @rhtyd

@borisstoyanov
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2874

@anuragaw anuragaw force-pushed the allow-ui-template-sharing branch from 0ccd63d to 999eb1a Compare June 11, 2019 08:26
Dingane Hlaluku and others added 8 commits July 12, 2019 09:14
The older UI was confusing as it showed both project and
accounts. The list of accounts and projects with add/remove
wasn't consistent and instead showed everything.

This patch updates the dialogue layout logic to only allow users
to select accounts or project one at a time. The lists are also
populated such that users see accounts/projects which don't have
permissions to add and accounts/projects that have permissions
to remove.
@anuragaw anuragaw force-pushed the allow-ui-template-sharing branch from bcefd68 to d383aa3 Compare July 12, 2019 03:45
@anuragaw
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-118

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-120

@anuragaw
Copy link
Contributor

When admins share project owned templates we will now get a distinct message.

@anuragaw
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✖centos7 ✔debian. JID-140

@borisstoyanov
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-142

@borisstoyanov
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@borisstoyanov
Copy link
Contributor

LGTM with the known issue of #3481

@blueorangutan
Copy link

Trillian test result (tid-171)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 30578 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3241-t171-kvm-centos7.zip
Smoke tests completed. 77 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

Copy link
Member

@PaulAngus PaulAngus left a comment

Choose a reason for hiding this comment

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

LGTM based on manual testing for positive and negative results

@PaulAngus PaulAngus merged commit 5d81574 into apache:master Jul 18, 2019
@yadvr yadvr changed the title [WIP DO NOT MERGE] Allow users to share templates with Accounts or Projects through the Allow users to share templates with Accounts or Projects through the Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants