protected void SetUserValues(User Usr, User DefUsr, ADUserInfo ADUsrInf, bool bUsrPro)
        {
            IDList GrpIDLst = null, DefGrpIDLst = null;
            int    nID = Global.IntegerNull;

            //--- Check user profile
            if (bUsrPro)
            {
                //--- Set the profile values
                Usr.SetChangeHistoryMask(DefUsr.GetChangeHistoryMask());
                Usr.SetDatePreference(DefUsr.GetDatePreference());
                Usr.SetTimePreference(DefUsr.GetTimePreference());
                Usr.SetOffsetFromGMT(DefUsr.GetOffsetFromGMT());
                Usr.SetTimeZone(DefUsr.GetTimeZone());
                Usr.SetLocale(DefUsr.GetLocale());
                Usr.SetDstSavings(DefUsr.GetDstSavings());
                Usr.SetBrowserMask(DefUsr.GetBrowserMask());
                Usr.SetFieldsMask(DefUsr.GetFieldsMask());
                Usr.SetNotesMask(DefUsr.GetNotesMask());
                Usr.SetMaxChangeHistory(DefUsr.GetMaxChangeHistory());
                Usr.SetMaxItemsPerPage(DefUsr.GetMaxItemsPerPage());
                Usr.SetMaxNotes(DefUsr.GetMaxNotes());
                Usr.SetNamespaceName(DefUsr.GetNamespaceName());
            }

            //--- Set the user ident values
            Usr.SetLoginID(ADUsrInf.LoginID.ToUpper());
            Usr.SetDisplayName(ADUsrInf.DisplayName);
            Usr.SetPhoneNumber(ADUsrInf.TelephoneNumber);
            Usr.SetEmail(ADUsrInf.Email);
            Usr.SetEmailCC(ADUsrInf.PersonnelNumber.ToString());

            GrpIDLst    = Usr.GetGroupIDs();
            DefGrpIDLst = DefUsr.GetGroupIDs();

            //--- Add the default group IDs to the group IDs
            for (int nGrpIdx = 0; nGrpIdx < DefGrpIDLst.Count; nGrpIdx++)
            {
                //--- Get the default group ID
                nID = DefGrpIDLst[nGrpIdx];

                //--- Add the default group ID to the group IDs if not exists
                if (!GrpIDLst.Contains(nID))
                {
                    GrpIDLst.Add(nID);
                }
            }

            //--- Set the group IDs
            Usr.SetGroupIDs(GrpIDLst);

            //--- Set the default access type if the default access type is more
            if (DefUsr.GetAccessType() > Usr.GetAccessType())
            {
                Usr.SetAccessType(DefUsr.GetAccessType());
            }

            //--- Clear the deleted flag
            Usr.SetDeleted(false);
        }
 void AddAllActions(IDList list, ControllerType controllerType, IDList existingList)
 {
     foreach (var action in ControllerAction.GetAllActions(controllerType.Id))
     {
         if (!existingList.Contains(new ID(action.Id)))
         {
             list.Add(new ID(action.Id));
         }
     }
 }
 void AddAllNamespaces(IDList list, IDList existingList)
 {
     foreach (var nspace in ControllerType.GetAllNamespaces())
     {
         if (!existingList.Contains(new ID(nspace.Key)))
         {
             list.Add(new ID(nspace.Key));
         }
     }
 }
Esempio n. 4
0
        public override IDList GetChildIDs(ItemDefinition itemDefinition, CallContext context)
        {
            Assert.ArgumentNotNull(itemDefinition, "itemDefinition");
            Assert.ArgumentNotNull(context, "context");

            if (!ShouldExecuteProvider(itemDefinition.ID))
            {
                return(null);
            }

            context.Abort();
            var childIds = base.GetChildIDs(itemDefinition, context);

            var filteredChildren = new IDList();

            foreach (ID child in childIds)
            {
                if (ShouldExecuteProvider(child))
                {
                    filteredChildren.Add(child);
                }
            }

            // invoke the other data providers, if any, and *unique* the child IDs
            // this allows us to merge serialized items on top of an existing database item
            // (without this uniquing we'd get two identical children for items that were both
            // serialized AND in the other providers)
            var providers = Database.GetDataProviders();

            for (int i = context.Index + 1; i < context.ProviderCount; i++)
            {
                var otherChildIds = providers[i].GetChildIDs(itemDefinition, context);

                if (otherChildIds == null)
                {
                    continue;
                }

                foreach (ID child in otherChildIds)
                {
                    if (!filteredChildren.Contains(child))
                    {
                        filteredChildren.Add(child);
                    }
                }
            }

            return(filteredChildren);
        }
        void AddAllActions(IDList list, ControllerType controllerType, CallContext context)
        {
            var sqlProvider = GetSqlProvider(Database);

            foreach (var action in ControllerAction.GetAllActions(controllerType.Id).Where(a =>
            {
                return(GetSqlVersion(new ID(a.Id), context, sqlProvider) == null);
            }))
            {
                if (!list.Contains(new ID(action.Id)))
                {
                    list.Add(new ID(action.Id));
                }
            }
        }
 void AddControllers(IDList list, Guid parentId, IDList existingList)
 {
     foreach (var controller in ControllerType.GetAllControllers().Values.Where(c => c.ParentId == parentId && !existingList.Contains(new ID(c.Id))))
     {
         list.Add(new ID(controller.Id));
     }
 }
		public override IDList GetChildIDs(ItemDefinition itemDefinition, CallContext context)
		{
			Assert.ArgumentNotNull(itemDefinition, "itemDefinition");
			Assert.ArgumentNotNull(context, "context");

			if (!ShouldExecuteProvider(itemDefinition.ID)) return null;

			context.Abort();
			var childIds = base.GetChildIDs(itemDefinition, context);

			var filteredChildren = new IDList();

			foreach (ID child in childIds)
			{
				if (ShouldExecuteProvider(child)) filteredChildren.Add(child);
			}

			// invoke the other data providers, if any, and *unique* the child IDs
			// this allows us to merge serialized items on top of an existing database item
			// (without this uniquing we'd get two identical children for items that were both
			// serialized AND in the other providers)
			var providers = Database.GetDataProviders();
			for (int i = context.Index + 1; i < context.ProviderCount; i++)
			{
				var otherChildIds = providers[i].GetChildIDs(itemDefinition, context);

				if (otherChildIds == null) continue;

				foreach (ID child in otherChildIds)
				{
					if (!filteredChildren.Contains(child)) filteredChildren.Add(child);
				}
			}

			return filteredChildren;
		}
 void AddAllActions(IDList list, ControllerType controllerType, CallContext context)
 {
     var sqlProvider = GetSqlProvider(Database);
     foreach (var action in ControllerAction.GetAllActions(controllerType.Id).Where(a =>
     {
         return GetSqlVersion(new ID(a.Id), context, sqlProvider) == null;
     }))
     {
         if (!list.Contains(new ID(action.Id)))
             list.Add(new ID(action.Id));
     }
 }