Пример #1
0
 /// <include file='doc\AccessControlEntry.uex' path='docs/doc[@for="AccessControlEntry.AccessControlEntry2"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public AccessControlEntry(Trustee trustee, GenericAccessRights genericAccessRights, StandardAccessRights standardAccessRights, AccessControlEntryType entryType)
 {
     this.GenericAccessRights = genericAccessRights;
     this.StandardAccessRights = standardAccessRights;
     this.Trustee = trustee;
     this.EntryType = entryType;
 }
 /// <include file='doc\AccessControlEntry.uex' path='docs/doc[@for="AccessControlEntry.AccessControlEntry2"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public AccessControlEntry(Trustee trustee, GenericAccessRights genericAccessRights, StandardAccessRights standardAccessRights, AccessControlEntryType entryType)
 {
     this.GenericAccessRights  = genericAccessRights;
     this.StandardAccessRights = standardAccessRights;
     this.Trustee   = trustee;
     this.EntryType = entryType;
 }
		public AccessControlEntry(Trustee trustee,
			GenericAccessRights genericAccessRights,
			StandardAccessRights standardAccessRights,
			AccessControlEntryType entryType)
		{
			throw new NotImplementedException();
		}
Пример #4
0
 public AccessControlEntry(Trustee trustee,
                           GenericAccessRights genericAccessRights,
                           StandardAccessRights standardAccessRights,
                           AccessControlEntryType entryType)
 {
     throw new NotImplementedException();
 }
Пример #5
0
 /// <include file='doc\AccessControlEntry.uex' path='docs/doc[@for="AccessControlEntry.AccessControlEntry1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public AccessControlEntry(Trustee trustee)
 {
     this.Trustee = trustee;
 }
 /// <include file='doc\AccessControlEntry.uex' path='docs/doc[@for="AccessControlEntry.AccessControlEntry1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public AccessControlEntry(Trustee trustee)
 {
     this.Trustee = trustee;
 }
 public MessageQueueAccessControlEntry(Trustee trustee, System.Messaging.MessageQueueAccessRights rights, AccessControlEntryType entryType) : base(trustee)
 {
     base.CustomAccessRights |= rights;
     base.EntryType = entryType;
 }
Пример #8
0
 public AccessControlEntry(Trustee trustee)
 {
     throw new NotImplementedException();
 }
Пример #9
0
 /// <include file='doc\MessageQueueAccessControlEntry.uex' path='docs/doc[@for="MessageQueueAccessControlEntry.MessageQueueAccessControlEntry"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public MessageQueueAccessControlEntry(Trustee trustee, MessageQueueAccessRights rights) : base(trustee)
 {
     CustomAccessRights |= (int)rights;
 }
 public MessageQueueAccessControlEntry(Trustee trustee, MessageQueueAccessRights rights, AccessControlEntryType entryType)
 {
 }
		public MessageQueueAccessControlEntry(Trustee trustee, MessageQueueAccessRights rights, AccessControlEntryType entryType)
		{
		}
Пример #12
0
 public MessageQueueAccessControlEntry(Trustee trustee, System.Messaging.MessageQueueAccessRights rights) : base(trustee)
 {
     base.CustomAccessRights |= rights;
 }
Пример #13
0
 public MessageQueueAccessControlEntry(Trustee trustee, System.Messaging.MessageQueueAccessRights rights, AccessControlEntryType entryType) : base(trustee)
 {
     base.CustomAccessRights |= rights;
     base.EntryType           = entryType;
 }
        /// <summary>
        ///  Create the transacted MSMQ queue if necessary.
        /// </summary>
        /// <param name="queuePath"></param>
        void CreateQueue(string queuePath)
        {

            try
            {
                if (!MessageQueue.Exists(queuePath))
                {
                    MessageQueue.Create(queuePath, true);

                    // Create a new trustee to represent the "system" user group.
                    Trustee tr = new Trustee("SYSTEM");
                    MessageQueueAccessControlEntry entry = new MessageQueueAccessControlEntry(tr, MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow);
                    // Apply the MessageQueueAccessControlEntry to the queue.
                    SysEventQueue.SetPermissions(entry);
                    
                    if (!string.IsNullOrEmpty(Properties.Settings.Default.AdministratorGroupName))
                    {
                        tr = new Trustee(Properties.Settings.Default.AdministratorGroupName);
                        entry = new MessageQueueAccessControlEntry(tr, MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow);
                        SysEventQueue.SetPermissions(entry);
                    }
                }

            }
            catch (MessageQueueException ex)
            {
                ReceivedInfoProc.LogError(ex);
          
            }
        }
 public MessageQueueAccessControlEntry(Trustee trustee, System.Messaging.MessageQueueAccessRights rights) : base(trustee)
 {
     base.CustomAccessRights |= rights;
 }
 /// <include file='doc\MessageQueueAccessControlEntry.uex' path='docs/doc[@for="MessageQueueAccessControlEntry.MessageQueueAccessControlEntry"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public MessageQueueAccessControlEntry(Trustee trustee, MessageQueueAccessRights rights)
     : base(trustee)
 {
     CustomAccessRights |= (int)rights;
 }
 /// <include file='doc\MessageQueueAccessControlEntry.uex' path='docs/doc[@for="MessageQueueAccessControlEntry.MessageQueueAccessControlEntry1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public MessageQueueAccessControlEntry(Trustee trustee, MessageQueueAccessRights rights, AccessControlEntryType entryType)
     : base(trustee)
 {
     CustomAccessRights |= (int)rights;
     EntryType = entryType;
 }
Пример #18
0
 /// <include file='doc\MessageQueueAccessControlEntry.uex' path='docs/doc[@for="MessageQueueAccessControlEntry.MessageQueueAccessControlEntry1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public MessageQueueAccessControlEntry(Trustee trustee, MessageQueueAccessRights rights, AccessControlEntryType entryType) : base(trustee)
 {
     CustomAccessRights |= (int)rights;
     EntryType           = entryType;
 }
Пример #19
0
		public AccessControlEntry(Trustee trustee)
		{
			throw new NotImplementedException();
		}
Пример #20
0
        // 尝试初始化 MSMQ 环境
        public void InitialMsmq()
        {
            if (MsmqInitialized == true)
                return;

            if (string.IsNullOrEmpty(this.OutgoingQueue) == true)
            {
                // 清除 Hangup 状态
                if (this.ContainsHangup("MessageQueueCreateFail") == true)
                {
                    this.ClearHangup("MessageQueueCreateFail");
                    this.WriteErrorLog("*** 系统已解除 MessageQueueCreateFail 挂起状态");
                }
                return;
            }

            try
            {
#if NO
                            if (MessageQueue.Exists(this.OutgoingQueue))
                            {
                                MessageQueue.Delete(this.OutgoingQueue);
                            }
#endif

                if (!MessageQueue.Exists(this.OutgoingQueue))
                {
                    MessageQueue queue = MessageQueue.Create(this.OutgoingQueue);

#if NO
                                // Create an AccessControlList.
                                AccessControlList list = new AccessControlList();

                                // Create a new trustee to represent the "Everyone" user group.
                                Trustee tr = new Trustee("Everyone");

                                // Create an AccessControlEntry, granting the trustee read access to
                                // the queue.
                                AccessControlEntry entry = new AccessControlEntry(
                                    tr, GenericAccessRights.Read,
                         StandardAccessRights.Read,
                                    AccessControlEntryType.Allow);

                                // Add the AccessControlEntry to the AccessControlList.
                                list.Add(entry);


                                // Apply the AccessControlList to the queue.
                                queue.SetPermissions(list);
#endif

                    var wi = WindowsIdentity.GetCurrent();
                    if (wi.IsSystem == true)
                    {
                        // 当前用户已经是 LocalSystem 了,需要额外给 Everyone 添加权限,以便让 dp2Capo 的控制台方式运行能访问这个 Queue
                        queue.SetPermissions(@"Everyone",
    MessageQueueAccessRights.ReceiveMessage
    | MessageQueueAccessRights.DeleteMessage
    | MessageQueueAccessRights.PeekMessage
    | MessageQueueAccessRights.GenericRead);
                    }

                    // 如果当前是 Administrator,表示可能是 dp2libraryxe 启动的方式,那么需要专门给 LocalSystem 操作 Queue 的权限,以便 Windows Service 方式的 dp2Capo 能访问 Queue
                    var wp = new WindowsPrincipal(wi);
                    if (wp.IsInRole(WindowsBuiltInRole.Administrator))
                    {
                        queue.SetPermissions(@"NT AUTHORITY\System",
                            MessageQueueAccessRights.FullControl);
                    }

                    this.WriteErrorLog("首次创建 MSMQ 队列 '" + this.OutgoingQueue + "' 成功");
                }

                MsmqInitialized = true;
                // 清除 Hangup 状态
                if (this.ContainsHangup("MessageQueueCreateFail") == true)
                {
                    this.ClearHangup("MessageQueueCreateFail");
                    this.WriteErrorLog("*** 系统已解除 MessageQueueCreateFail 挂起状态");
                }
            }
            catch (Exception ex)
            {
                if (this.ContainsHangup("MessageQueueCreateFail") == true)
                {
                    this.WriteErrorLog("*** 重试探测和尝试创建 MSMQ 队列 '" + this.OutgoingQueue + "' 失败: " + ExceptionUtil.GetExceptionMessage(ex)
    + " 系统仍处于挂起状态。");
                }
                else
                {
                    this.AddHangup("MessageQueueCreateFail");
                    this.WriteErrorLog("*** 探测和尝试创建 MSMQ 队列 '" + this.OutgoingQueue + "' 时出现异常: " + ExceptionUtil.GetDebugText(ex)
                        + " 系统已被挂起。");
                }
            }
        }