protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext) { bool result1 = base.AuthorizeCore(httpContext); var roles = System.Web.Security.Roles.GetRolesForUser(); bool result2 = roles.Any(r => RoleCapabilitiesManager.CanRoleAccessUnit(r, Name)); bool result = result1 && result2; if (result == false) { TongJi.Web.Notifications.Notification.EnqueueMessage(string.Format("您所在的用户组没有访问此功能模块({0})的权限,请咨询您的管理员。", Name)); } return(result); }
public static bool CanUserLogin(string user) { var roles = System.Web.Security.Roles.GetRolesForUser(user); return(roles.All(r => RoleCapabilitiesManager.CanRoleLogin(r))); }