Summary:
Recently, a user who wants to implement the following functionality, if the user belongs to the owner group, can edit some fields in a new and edited screen of a list, and only those fields are allowed if the user does not belong to the owner group. Users use shared Hosting environment, which can only be developed through the client.
Scheme:
First let's assume you already know how to modify the NewForm.aspx and EditForm.aspx screen by designer, hide the default list items edit Web Part, and add new list items to edit the Web Part to learn how to add a Web Part to manipulate the field.
After you've done that, we'll just take the default title field as an example, just call <xsl:if test= "ddwrt:ifhasrights (33554432)" > To determine the user's identity to see if the field is displayed. The parameters given in Ifhasrights are called Permissionmark, and we then give all the reference values.
<xsl:if test= "ddwrt:ifhasrights (33554432)" >
<td width= "75%" class= "Ms-vb" >
<sharepoint: FormField runat= "Server" id= "ff1{$Pos}" controlmode= "New" fieldname= "Title" __designer:bind= "{ddwrt:databind (' I '), Concat (' ff1 ', $Pos), ' Value ', ' valuechanged ', ' ID ', Ddwrt:escapedelims (String (@ID)), ' @Title '} ' />
< Sharepoint:fielddescription runat= "Server" id= "ff1description{$Pos}" fieldname= "Title" controlmode= "Edit" / >
</td>
</xsl:if>
The above mentioned only the core content, but also some trivial work also need to do:
1. How to write an else statement inside XSL (should be using <xsl:choose>)
2. Displays the value of the field when it is not part of the owner group (should be using <xsl:value-of select= "$Title" >)
There are some interesting things to investigate:
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/web/sharepoint/
1. How to pass variables to XSL variables from JavaScript (so we can also consider more complex scenarios, such as returning the group information that the user belongs to by WebService)
Here are all the permissionmask you can use:
ViewListItems-1
AddListItems-2
EditListItems-4
DeleteListItems-8
ApproveItems-16
OpenItems-32
ViewVersions-64
DeleteVersions-128
CancelCheckout-256
PersonalViews-512
ManageLists-2048
ViewFormPages-4096
Open-65536
ViewPages-131072
AddAndCustomizePages-262144
ApplyThemeAndBorder-524288
ApplyStyleSheets-1048576
ViewUsageData-2097152
CreateSSCSite-4194314
ManageSubwebs-8388608
CreateGroups-16777216
ManagePermissions-33554432
BrowseDirectories-67108864
BrowseUserInfo-134217728
AddDelPrivateWebParts-268435456
UpdatePersonalWebParts-536870912
ManageWeb-1073741824
UseRemoteAPIs-137438953472
ManageAlerts-274877906944
CreateAlerts-549755813888
EditMyUserInfo-1099511627776
EnumeratePermissions-4611686018427387904
FullMask-9223372036854775807
Author: cnblogs Johnsonwang