public bool IsThisActionAllowedForThisRole(int pRoleId, ActionItemObject pAction) { string q = @"SELECT allowed FROM AllowedRoleActions WHERE action_id = @actionId AND role_id = @roleId"; using (SqlConnection conn = GetConnection()) { using (OpenCbsCommand c = new OpenCbsCommand(q, conn)) { c.AddParam("@roleId", pRoleId); c.AddParam("@actionId", pAction.Id); using (OpenCbsReader r = c.ExecuteReader()) { if (r != null) { if (!r.Empty) { return(r.GetBool("allowed")); } } } } } return(true); }
private void ModifyTotal() { var addaction = new ActionItemObject("LoanServices", "ModifyTotal"); _addaction = User.CurrentUser.UserRole.IsActionAllowed(addaction); if (_addaction) { _view.EnableTotalEdit(); return; } _view.DisableTotalEdit(); }
private void ValidatePermissions() { if (_village == null || _village.Id <= 0) { return; } var editAction = new ActionItemObject("ClientServices", "ModifyNonSolidarityGroup"); var modifyPermission = User.CurrentUser.UserRole.IsActionAllowed(editAction); btnSave.Enabled = modifyPermission; btnSearch.Enabled = modifyPermission; btnAdd.Enabled = modifyPermission; btnRemove.Enabled = modifyPermission; btnSetAsLeader.Enabled = modifyPermission; btnAddLoan.Enabled = modifyPermission; btnValidateLoans.Enabled = modifyPermission; btnDisburse.Enabled = modifyPermission; btnRepay.Enabled = modifyPermission; btnAddSavings.Enabled = modifyPermission; buttonViewSaving.Enabled = modifyPermission; buttonFastDeposit.Enabled = modifyPermission; buttonUpdateAttendence.Enabled = modifyPermission; }
public bool IsThisActionAllowedForThisRole(int pRoleId, ActionItemObject pAction) { string q = @"SELECT allowed FROM AllowedRoleActions WHERE action_id = @actionId AND role_id = @roleId"; using (SqlConnection conn = GetConnection()) { using (OpenCbsCommand c = new OpenCbsCommand(q, conn)) { c.AddParam("@roleId", pRoleId); c.AddParam("@actionId", pAction.Id); using (OpenCbsReader r = c.ExecuteReader()) { if (r != null) { if (!r.Empty) { return r.GetBool("allowed"); } } } } } return true; }
public bool IsThisActionAllowedForThisRole(int pRoleId, ActionItemObject pAction) { return _roleManager.IsThisActionAllowedForThisRole(pRoleId, pAction); }
public bool IsThisActionAllowedForThisRole(int pRoleId, ActionItemObject pAction) { return(_roleManager.IsThisActionAllowedForThisRole(pRoleId, pAction)); }
public bool IsThisActionAllowedForThisRole(int pRoleId, ActionItemObject pAction) { string sqlText = @"SELECT allowed FROM AllowedRoleActions WHERE action_id = @actionId AND role_id = @roleId"; using (SqlCommand sqlCommand = new SqlCommand(sqlText, DefaultConnection)) { DatabaseHelper.InsertInt32Param("@roleId", sqlCommand, pRoleId); DatabaseHelper.InsertInt32Param("@actionId", sqlCommand, pAction.Id); using (SqlDataReader reader = sqlCommand.ExecuteReader()) { if (reader != null) { if (reader.HasRows) return DatabaseHelper.GetBoolean("allowed", reader); } } } return true; }