public static bool Check(Customer customer, string currentPage) { if (customer.CustomerRole != Role.Moderator || currentPage.Contains("default.aspx") || currentPage.Contains("filemanager.ashx")) { return(true); } var page = currentPage.Contains("productsonmain.aspx") ? currentPage.Split(new[] { '/' }).Last() : currentPage.Split(new[] { '?' }).First().Split(new[] { '/' }).Last(); if (dictionary.ContainsKey(page)) { RoleActionKey key = dictionary[page]; return (RoleActionService.GetCustomerRoleActionsByCustomerId(customer.Id) .Any(a => a.Key == key && a.Enabled)); } return(false); }
public bool HasRoleAction(RoleActionKey key) { return(RoleActionService.HasCustomerRoleAction(Id, key)); }
public static bool HasCustomerRoleAction(Guid customerId, RoleActionKey key) { return(SQLDataAccess.ExecuteScalar <int>("Select count (RoleActionKey) From Customers.CustomerRoleAction Where CustomerID = @CustomerID And RoleActionKey = @Key and Enabled=1", CommandType.Text, new SqlParameter("@CustomerID", customerId), new SqlParameter("@Key", key.ToString())) > 0); }
public static bool CanUseInplace(RoleActionKey role) { return(SettingsMain.EnableInplace && (CustomerContext.CurrentCustomer.IsAdmin || (CustomerContext.CurrentCustomer.IsModerator && CustomerContext.CurrentCustomer.HasRoleAction(role)) || Trial.TrialService.IsTrialEnabled)); }