Пример #1
0
 /// <summary>
 /// Loads the access control rules for the given user's access control group
 /// </summary>
 /// <returns>Access control rules for the given user's access control group</returns>
 AccessControlGroupStructure LoadAccessControl()
 {
     if (!_accessControlCache.Exists(_userSignon.DefaultAccessGroupCode.ToString()))
     {
         AccessControlGroupStructure accessControlGroup = new AccessControlGroupStructure();
         accessControlGroup.AccessGroupCode = _userSignon.DefaultAccessGroupCode;
         CacheMgr <bool> accessControlRules = new CacheMgr <bool>();
         DbCommand       dbCmd = _daMgr.DbCmdCacheGetOrAdd(Constants.AccessControlGroupRules,
                                                           BuildCmdGetAccessControlRulesList);
         dbCmd.Parameters[_daMgr.BuildParamName(Constants.AccessControlGroupCode)].Value
             = _userSignon.DefaultAccessGroupCode;
         DataTable accessRules = _daMgr.ExecuteDataSet(dbCmd, null, null).Tables[0];
         foreach (DataRow accessRule in accessRules.Rows)
         {
             accessControlGroup.DefaultAccessDenied = Convert.ToBoolean(
                 accessRule[Constants.DefaultAccessDenied]);
             accessControlGroup.AccessGroupName = accessRule[Constants.AccessControlGroupName].ToString();
             if (accessRule[Constants.UIControlCode] != DBNull.Value)
             {
                 Int32 uiControlCode = Convert.ToInt32(accessRule[Constants.UIControlCode]);
                 bool  accessDenied  = Convert.ToBoolean(accessRule[Constants.AccessDenied]);
                 accessControlRules.Set(uiControlCode.ToString(), accessDenied);
             }
             accessControlGroup.AccessControlRules = accessControlRules;
         }
         _accessControlCache.Set(_userSignon.DefaultAccessGroupCode.ToString(), accessControlGroup);
     }
     return(_accessControlCache.Get(_userSignon.DefaultAccessGroupCode.ToString()));
 }