📄 customrolesprovider.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.ObjectModel;
namespace Shokr.Security.RuleBasedSecurity
{
public class CustomRolesProvider : RoleProvider
{
public override void AddUsersToRoles(string[] usernames, string[] roleNames)
{
throw new Exception("The method or operation is not implemented.");
}
public override string ApplicationName
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
public override void CreateRole(string roleName)
{
throw new Exception("The method or operation is not implemented.");
}
public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
{
throw new Exception("The method or operation is not implemented.");
}
public override string[] FindUsersInRole(string roleName, string usernameToMatch)
{
throw new Exception("The method or operation is not implemented.");
}
public override string[] GetAllRoles()
{
throw new Exception("The method or operation is not implemented.");
}
public override string[] GetRolesForUser(string username)
{
return SecurityProvider.GetRolesForUser(username);
}
public override string[] GetUsersInRole(string roleName)
{
throw new Exception("The method or operation is not implemented.");
}
public override bool IsUserInRole(string username, string roleName)
{
return SecurityProvider.IsUserInRule(HttpContext.Current.User, roleName);
}
public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
{
throw new Exception("The method or operation is not implemented.");
}
public override bool RoleExists(string roleName)
{
throw new Exception("The method or operation is not implemented.");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -