Пример #1
0
        private static void logException(Exception exp)
        {
            User user;
            var  securityService = SecurityServiceFacadeFactory.Create();

            try
            {
                user = securityService.GetLogonUser();
            }
            finally
            {
                SecurityServiceFacadeFactory.Release(securityService);
            }

            var logServicelc = LogServiceFactory.Create();

            try
            {
                var    logService = logServicelc.GetService();
                string code       = "ServiceHost_HandleExp";
                string title      = exp.Message;
                string messages   = ExceptionHelper.GetExceptionTextInfo(exp, true);
                logService.AddExceptionLog(code, LogLevel.Error, user, "", "", title, messages);
            }
            finally
            {
                LogServiceFactory.Release(logServicelc);
            }
        }
Пример #2
0
        private void addUpdateLogonUser(ClaimsPrincipal incomingPrincipal)
        {
            var securityService = SecurityServiceFacadeFactory.Create();

            try
            {
                securityService.AddUpdateUser(incomingPrincipal);
            }
            finally
            {
                SecurityServiceFacadeFactory.Release(securityService);
            }
        }
Пример #3
0
        private void CheckIsValidWorkListCurrentUser(string logonUsername, string currentUsername)
        {
            var securityService = SecurityServiceFacadeFactory.Create();

            try
            {
                var workListUsernames = securityService.GetPermittedWorkListUserNameFor(logonUsername);
                if (logonUsername.ToLower() != currentUsername.ToLower() &&
                    !workListUsernames.Contains(currentUsername))
                {
                    throw new PMSSecurityException(" دسترسی به کارتابل کاربر " + currentUsername + " مجاز برای کاربر لاگین مجاز نمی باشد ");
                }
            }
            finally
            {
                SecurityServiceFacadeFactory.Release(securityService);
            }
        }
Пример #4
0
        private List <string> getCurrentUserActions(ClaimsPrincipal incomingPrincipal)
        {
            var currentUserActions = new List <string>();
            var securityService    = SecurityServiceFacadeFactory.Create();

            try
            {
                var actions = securityService.GetUserAuthorizedActions(incomingPrincipal);
                if (actions != null && actions.Any())
                {
                    currentUserActions = actions.Select(c => ((int)c).ToString()).ToList();
                }
            }
            finally
            {
                SecurityServiceFacadeFactory.Release(securityService);
            }
            return(currentUserActions);
        }