9

I have one list

    Title           Availability        Department
-----------------------------------------------------
    Microscope      Yes                 Biology
    Buret           No                  Chemistry
    Glass Tubes     Yes                 Biology

When any person belongs to Biology login to my site, I want to hide Chemistry related rows. Same case with Chemistry people also. How Can I set these permissions for a list. Is it possible way to do?

1
  • Is 100 items considered large in this case?
    – KYLO
    Sep 6, 2012 at 18:55

3 Answers 3

7
  1. If is only about viewing, then you should probably consider Views or go for Target Audience (this is will hide items from view automatically without changing permissions - does require User Profile)
  2. If you really need permissions than try building a workflow on particularly those conditions so that everytime a new list item gets added permissions are set
2
  • for your first point... When we create view we can restrict the columns.. not the rows. Am I right!!
    – Mihir
    Aug 11, 2012 at 10:25
  • 2
    You can restrict the rows by adding and audience to the list items. Then when users access the list, they'll see what they are scoped to see via the audience targeting, which can be sp groups or ad groups. Aug 11, 2012 at 13:44
2

Might not be the best option but because of limited information given by you I would suggest

You can create a custom Item level permission, and add that user to that particular group, but for this you will have to break inheritance. You can do this if Items are already there and list wont gonna get updated but if list will be updated frequently then you can have a feature receiver for adding Item, so that when a Item is added you can set its permission levels.

In both case you will have to break List Inheritance.

check this link out, might help :)

Item Level Permissions on a Custom List

Edit

Develop a Feature that will Break List Inheritance on activation, and then create a hidden bool column for your list as when "Maintenance Guy" will add a Item he will check box if item is related to chemistry, he will check box otherwise he will leave it blank.

Now make 2 permission levels one for chemistry students and one for biology, you can give permissions e.g. read list item or edit it, that's up 2 you.

Now develop a Item added Event Receiver that will check value of hidden column, if its true (then its related to chemistry students otherwise biology) then set that Item's permission as chemistry permission level if its not true then let that user have biology permission level you created earlier.

thats how I did it once, but if someone knows any better way they already tried then please share :)

6
  • What information you want more about this problem. I think it is sufficient. If not please tell me what you want. Then I can provide you. :)
    – Mihir
    Aug 14, 2012 at 12:09
  • what type of list it is, and who will be adding items to it, if it will be a particular user and you want to give him only specific permission then you can use Item Level permissions using a Item added feature. Aug 14, 2012 at 12:13
  • For example.. Maintenance guy will update the list. List is generic list (custom list). When Biology department person logged in then list should only appear with Biology items. Same case with other departments.
    – Mihir
    Aug 14, 2012 at 13:45
  • I updated my answer Aug 14, 2012 at 14:18
  • Be careful when recommending item level security. It can result in serious performance issues on large lists, especially if the unique security differs from item to item. Aug 16, 2012 at 9:50
0

can you be more specific? like is that in a grid view? if so filtering would be possible and easy to do with a small method that check with the user and filters the results accordingly.

if you want to know about the grid view than look here: http://msdn.microsoft.com/en-us/library/ms752213.aspx and here: What is SP Grid View & How to use it?

otherwise you would need to filter the data from a stored procedure within the .cs or on the database side to only return the results for the logged in user.

Your Answer

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

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