SharePoint 列表项权限

发布于 2024-07-25 11:39:57 字数 477 浏览 3 评论 0原文

我想以编程方式实现它,以便用户只能看到列表中的特定项目。

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

如果有帮助的话,请将其放在上下文中 - 该列表正在将工作角色注册到特定成员。 每个列表项都是一个角色分配,其中包含对角色列表中角色的查找和对成员列表中成员的查找。 我没有直接在角色的成员列表中使用多重查找字段,因为每个角色分配都需要保留有关它的额外信息,例如描述、开始日期等。 每个角色都有一个特定的用户/组来管理它。 我希望这样当用户查看这个大的角色分配列表时,只能看到他们所管理的角色的角色分配。

非常感谢您的建议。

I want to programmatically make it so that users can see only particuar items on the list.

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.

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.

Advice would be much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清风不识月 2024-08-01 11:39:58

您可以为各个列表项分配权限。 对于前。

        // 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);

但请注意为每个列表项分配权限对性能和操作的影响。

一般来说,我希望

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

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.

In general, I would prefer

  • Permissions assigned no deeper than the list level
  • As much as possible, assign permissions to groups and then include individual users into those groups.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文