I am facing a bit of a strange issue, let me try to elaborate.
There are three users
- Normal user
- Admin user
- Secondary admin
Pro-grammatically I am provisioning site collection using below code:
SPSites.Add(sitecollURL, title, "Site Description", 1033, templateID, Admin user, adminUserName, "");
So I am provisioning the site by setting the primary admin only, not providing any value in secondary admin.
After site provisioning is done I am adding the normal user to a SharePoint group having contribute access.
So far all good.
There is a document library in the newly provisioned site collection having some image files inside a folder, both user have access to the library as well as folder, as the library is inheriting permissions from parent.
At first I am getting an "access denied" error for the normal user while accessing any image file from the library(I have contribute rights)
But as soon as I execute the following powershell command
Set-SPSite -Identity "<SiteCollection>" -SecondaryOwnerAlias "secondary admin"
The normal user starts behaving normally no more access denied while accessing images
I am not able to find any possible reason behind this
Additional information: all of the users are claims based user