예제 #1
0
        public static IOguObject CreateWrapperObject(string id, SchemaType type)
        {
            IOguObject result = null;

            switch (type)
            {
            case SchemaType.Organizations:
                result = new OguOrganization(id);
                break;

            case SchemaType.Users:
                result = new OguUser(id);
                break;

            case SchemaType.Groups:
                result = new OguGroup(id);
                break;

            default:
                ExceptionHelper.TrueThrow(true, string.Format("SchemaType错误{0}", type));
                break;
            }

            return(result);
        }
예제 #2
0
        private IUser GetUser()
        {
            IUser user = new OguUser(Guid.NewGuid().ToString());
           

            return user;
        }
예제 #3
0
        /// <summary>
        /// 生成副本
        /// </summary>
        /// <returns>生成的副本</returns>
        public Material GenerateCopyVersion()
        {
            ExceptionHelper.TrueThrow <ArgumentNullException>(this == null, "this");

            Material material = new Material();

            material.id               = Guid.NewGuid().ToString();
            material.Department       = this.department;
            material.resourceID       = this.resourceID;
            material.sortID           = this.sortID;
            material.materialClass    = this.materialClass;
            material.title            = this.title;
            material.pageQuantity     = this.pageQuantity;
            material.relativeFilePath = this.relativeFilePath.Replace(this.id, material.ID);
            material.originalName     = this.originalName;

            if (DeluxePrincipal.IsAuthenticated)
            {
                material.Creator = (IUser)OguUser.CreateWrapperObject(DeluxeIdentity.CurrentRealUser);
            }

            material.lastUploadTag  = this.lastUploadTag;
            material.createDateTime = SNTPClient.AdjustedTime;
            material.modifyTime     = this.modifyTime;
            material.wfProcessID    = this.wfProcessID;
            material.wfActivityID   = this.wfActivityID;
            material.wfActivityName = this.wfActivityName;
            material.parentID       = this.id;
            material.sourceMaterial = this;
            material.versionType    = MaterialVersionType.CopyVersion;
            material.extraData      = this.extraData;
            material.showFileUrl    = this.showFileUrl;

            return(material);
        }
예제 #4
0
        public static IOguObject CreateWrapperObject(IOguObject obj)
        {
            IOguObject result = null;

            if (obj is OguBase || obj == null)
            {
                result = obj;
            }
            else
            {
                if (obj is IUser)
                {
                    result = new OguUser((IUser)obj);
                }
                else
                if (obj is IOrganization)
                {
                    result = new OguOrganization((IOrganization)obj);
                }
                else
                if (obj is IGroup)
                {
                    result = new OguGroup((IGroup)obj);
                }
                else
                {
                    ExceptionHelper.TrueThrow(true, "不能生成类型为{0}的对象人员包装类", obj.GetType().Name);
                }
            }

            return(result);
        }
예제 #5
0
 private static void FillMatchedUsers(IEnumerable <string> objectIDs, Dictionary <string, IUser> userDicts, OguDataCollection <IUser> target)
 {
     foreach (string id in objectIDs)
     {
         IUser user = null;
         if (userDicts.TryGetValue(id, out user))
         {
             target.Add((IUser)OguUser.CreateWrapperObject(user));
         }
     }
 }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
			//if (!IsPostBack)
			//{
                OguUser user = new OguUser("80f4464f-e912-40c9-9502-c369a0d935ee");

                OguDataCollection<IOguObject> list = new OguDataCollection<IOguObject>();
                list.Add(user);

                this.OuUserInputControl1.SelectedOuUserData = list;
			//}
        }
예제 #7
0
		/// <summary>
		///反序列化OguUser
		/// </summary>
		/// <param name="dictionary">对象类型</param>
		/// <param name="type">对象类型</param>
		/// <param name="serializer">JS序列化器</param>
		/// <returns>反序列化出的对象</returns>
		public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
		{
			object id, logOnName, displayName;
			OguUser oguUser = null;

			if (dictionary.TryGetValue("id", out id))
			{
				oguUser = new OguUser((string)dictionary["id"]);

				if (dictionary.TryGetValue("logOnName", out logOnName))
					oguUser.LogOnName = (string)logOnName;

				if (dictionary.TryGetValue("displayName", out displayName))
					oguUser.DisplayName = (string)displayName;
			}

			return oguUser;
		}
        /// <summary>
        /// 是否是流程的查看者。本方法仅返回流程分类授权的信息,即使是流程环节中的人,也可能返回为False
        /// </summary>
        /// <param name="process"></param>
        /// <param name="userID"></param>
        /// <returns></returns>
        private static bool GetIsProcessViewer(IWfProcess process, string userID)
        {
            bool result = false;

            if (userID.IsNotEmpty())
            {
                OguUser user = new OguUser(userID);

                result = WfApplicationAuthAdapter.Instance.GetUserApplicationAuthInfo(user).Contains(
                        process.Descriptor.ApplicationName, process.Descriptor.ProgramName, WfApplicationAuthType.FormViewer);
            }

            return result;
        }
        private static bool GetIsProcessAdmin(IWfProcess process, string userID)
        {
            bool result = false;

            if (userID.IsNotEmpty())
            {
                OguUser user = new OguUser(userID);

                result = RolesDefineConfig.GetConfig().IsCurrentUserInRoles(user, "ProcessAdmin");

                if (result == false)
                    result = WfApplicationAuthAdapter.Instance.GetUserApplicationAuthInfo(user).Contains(
                        process.Descriptor.ApplicationName, process.Descriptor.ProgramName, WfApplicationAuthType.FormAdmin);
            }

            return result;
        }
예제 #10
0
 private static IUser GetCurrentUser()
 {
     if (DeluxePrincipal.IsAuthenticated)
     {
         var user = new OguUser(DeluxeIdentity.CurrentRealUser);
         return user;
     }
     else
     {
         var newUser = CreateNewUser();
         return newUser;
     }
 }
예제 #11
0
		public static IOguObject CreateWrapperObject(string id, SchemaType type)
		{
			IOguObject result = null;

			switch (type)
			{
				case SchemaType.Organizations:
					result = new OguOrganization(id);
					break;
				case SchemaType.Users:
					result = new OguUser(id);
					break;
				case SchemaType.Groups:
					result = new OguGroup(id);
					break;

				default:
					ExceptionHelper.TrueThrow(true, string.Format("SchemaType错误{0}", type));
					break;
			}

			return result;
		}
예제 #12
0
		public static IOguObject CreateWrapperObject(IOguObject obj)
		{
			IOguObject result = null;

			if (obj is OguBase || obj == null)
				result = obj;
			else
			{
				if (obj is IUser)
					result = new OguUser((IUser)obj);
				else
					if (obj is IOrganization)
						result = new OguOrganization((IOrganization)obj);
					else
						if (obj is IGroup)
							result = new OguGroup((IGroup)obj);
						else
							ExceptionHelper.TrueThrow(true, "不能生成类型为{0}的对象人员包装类", obj.GetType().Name);
			}

			return result;
		}