예제 #1
0
        /// <summary>
        /// Initializes the enumerations.
        /// </summary>
        public void Init(ConfigDataset configDataset)
        {
            if (configDataset == null)
            {
                throw new ArgumentNullException(nameof(configDataset));
            }

            foreach (Format format in configDataset.FormatTable.EnumerateItems())
            {
                if (format.IsEnum)
                {
                    Add(format.FormatID, EnumFormat.Parse(format));
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes the access rights.
        /// </summary>
        public void Init(ConfigDataset configDataset)
        {
            if (configDataset == null)
            {
                throw new ArgumentNullException(nameof(configDataset));
            }

            // initialize rights matrix
            Matrix = new Dictionary <int, RightByObj>(configDataset.RoleTable.ItemCount);

            // get indexes
            if (!configDataset.RoleRefTable.TryGetIndex("ChildRoleID", out ITableIndex roleRef_childRoleIndex))
            {
                throw new ScadaException(CommonPhrases.IndexNotFound);
            }

            if (!configDataset.ObjRightTable.TryGetIndex("RoleID", out ITableIndex objRight_roleIndex))
            {
                throw new ScadaException(CommonPhrases.IndexNotFound);
            }

            if (!configDataset.ObjTable.TryGetIndex("ParentObjNum", out ITableIndex obj_parentObjIndex))
            {
                throw new ScadaException(CommonPhrases.IndexNotFound);
            }

            // fill rights
            foreach (Role role in configDataset.RoleTable.EnumerateItems())
            {
                int        roleID     = role.RoleID;
                RightByObj rightByObj = new RightByObj();
                Matrix.Add(roleID, rightByObj);
                AddRoleRight(objRight_roleIndex, obj_parentObjIndex, rightByObj, roleID);

                foreach (int parentRoleID in EnumerateParentRoleIDs(roleRef_childRoleIndex, roleID))
                {
                    AddRoleRight(objRight_roleIndex, obj_parentObjIndex, rightByObj, parentRoleID);
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public RightMatrix(ConfigDataset configDataset)
 {
     Init(configDataset);
 }
예제 #4
0
 /// <summary>
 /// Binds the view to the configuration database.
 /// </summary>
 public virtual void Bind(ConfigDataset configDataset)
 {
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public EnumDict(ConfigDataset configDataset)
     : base()
 {
     Init(configDataset);
 }