您的位置:首页 > 其它

Create a New SharePoint Permission Level and Bind it to an Existing SharePoint Group

2011-11-17 11:39 453 查看
Create a New SharePoint Permission Level and Bind it to an Existing SharePoint Group
这个例子是新建一个  permission level,名字为Example_xxxxxxxxxxx.建好之后.绑定这个permission level 到一个已经存在的组名字为Foo.

using (SPSite site = new SPSite( "http://moss/sites/PermExample" ))
{
using (SPWeb rootWeb = site.RootWeb)
{
string permissionLevelName = "Example_"+System.DateTime.Now.Ticks.ToString();

// Create a new Permission Level
SPRoleDefinition newPermissionLevel = new SPRoleDefinition();
newPermissionLevel.Name = permissionLevelName;
newPermissionLevel.Description = "Example Permission Level";
newPermissionLevel.BasePermissions =
SPBasePermissions.AddListItems |
SPBasePermissions.BrowseDirectories |
SPBasePermissions.EditListItems |
SPBasePermissions.DeleteListItems |
SPBasePermissions.AddDelPrivateWebParts;

// Add the permission level to web
rootWeb.RoleDefinitions.Add(newPermissionLevel);

// Bind to the permission level we just added
newPermissionLevel = rootWeb.RoleDefinitions[permissionLevelName];

// Create a new role Assignment using the SharePoint Group "Foo"
SPRoleAssignment roleAssignment = new SPRoleAssignment( (SPPrincipal)rootWeb.SiteGroups[ "Foo" ] );

// Add the Permission Level to the Foo SharePoint Group
roleAssignment.RoleDefinitionBindings.Add(newPermissionLevel);

// Add the new Role Assignment to the web
rootWeb.RoleAssignments.Add(roleAssignment);

rootWeb.Close();
}
site.Close();
}


这样就新建成功了.也绑定到了已经存在的组.!

另一种是不写代码直接在网站上添加的方法

Create a permission level

If there is no permission level similar to the one you need, you can create one and include just the permissions that you need.

1:On the Site Settings page, under Users and Permissions, click Advanced permissions.

2:On the toolbar, click Settings, and then click Permission Levels.

3:On the toolbar, click Add a Permission Level.

4:On the Add a Permission Level page, in the Name box, type a name for the new permission level..

5:In the Description box, type a description for the new permission level..

6:In the list of permissions, select the check boxes to add permissions to the permission level

7:Click Create.

http://office.microsoft.com/en-us/windows-sharepoint-services-help/permission-levels-and-permissions-HA010100149.aspx

The following tables list and describe the permission levels that you can assign to users and SharePoint groups and the permissions you can assign to permission levels. For each permission, the permission level that it is associated with it, by default,
is listed. For each permission, any permissions dependent on it are listed, as well as any default permission levels that include the permission.

Default permission levels in Windows SharePoint Services 3.0

Permission LevelDescription
Full ControlThis permission level contains all permissions. Assigned to the Site name Owners SharePoint group, by default. This permission level cannot be customized or deleted.
DesignCan create lists and document libraries, edit pages and apply themes, borders, and style sheets in the Web site. Not assigned to any SharePoint group, by default.
ContributeCan add, edit, and delete items in existing lists and document libraries. Assigned to the
Site name Members SharePoint group, by default.
ReadRead-only access to the Web site. Users and SharePoint groups with this permission level can view items and pages, open items, and documents. Assigned to the
Site name Visitors SharePoint group, by default.
Limited AccessThe Limited Access permission level is designed to be combined with fine-grained permissions to give users access to a specific list, document library, item, or document, without giving them access to the entire site. However, to access a list or library,
for example, a user must have permission to open the parent Web site and read shared data such as the theme and navigation bars of the Web site. The Limited Access permission level cannot be customized or deleted.

Note You cannot assign this permission level to users or SharePoint groups. Instead, Windows SharePoint Services 3.0 automatically assigns this permission level to users and SharePoint groups when you grant them access
to an object on your site that requires that they have access to a higher level object on which they do not have permissions. For example, if you grant users access to an item in a list and they do not have access to the list itself, Windows SharePoint Services
3.0 automatically grants them Limited Access on the list, and also the site, if needed.



List, site, and personal permissions

Windows SharePoint Services 3.0 includes 33 permissions, which are used in the five default permission levels. You can change which permissions are included in a particular permission level (except for the Limited Access and Full Control permission levels)
or create a new permission level to contain a specific set of permissions that you specify.

Permissions are categorized as list permissions, site permissions, and personal permissions, depending upon the objects to which they can be applied. For example, site permissions apply to a particular site, list permissions apply only to lists and libraries,
and personal permissions apply only to things like personal views, private Web Parts, etc. The following tables show permissions and the permission levels they are assigned to, by default.

List Permissions

PermissionFull ControlDesignContributeReadLimited Access
Manage ListsXX
Override Check-OutXX
Add ItemsXXX
Edit ItemsXXX
Delete ItemsXXX
View ItemsXXXX
Approve ItemsXX
Open ItemsXXXX
View VersionsXXXX
Delete VersionsXXX
Create AlertsXXXX
View Application PagesXXXXX

Site Permissions

PermissionFull ControlDesignContributeReadLimited Access
Manage PermissionsX
View Usage DataX
Create SubsitesX
Manage Web SiteX
Add and Customize PagesXX
Apply Themes and BordersXX
Apply Style SheetsXX
Create GroupsX
Browse DirectoriesXXX
Use Self-Service Site CreationXXXX
View PagesXXXX
Enumerate PermissionsX
Browse User InformationXXXXX
Manage AlertsX
Use Remote InterfacesXXXXX
Use Client Integration FeaturesXXXXX
OpenXXXXX
Edit Personal User InformationXXX

Personal Permissions

PermissionFull ControlDesignContributeReadLimited Access
Manage Personal ViewsXXX
Add/Remove Private Web PartsXXX
Update Personal Web PartsXXX


Dependencies and descriptions

Many permissions are dependent on other permissions. When you select a permission that is dependent on another, the permission on which it is dependent is also automatically selected. Likewise, clearing a permission on which other permissions are dependent
also clears the dependent permissions. The following tables describe what each permission is used for and lists dependent permissions, if applicable.

List permissions

PermissionDescriptionDependent permissions
Manage ListsCreate and delete lists, add or remove columns in a list, and add or remove public views of a list.View Items, View Pages, Open, Manage Personal Views
Override Check-OutDiscard or check in a document which is checked out to another user.View Items, View Pages, Open
Add ItemsAdd items to lists, add documents to document libraries, and add Web discussion comments.View Items, View Pages, Open
Edit ItemsEdit items in lists, edit documents in document libraries, edit Web discussion comments in documents, and customize Web Part Pages in document libraries.View Items, View Pages, Open
Delete ItemsDelete items from a list, documents from a document library, and Web discussion comments in documents.View Items, View Pages, Open
View ItemsView items in lists, documents in document libraries, and Web discussion comments.View Pages, Open
Approve ItemsApprove a minor version of a list item or document.Edit Items, View Items, View Pages, Open
Open ItemsView the source of documents with server-side file handlers.View Items, View Pages, Open
View VersionsView past versions of a list item or document.View Items, View Pages, Open
Delete VersionsDelete past versions of a list item or document.View Items, View Versions, View Pages, Open
Create AlertsCreate e-mail alerts.View Items, View Pages, Open
View Application PagesView documents and views in a list or document library.Open

Site permissions

PermissionDescriptionDependent permissions
Manage PermissionsCreate and change permission levels on the Web site and assign permissions to users and groups.Approve Items, Enumerate Permissions, Open
View Usage DataView reports on Web site usage.Approve Items, Open
Create SubsitesCreate subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.View Pages, Open
Manage Web SitePerform all administration tasks for the Web site as well as manage content.View Pages, Open
Add and Customize PagesAdd, change, or delete HTML pages or Web Part pages, and edit the Web site using a Windows SharePoint Services-compatible editor.View Items, Browse Directories, View Pages, Open
Apply Themes and BordersApply a theme or borders to the entire Web site.View Pages, Open
Apply Style SheetsApply a style sheet (.css file) to the Web site.View Pages, Open
Create GroupsCreate a group of users that can be used anywhere within the site collection.View Pages, Open
Browse DirectoriesEnumerate files and folders in a Web site using an interface such as SharePoint Designer or Web-based Distributed Authoring and Versioning (Web DAV).View Pages, Open
Use Self-Service Site CreationCreate a Web site using Self-Service Site Creation.View Pages, Open
View PagesView pages in a Web site.Open
Enumerate PermissionsEnumerate permissions on the Web site, list, folder, document, or list item.View Items, Open Items, View Versions, Browse Directories, View Pages, Open
Browse User InformationView information about users of the Web site.Open
Manage AlertsManage alerts for all users of the Web siteView Items, Create Alerts, View Pages, Open
Use Remote InterfacesUse Simple Object Access Protocol (SOAP), Web DAV, or SharePoint Designer interfaces to access the Web site.Open
OpenOpen a Web site, list, or folder to access items inside that container.No dependent permissions
Edit Personal User InformationAllow a user to change his or her own user information, such as adding a picture.Browse User Information, Open

Personal permissions

PermissionDescriptionDependent permissions
Manage Personal ViewsCreate, change, and delete personal views of lists.View Items, View Pages, Open
Add/Remove Private Web PartsAdd or remove private Web Parts on a Web Part Page.View Items, View Pages, Open, Update Personal Web Parts
Update Personal Web PartsUpdate Web Parts to display personalized information.View Items, View Pages, Open
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐