Example #1
0
        public List<CMetaobjectSecurityRecord> GetSecurityRecords(IDatabaseProvider Provider)
        {
            this._securityRecords = CMetaobjectSecurityRecord.sGetRecordsByUser(this._key, Provider);

            var Links = CMetaobjectLink.sGetInternalLinksByClass(this._key, EnMetaobjectClass.ESystemUserGroup, Provider);
            foreach (CMetaobjectLink Link in Links)
            {
                CSystemUserGroup Group = new CSystemUserGroup(Provider);
                Group.Key = Link.SourceObjectKey;
                Group.GetSecurityRecords(Provider);
                foreach (CMetaobjectSecurityRecord Record in Group.SecurityRecords)
                {
                    if (this._securityRecords.Where(R => R.MetaobjectKey == Record.MetaobjectKey).ToList().Count == 0)
                        this._securityRecords.Add(Record);
                }
            }

            return this._securityRecords;
        }
Example #2
0
        public static List<CSystemUserGroup> sGetAllGroups(IDatabaseProvider Provider)
        {
            List<CSystemUserGroup> R = new List<CSystemUserGroup>();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_CLASS, EnMetaobjectClass.ESystemUserGroup);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ID + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_OBJ_PARENT + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_CLASS + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_SYSTEM + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_MOD + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_STATUS;
            SQL += " FROM " + CDBConst.CONST_TABLE_OBJECTS + " WHERE " + CDBConst.CONST_TABLE_FIELD_OBJ_CLASS + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_CLASS;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null)
                return R;
            for (int i = 0; i < T.Rows.Count; i++)
            {
                var Group = new CSystemUserGroup(Provider);
                Group.Key = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
                Group.ID = Guid.Parse(T.Rows[i][1].PostProcessDatabaseValue<string>());
                Group.Parent = T.Rows[i][2].PostProcessDatabaseValue<decimal>();
                Group.Class = (EnMetaobjectClass)T.Rows[i][3].PostProcessDatabaseValue<int>();
                Group.System = (T.Rows[i][4].PostProcessDatabaseValue<int>() == 1);
                Group.ModificatonDate = T.Rows[0][5].PostProcessDatabaseValue<DateTime>();
                Group.Status = (EnMetaobjectStatus)T.Rows[0][6].PostProcessDatabaseValue<int>();
                Group.ExternalLinks = CMetaobjectLink.sGetExternalLinks(Group.Key, Provider);
                Group.InternalLinks = CMetaobjectLink.sGetInternalLinks(Group.Key, Provider);
                Group.Attributes.ObjectKey = Group.Key;
                R.Add(Group);
            }

            return R;
        }
Example #3
0
        public List<CSystemPolicy> GetPolicies(IDatabaseProvider Provider)
        {
            this._policies.Clear();

            var Links = CMetaobjectLink.sGetInternalLinksByClass(this._key, EnMetaobjectClass.ESystemPolicy, Provider);
            foreach (CMetaobjectLink Link in Links)
            {
                CSystemPolicy Policy = new CSystemPolicy(Link.LinkedObjectKey, Provider);
                this._policies.Add(Policy);
            }

            Links = CMetaobjectLink.sGetExternalLinksByClass(this._key, EnMetaobjectClass.ESystemUserGroup, Provider);
            foreach (CMetaobjectLink Link in Links)
            {
                CSystemUserGroup Group = new CSystemUserGroup(Provider);
                Group.Key = Link.SourceObjectKey;
                Group.GetPolicies(Provider);
                foreach (CSystemPolicy Policy in Group.Policies)
                {
                    if (this._policies.Where(P => P.ID.ToString() == Policy.ID.ToString()).ToList().Count == 0)
                        this._policies.Add(Policy);
                }
            }
            return this._policies;
        }