0

Here's the scenario:
There's a list on my SP site, call it TheList.
I'd like to display certain rows of the list, a view, based on info about the current user.
If that current user is an "admin" I'd like to display all rows in the list - the AllRows view.
If the current user is not an "admin" I'd like to only display rows that that user created.
There is nothing in the user's SP profile or LDAP profile that would identify them as an admin.
I'd like to create a list called MyAdmins and put users in that list who I say are admins.

I'd like a user who's in the MyAdmins list to see all rows in TheList. I.e., the AllRows view.
I'd like a user who's not in the MyAdmins list to see rows of TheList where they were the creator of that row.

What are my options for accomplishing this? There is probably more than one way to make this happen.
At a high level I think (maybe) I want to create a piece of logic/code that performs these tests, returns a view name to be used when displaying the list, and somehow tie that piece of logic to the list.

Your thoughts? Thanks

0

There are multiple options indeed, some options:

  1. Using audiences (create an audience which holds all your admins). Audience could be from AD or just a SharePoint group. Use two list view webparts and assign one of the views to your admin audience.
  2. Use Item-Level permission on the list and configure it so users can only see items created by them. Admins, which have higher permissions, should be able to see all items
  3. JSlink to filter out items but keep in mind that CSR is meant to change who items are displayed. Your view will of for example of 10 items will be limited to showing 8 (if 2 items are filtered).
  4. If it's not a security issue, use audience targeting on your navigation links (one link for admins and one for users).
  5. Redirect the admins to the admin view. Use javascript on the main view to check users permissions and redirect to a different view.

Have your pick. If it's a security issue then go for the item-level permission option. Otherwise using audiences is a quick and easy option.

| improve this answer | |
0

You should be able to do it with CSR (client side rendering) using JSLink on the list view web part.

I know we aren't supposed to put links in responses because they can go away but I think it's ok to link to Stack Exchange - if not, scold me...

See here for similar examples:

Filter out items in list view using jslink

| improve this answer | |
  • Thanks for the reply and no scolding re the link. I'll wait a bit and see if I get any other replies before voting. This seems like the way to go. – BobL Jan 29 '17 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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