Example #1
0
        /// <exception cref="System.IO.IOException"/>
        private UserGroupInformation CheckAcls(string method)
        {
            UserGroupInformation user;

            try
            {
                user = UserGroupInformation.GetCurrentUser();
            }
            catch (IOException ioe)
            {
                Log.Warn("Couldn't get current user", ioe);
                HSAuditLogger.LogFailure("UNKNOWN", method, adminAcl.ToString(), HistoryAdminServer
                                         , "Couldn't get current user");
                throw;
            }
            if (!adminAcl.IsUserAllowed(user))
            {
                Log.Warn("User " + user.GetShortUserName() + " doesn't have permission" + " to call '"
                         + method + "'");
                HSAuditLogger.LogFailure(user.GetShortUserName(), method, adminAcl.ToString(), HistoryAdminServer
                                         , HSAuditLogger.AuditConstants.UnauthorizedUser);
                throw new AccessControlException("User " + user.GetShortUserName() + " doesn't have permission"
                                                 + " to call '" + method + "'");
            }
            Log.Info("HS Admin: " + method + " invoked by user " + user.GetShortUserName());
            return(user);
        }
Example #2
0
        /// <exception cref="System.IO.IOException"/>
        public virtual void RefreshLoadedJobCache()
        {
            UserGroupInformation user = CheckAcls("refreshLoadedJobCache");

            try
            {
                jobHistoryService.RefreshLoadedJobCache();
            }
            catch (NotSupportedException e)
            {
                HSAuditLogger.LogFailure(user.GetShortUserName(), "refreshLoadedJobCache", adminAcl
                                         .ToString(), HistoryAdminServer, e.Message);
                throw;
            }
            HSAuditLogger.LogSuccess(user.GetShortUserName(), "refreshLoadedJobCache", HistoryAdminServer
                                     );
        }