protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { try { var roles = CustomerManager.GetAllCustomerRoles(); if (roles.Count == 0) { lblMessage.Text = GetLocaleResourceString("Admin.ACL.NoRolesDefined"); return; } SettingManager.SetParam("ACL.Enabled", cbACLEnabled.Checked.ToString()); foreach (GridViewRow row in gvACL.Rows) { foreach (CustomerRole cr in roles) { CheckBox cbAllow = row.FindControl(string.Format("cbAllow_{0}", cr.CustomerRoleId)) as CheckBox; HiddenField hfCustomerActionId = row.FindControl(string.Format("hfCustomerActionId_{0}", cr.CustomerRoleId)) as HiddenField; if (cbAllow == null || hfCustomerActionId == null || String.IsNullOrEmpty(hfCustomerActionId.Value)) { return; } bool allow = cbAllow.Checked; int customerActionId = int.Parse(hfCustomerActionId.Value); var acls = ACLManager.GetAllAcl(customerActionId, cr.CustomerRoleId, null); if (acls.Count > 0) { ACL acl = acls[0]; ACLManager.UpdateAcl(acl.AclId, customerActionId, cr.CustomerRoleId, allow); } else { ACL acl = ACLManager.InsertAcl(customerActionId, cr.CustomerRoleId, allow); } } } Response.Redirect("ACL.aspx"); } catch (Exception exc) { ProcessException(exc); } } }
protected void BindGrid() { var actions = ACLManager.GetAllCustomerActions(); if (actions.Count == 0) { lblMessage.Text = GetLocaleResourceString("Admin.ACL.NoActionDefined"); return; } var roles = CustomerManager.GetAllCustomerRoles(); if (roles.Count == 0) { lblMessage.Text = GetLocaleResourceString("Admin.ACL.NoRolesDefined"); return; } List <CustomerActionACLMappingHelperClass> dt = new List <CustomerActionACLMappingHelperClass>(); foreach (CustomerAction ca in actions) { CustomerActionACLMappingHelperClass map1 = new CustomerActionACLMappingHelperClass(); map1.CustomerActionId = ca.CustomerActionId; map1.CustomerActionName = ca.Name; map1.Allow = new Dictionary <int, bool>(); foreach (CustomerRole cr in roles) { var acls = ACLManager.GetAllAcl(ca.CustomerActionId, cr.CustomerRoleId, null); if (acls.Count > 0) { ACL acl = acls[0]; map1.Allow.Add(cr.CustomerRoleId, acl.Allow); } else { map1.Allow.Add(cr.CustomerRoleId, false); } } dt.Add(map1); } gvACL.DataSource = dt; gvACL.DataBind(); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageLanguagesLocalization")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManagePaymentSettings")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageReturnRequests")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageCustomerRoles")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageCountriesStates")); }
protected override bool ValidatePageSecurity() { return ACLManager.IsActionAllowed("ManageComposersxx"); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageMessageQueue")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("MangeEmailDirectory")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageWarehouses")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageMaintenance")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageThirdPartyIntegration")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageSMSProviders")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageCatalog")); }
protected override bool ValidatePageSecurity() { return(ACLManager.IsActionAllowed("ManageProductFeeds")); }
public void ProcessACEs(string usersFile, string aclFile, bool deletionMode) { List <string> usersList = new List <string>(); List <ACEItem> aceList = new List <ACEItem>(); try { usersList = FileAccess.GetUsersFileData(usersFile); } catch (Exception ex) { Log.WriteLogEntry("ERROR", String.Format("Error while reading Users file: {0}", ex.Message), "Error while reading Users file."); CleanupEnvironment(); Program.CloseApplicationOnError(); } try { aceList = FileAccess.GetACLFileData(aclFile); } catch (Exception ex) { Log.WriteLogEntry("ERROR", String.Format("Error while reading ACL file: {0}", ex.Message), "Error while reading ACL file."); CleanupEnvironment(); Program.CloseApplicationOnError(); } if ((aceList.Count > 0) && (usersList.Count > 0)) { ucmaPlatform.StartupPlatform(); ucmaEndpoint = new Endpoint(ucmaPlatform.CollabPlatform); ACLManager aclManager = new ACLManager(ucmaEndpoint); foreach (string user in usersList) { Log.WriteLogEntry("INFO", String.Format("Processing user {0}...", user.ToLowerInvariant()), String.Format("Processing user {0}...", user.ToLowerInvariant())); try { if (!deletionMode) { aclManager.AddACEs(user, aceList); } else { aclManager.RemoveACEs(user, aceList); } } catch (RegisterException rex) { Log.WriteLogEntry("ERROR", String.Format("Error while processing user {0}: {1}. Inner Exception: {2}. Diag Info: {3}.", user.ToLowerInvariant(), rex.Message, (rex.InnerException == null ? "N/A" : rex.InnerException.Message), (String.IsNullOrEmpty(rex.DiagnosticInformation.ToString()) ? "N/A" : rex.DiagnosticInformation.ToString())), String.Format("Error while processing user {0}", user.ToLowerInvariant())); } catch (Exception ex) { Log.WriteLogEntry("ERROR", String.Format("Error while processing user {0}: {1}. Inner Exception: {2}", user.ToLowerInvariant(), ex.Message, (ex.InnerException == null ? "N/A" : ex.InnerException.Message)), String.Format("Error while processing user {0}", user.ToLowerInvariant())); } } } else { Log.WriteLogEntry("WARNING", "Users or ACL file is empty or invalid. No action will be performed."); } }