예제 #1
0
        /// <summary>Whether a cache pool can be accessed by the current context</summary>
        /// <param name="pool">CachePool being accessed</param>
        /// <param name="access">type of action being performed on the cache pool</param>
        /// <exception cref="Org.Apache.Hadoop.Security.AccessControlException">if pool cannot be accessed
        ///     </exception>
        public virtual void CheckPermission(CachePool pool, FsAction access)
        {
            FsPermission mode = pool.GetMode();

            if (IsSuperUser())
            {
                return;
            }
            if (GetUser().Equals(pool.GetOwnerName()) && mode.GetUserAction().Implies(access))
            {
                return;
            }
            if (GetGroups().Contains(pool.GetGroupName()) && mode.GetGroupAction().Implies(access
                                                                                           ))
            {
                return;
            }
            if (mode.GetOtherAction().Implies(access))
            {
                return;
            }
            throw new AccessControlException("Permission denied while accessing pool " + pool
                                             .GetPoolName() + ": user " + GetUser() + " does not have " + access.ToString() +
                                             " permissions.");
        }
예제 #2
0
 private DirectiveList(CachePool cachePool)
 {
     this.cachePool = cachePool;
 }