CheckAuthorizationMustRunOnServer() public static method

public static CheckAuthorizationMustRunOnServer ( ) : void
return void
示例#1
0
        public Result <UserDto> Fetch(string username)
        {
            Result <UserDto> retResult = Result <UserDto> .Undefined(null);

            try
            {
                DalHelper.CheckAuthorizationMustRunOnServer();

                //Common.CommonHelper.CheckAuthentication();

                var userDto = FetchImpl(username);
                if (userDto == null)
                {
                    throw new Exceptions.UsernameNotFoundException(username);
                }
                retResult = Result <UserDto> .Success(userDto);
            }
            catch (Exception ex)
            {
                var wrapperEx = new Exceptions.GetUserFailedException(ex, username);
                retResult = Result <UserDto> .FailureWithInfo(null, wrapperEx);
            }

            return(retResult);
        }
示例#2
0
        public Result <ICollection <RoleDto> > GetRoles(string username)
        {
            Result <ICollection <RoleDto> > retResult = Result <ICollection <RoleDto> > .Undefined(null);

            try
            {
                //Common.CommonHelper.CheckAuthentication();
                DalHelper.CheckAuthorizationMustRunOnServer();

                var roles = GetRolesImpl(username);
                retResult = Result <ICollection <RoleDto> > .Success(roles);
            }
            catch (Exception ex)
            {
                var wrappedEx = new Exceptions.GetRolesFailedException(ex, username);
                retResult = Result <ICollection <RoleDto> > .FailureWithInfo(null, wrappedEx);
            }

            return(retResult);
        }