SharePoint列表项权限 [英] SharePoint list item permissions

查看:166
本文介绍了SharePoint列表项权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式实现此目的,以便用户只能在列表上看到特定的项目.

基本上,在创建项目时运行的工作流程中,我将做一些事情,并通知某些人有关此项目的信息.我还希望它更改项目的权限,以便只有特定用户(基于项目内容在运行时查找)可以读取项目.有权访问该列表的其余用户将仅看到特定项目,而并非全部.列表项可能不一定是所有者,但需要查看的用户才拥有,因此我无法将列表权限设置为仅允许用户查看自己的项目.

Basically in an workflow that runs when an item is created I'm going to do some stuff and notify some people about this item. I also want it to change the permissions on the item so that only particular users (looked up on runtime based on the items contents) can read the item. The rest of the users that have access to the list will only see particular items but not all of them. The list item might not necessarily be owned but the user(s) that need to see it so I can't set the list permissions to letting users only see their own items.

在有帮助的情况下将其置于上下文中-列表正在将工作角色注册到特定成员.每个列表项都是一个角色分配,其中包含对角色列表中的角色的查找以及对成员列表中的成员的查找.我没有直接在成员列表中使用角色的multilookup字段,因为每个角色分配都需要保留有关它的额外信息,例如描述,开始日期等. 每个角色都有一个管理它的特定用户/组.我希望这样做,以便在转到如此大的角色分配列表时,用户只能看到他们作为其经理的角色的角色分配.

To put this into context if it helps- The list is registering job roles to a particular member. Every list item is a role assignment that contains a lookup to a role in the roles list and a lookup to a member in the members list. I'm not directly using a multilookup field in the members list for roles because each role assignment needs extra information held about it such as a description, a start date ect. Each role has a particular user/group that manages it. I want it so that when going to this big list of role assignments, a user can only see the role assignments for the roles that they are the manager of.

建议将不胜感激.

推荐答案

您可以为单个列表项分配权限.例如.

You can assign permissions to individual list items. For ex.

        // get list item
        SPListItem item = <your list item>;
        if (!item.HasUniqueRoleAssignments)
        {
            item.BreakRoleInheritance(true);
        }

        // get principal
        SPPrincipal principal = <principal to grant permissions to>;

        // get role definition
        SPRoleDefinition rd = <role that contains the permissions to be granted to the principal>;

        // create role assignment
        SPRoleAssignment ra = new SPRoleAssignment(principal);
        ra.RoleDefinitionBindings.Add(rd);
        item.RoleAssignments.Add(ra);

但是请注意,为每个列表项分配权限的性能和操作隐患.

But beware about the performance and operational implications of assigning permissions per list item.

总的来说,我更愿意

  • 分配的权限不超过列表级别
  • 尽可能将权限分配给组,然后将单个用户包括在这些组中.

这篇关于SharePoint列表项权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆