Example #1
0
        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);
        }
Example #2
0
        private void ModifyTotal()
        {
            var addaction = new ActionItemObject("LoanServices", "ModifyTotal");

            _addaction = User.CurrentUser.UserRole.IsActionAllowed(addaction);
            if (_addaction)
            {
                _view.EnableTotalEdit();
                return;
            }
            _view.DisableTotalEdit();
        }
Example #3
0
        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;
        }
Example #4
0
        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;
        }
Example #5
0
 public bool IsThisActionAllowedForThisRole(int pRoleId, ActionItemObject pAction)
 {
     return _roleManager.IsThisActionAllowedForThisRole(pRoleId, pAction);
 }
Example #6
0
 public bool IsThisActionAllowedForThisRole(int pRoleId, ActionItemObject pAction)
 {
     return(_roleManager.IsThisActionAllowedForThisRole(pRoleId, pAction));
 }
Example #7
0
        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;
        }