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

Can't add more than one Role for same user using Grant-RsCatalogItemRole #102

Closed
ClaudioESSilva opened this issue Nov 6, 2017 · 4 comments

Comments

@ClaudioESSilva
Copy link
Contributor

Do you want to request a feature or report a bug?
bug

What is the current behavior?
It gives an error when we try to add a 2nd role to an existing user.

Error occurred while granting Content Manager to User on /Folder! Exception calling "SetPolicies" with "2" argument(s): "System.Web.Services.Protocols.SoapException: The policy for
'User' user or group is not valid. The role assignment is either empty, specifies a user or group name that is already used in an existing role assignment for the current item, or specifies duplicate roles for the same user or group. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidPolicyDefinitionException: The policy for 'User' user or group is not valid. The role assignment is either empty, specifies a user or group name that is already used in an existing role assignment for the current item, or specifies duplicate roles for the same user or group.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Create new folder
New-RsFolder -ReportServerUri $reportServerUri -RsFolder "/" -FolderName "Folder"

Grant permissions - Works correctly
Grant-RsCatalogItemRole -ReportServerUri $reportServerUri -Path "/Folder" -RoleName 'Browser' -Identity "User"

When try to run the following - will fail
Grant-RsCatalogItemRole -ReportServerUri $reportServerUri -Path "/Folder" -RoleName 'Browser' -Identity "User"

What is the expected behavior?
That the new Role is appended to the existing ones.

Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts?
PowerShell v5.0
Windows 10

Not that I'm aware of.

Notes
I have and will submit a fix.

ClaudioESSilva added a commit to ClaudioESSilva/ReportingServicesTools that referenced this issue Nov 6, 2017
Wasn't possible to add more than one Role for same user using Grant-RsCatalogItemRole
@parthsha
Copy link
Contributor

parthsha commented Nov 7, 2017

Thank you very much for the quick turnaround Claudio!

parthsha pushed a commit that referenced this issue Nov 8, 2017
…-RsCatalogItemRole (#103)

* Fixes (#102) the ability to give more than one Role to an user

Wasn't possible to add more than one Role for same user using Grant-RsCatalogItemRole

* New test - Adding more than one Role to the same user/CatalogItem

Grant Browser Permission and then add grant Content Manager.
It should keep both.
AfterAll remove them.

* Add $script scope to the variable on AfterAll

* Fix variable name

* Removed AfterAll block
@vytux-com
Copy link
Contributor

I was still getting this error:

New-RsFolder -ReportServerUri $ReportServerUri -Credential $rptLogin -RsFolder '/' -FolderName "Test"
New-RsFolder -ReportServerUri $ReportServerUri -Credential $rptLogin -RsFolder "/Test" -FolderName "Other"
Grant-RsCatalogItemRole -ReportServerUri $ReportServerUri -Credential $rptLogin -Identity "User" -Path "/Test" -RoleName "Browser"
Grant-RsCatalogItemRole -ReportServerUri $ReportServerUri -Credential $rptLogin -Identity "User" -Path "/Test/Other" -RoleName "Content Manager"

The reason was if you specify the Identity as "User" it will work for the first call however it converts the Identity to "SERVER_NAME\User" on second run it does not pickup the fact that the Identity already exists and produces the same error.

No sure if there should be a warning about this or if the module should be modified to check for SERVER_NAME\ prefix and if it does not exist then add it.

@VickyWinner
Copy link

I am on 0.0.4.9, Was it fixed as part of this version? I am still getting this error while adding more than one role for same user:

Error occurred while granting System User to xxxx! Exception calling "SetSystemPolicies" with "1" argument(s):
"System.Web.Services.Protocols.SoapException: The policy for 'xxxx' user or group is not valid. The role assignment is either empty,
specifies a user or group name that is already used in an existing role assignment for the current item, or specifies duplicate roles for the same user or
group. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidPolicyDefinitionException: The policy for 'xxxx' user or group is not
valid. The role assignment is either empty, specifies a user or group name that is already used in an existing role assignment for the current item, or
specifies duplicate roles for the same user or group.
at Microsoft.ReportingServices.Library.ReportingService2005Impl.SetSystemPolicies(Policy[] Policies, Guid batchId)
at Microsoft.ReportingServices.Library.ReportingService2005Impl.SetSystemPolicies(Policy[] Policies)
at Microsoft.ReportingServices.WebServer.ReportingService2010.SetSystemPolicies(Policy[] Policies)"
+ CategoryInfo : OperationStopped: (:) [], Exception
+ FullyQualifiedErrorId : Error occurred while granting System User to xxxx! Exception calling "SetSystemPolicies" with "1" argument(s):
"System.Web.Services.Protocols.SoapException: The policy for 'xxxx' user or group is not valid. The role assignment is either empty, spec
ifies a user or group name that is already used in an existing role assignment for the current item, or specifies duplicate roles for the same user or
group. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidPolicyDefinitionException: The policy for 'xxxx' user or group is no
t valid. The role assignment is either empty, specifies a user or group name that is already used in an existing role assignment for the current item,
or specifies duplicate roles for the same user or group.
at Microsoft.ReportingServices.Library.ReportingService2005Impl.SetSystemPolicies(Policy[] Policies, Guid batchId)
at Microsoft.ReportingServices.Library.ReportingService2005Impl.SetSystemPolicies(Policy[] Policies)
at Microsoft.ReportingServices.WebServer.ReportingService2010.SetSystemPolicies(Policy[] Policies)"

@jtarquino
Copy link
Member

No new changes have been submitted in that area

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

No branches or pull requests

5 participants