sureshanaparti opened a new pull request #4071:
URL: https://github.com/apache/cloudstack/pull/4071


   ## Description
   <!--- Describe your changes in detail -->
   
   This PR addresses the below improvements for current Dynamic roles 
functionality.
   - Create a role from any of the existing role, using new parameter roleid in 
createRole API.
   - Import a role with its rules, using a new importRole API.
   - New default roles for Read-Only and Support Admin & User.
   - Default roles cannot be updated or deleted.
   
   - Cleanup of old NetApp APIs from role_permissions table.
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to 
reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be 
closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Put an `x` in all the 
boxes that apply: -->
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [x] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [x] Enhancement (improves an existing feature and functionality)
   - [x] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ## Screenshots (if appropriate):
   
   ## How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to 
-->
   <!-- see how your change affects other areas of the code, etc. -->
   **Manual tests using API**
   - Create a role using existing role.
   
   
http://myms:8080/client/api?command=createRole&response=json&name=Test%20CloneUser01&description=Test%20CloneUser01&roleid=ca9871c2-8ea7-11ea-944e-c2865825b006
   
   
{"createroleresponse":{"role":{"id":"c3888c27-66b6-4a39-96ee-9883fef326ba","name":"Test
 CloneUser01","type":"User","description":"Test CloneUser01"}}}
   
   - Create a role using both role type and role id.
   
   
http://myms:8080/client/api?command=createRole&response=json&type=Admin&name=Test%20CloneResourceAdmin&description=Test%20CloneResourceAdmin&roleid=ca984d00-8ea7-11ea-944e-c2865825b006
   
   
{"createroleresponse":{"uuidList":[],"errorcode":431,"cserrorcode":9999,"errortext":"Both
 role type and role ID should not be specified"}}
   
   - Create a role without role type and role id.
   
   
http://myms:8080/client/api?command=createRole&response=json&name=Test%20CloneResourceAdmin&description=Test%20CloneResourceAdmin
   
   
{"createroleresponse":{"uuidList":[],"errorcode":431,"cserrorcode":9999,"errortext":"Neither
 role type nor role ID is provided"}}
   
   - Import role
   
   
http://myms:8080/client/api?command=importRole&response=json&name=ImportTestUser&type=User&description=Test%20Import%20Role&rules[0].rule=create*&rules[0].permission=allow&rules[0].description=create%20rule&rules[1].rule=list*&rules[1].permission=allow&rules[1].description=listing&forced=true
   
   
{"importroleresponse":{"role":{"id":"8306f86d-ab33-48b8-8263-535a0da5be04","name":"ImportTestUser","type":"User","description":"Test
 Import Role"}}}
   
   - Import role with same name without force
   
   
http://myms:8080/client/api?command=importRole&response=json&name=ImportTestUser&type=User&description=Test%20Import1%20Role&rules[0].rule=create*&rules[0].permission=allow&rules[0].description=create%20rule&rules[1].rule=list*&rules[1].permission=allow&rules[1].description=listings
   
   
{"importroleresponse":{"uuidList":[],"errorcode":530,"cserrorcode":4250,"errortext":"Role
 already exists"}}
   
   **Unit tests**
   
   [INFO] Running org.apache.cloudstack.api.command.test.ImportRoleCmdTest
   [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 
s - in org.apache.cloudstack.api.command.test.ImportRoleCmdTest
   [INFO] Running org.apache.cloudstack.api.command.test.CreateRoleCmdTest
   [INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 
s - in org.apache.cloudstack.api.command.test.CreateRoleCmdTest
   <!-- Please read the 
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md)
 document -->
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to