コード例 #1
0
        /// <summary>Set up the ACL for the user.</summary>
        /// <remarks>
        /// Set up the ACL for the user.
        /// <b>Important: this must run client-side as it needs
        /// to know the id:pass tuple for a user</b>
        /// </remarks>
        /// <param name="username">user name</param>
        /// <param name="perms">permissions</param>
        /// <returns>an ACL list</returns>
        /// <exception cref="System.IO.IOException">ACL creation/parsing problems</exception>
        public virtual IList <ACL> AclsForUser(string username, int perms)
        {
            IList <ACL>      clientACLs = GetClientAcls();
            RegistrySecurity security   = GetRegistrySecurity();

            if (security.IsSecureRegistry())
            {
                clientACLs.AddItem(security.CreateACLfromUsername(username, perms));
            }
            return(clientACLs);
        }
コード例 #2
0
        /// <summary>Init operation sets up the system ACLs.</summary>
        /// <param name="conf">configuration of the service</param>
        /// <exception cref="System.Exception"/>
        protected override void ServiceInit(Configuration conf)
        {
            base.ServiceInit(conf);
            RegistrySecurity registrySecurity = GetRegistrySecurity();

            if (registrySecurity.IsSecureRegistry())
            {
                ACL sasl = registrySecurity.CreateSaslACLFromCurrentUser(ZooDefs.Perms.All);
                registrySecurity.AddSystemACL(sasl);
                Log.Info("Registry System ACLs:", RegistrySecurity.AclsToString(registrySecurity.
                                                                                GetSystemACLs()));
            }
        }