public static bool HasPermission(this IPrincipal user, params string[] currentPermissions) { var session = new MongoSession(MongoMembershipProvider.ConnectionString); var userEntity = session.Users.FirstOrDefault(x => x.UserName == user.Identity.Name); return(AuthorizeHelper.CheckUser(userEntity, session.Roles, session.Permissions, currentPermissions)); }
protected override bool AuthorizeCore(HttpContextBase httpContext) { if (httpContext == null) { throw new ArgumentNullException("httpContext"); } if (Permissions.Length == 0) { return(base.AuthorizeCore(httpContext)); } else { var provs = Membership.Providers; return(AuthorizeHelper.CheckUser(GetUser(httpContext.User), GetAllRoles(), GetAllPermissions(), _permissions)); } }