public static List<CMetaobjectLink> sFilterDestinationLinksByUser(List<CMetaobjectLink> List, CSystemUser User)
 {
     List<CMetaobjectLink> R = new List<CMetaobjectLink>();
     foreach (CMetaobjectLink Object in List)
     {
         if (User.SecurityRecords.Where(S => S.MetaobjectKey == Object.SourceObjectKey && S.Rights > 0).ToList().Count != 0)
             R.Add(Object);
     }
     return R;
 }
Beispiel #2
0
        public List<CSystemUser> GetUsers(IDatabaseProvider Provider)
        {
            var Links = CMetaobjectLink.sGetInternalLinksByClass(this._key, EnMetaobjectClass.ESystemUser, Provider);
            foreach (CMetaobjectLink Link in Links)
            {
                CSystemUser User = new CSystemUser(Link.LinkedObjectKey, Provider);
                this._users.Add(User);
            }

            return this._users;
        }
 public static List<CMediaResource> sFilterMediaByUser(List<CMediaResource> List, CSystemUser User)
 {
     List<CMediaResource> R = new List<CMediaResource>();
     foreach (CMediaResource Object in List)
     {
         var Rights = User.GetRightsForMetaobject(Object);
         if (Rights > 0)
         {
             if (Object.Status == EnMetaobjectStatus.EDisabled || Object.Status == EnMetaobjectStatus.EBanned)
                 continue;
             Object.Children = sFilterObjectsByUser(Object.Children, User);
             R.Add(Object);
         }
     }
     return R;
 }
 public static List<CMetaobject> sFilterObjectsByUser(List<CMetaobject> List, CSystemUser User, bool FilterByStatus = true)
 {
     List<CMetaobject> R = new List<CMetaobject>();
     foreach (CMetaobject Object in List)
     {
         var Rights = User.GetRightsForMetaobject(Object);
         if (Rights > 0)
         {
             if (FilterByStatus && (Object.Status == EnMetaobjectStatus.EDisabled || Object.Status == EnMetaobjectStatus.EBanned))
                 continue;
             Object.Children = sFilterObjectsByUser(Object.Children, User, FilterByStatus);
             R.Add(Object);
         }
     }
     return R;
 }
Beispiel #5
0
        public static List<CSystemUser> sGetAllUsers(IDatabaseProvider Provider)
        {
            List<CSystemUser> R = new List<CSystemUser>();

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

            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 User = new CSystemUser(Provider);
                User.Key = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
                User.ID = Guid.Parse(T.Rows[i][1].PostProcessDatabaseValue<string>());
                User.Parent = T.Rows[i][2].PostProcessDatabaseValue<decimal>();
                User.Class = T.Rows[i][3].PostProcessDatabaseValue<EnMetaobjectClass>();
                User.System = (T.Rows[i][4].PostProcessDatabaseValue<int>() == 1);
                User.ModificatonDate = T.Rows[0][5].PostProcessDatabaseValue<DateTime>();
                User.Status = T.Rows[0][6].PostProcessDatabaseValue<EnMetaobjectStatus>();
                User.Attributes.ObjectKey = User.Key;
                R.Add(User);
            }

            return R;
        }