Ejemplo n.º 1
0
        /// <summary>
        /// Construct the jobACLs from the configuration so that they can be kept in
        /// the memory.
        /// </summary>
        /// <remarks>
        /// Construct the jobACLs from the configuration so that they can be kept in
        /// the memory. If authorization is disabled on the JT, nothing is constructed
        /// and an empty map is returned.
        /// </remarks>
        /// <returns>JobACL to AccessControlList map.</returns>
        public virtual IDictionary <JobACL, AccessControlList> ConstructJobACLs(Configuration
                                                                                conf)
        {
            IDictionary <JobACL, AccessControlList> acls = new Dictionary <JobACL, AccessControlList
                                                                           >();

            // Don't construct anything if authorization is disabled.
            if (!AreACLsEnabled())
            {
                return(acls);
            }
            foreach (JobACL aclName in JobACL.Values())
            {
                string aclConfigName = aclName.GetAclName();
                string aclConfigured = conf.Get(aclConfigName);
                if (aclConfigured == null)
                {
                    // If ACLs are not configured at all, we grant no access to anyone. So
                    // jobOwner and cluster administrator _only_ can do 'stuff'
                    aclConfigured = " ";
                }
                acls[aclName] = new AccessControlList(aclConfigured);
            }
            return(acls);
        }
Ejemplo n.º 2
0
        /// <summary>Get the acls configured for the job</summary>
        public virtual IDictionary <JobACL, AccessControlList> GetJobAcls()
        {
            IDictionary <JobACL, AccessControlList> jobAcls = new Dictionary <JobACL, AccessControlList
                                                                              >();

            foreach (JobACL jobACL in JobACL.Values())
            {
                Utf8 jobACLsUtf8 = new Utf8(jobACL.GetAclName());
                if (datum.acls.Contains(jobACLsUtf8))
                {
                    jobAcls[jobACL] = new AccessControlList(datum.acls[jobACLsUtf8].ToString());
                }
            }
            return(jobAcls);
        }