0

I am facing a bit of a strange issue, let me try to elaborate.

There are three users

  1. Normal user
  2. Admin user
  3. 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

9
  • what template you are using team site or publishing?
    – Waqas Sarwar MVP
    Commented Apr 5, 2016 at 13:51
  • its a custom site definition based on publishing
    – user4205
    Commented Apr 5, 2016 at 13:53
  • check if in the Style resource reader groups is there in permission and also all authenticated users added into this group
    – Waqas Sarwar MVP
    Commented Apr 5, 2016 at 13:55
  • There are no such groups i can confirm?
    – user4205
    Commented Apr 5, 2016 at 14:11
  • then this is problem. if you remove this group or remove all authneticated user from this group then all users will get access denied....but if Site collection admin login then rest user will see the pages for some time.
    – Waqas Sarwar MVP
    Commented Apr 5, 2016 at 14:13

1 Answer 1

0

Commom features/images/scripts/styles should always be set to let NT Authority\Autheticated users read.

Imagine that some resources referenced in your masterpage are restricted. Then, everybody will get tons of "Access Denied".

About the "Site Pages" issue:

Your site pages are referencing something different? Like custom webparts calling CSS/JS or something like that?

2
  • Yes, Site pages are referencing both, custom webparts and custom css/js,I tried removing the custom webparts but still getting access denied, does that mean it have to do something with css/js?
    – user4205
    Commented Apr 7, 2016 at 20:46
  • You probably need to check every file that is referenced in your page... this access denied message can be triggered by Images, Scrips, Styles etc. Once you find these files, you will need to check their permissions. They need to be "public" (read for all authenticated users). Commented Apr 8, 2016 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.