func (c *UserController) Show(ctx *app.ShowUserContext) error {
	id, err := c.tokenManager.Locate(ctx)
	if err != nil {
		jerrors, _ := jsonapi.ErrorToJSONAPIErrors(goa.ErrBadRequest(err.Error()))
		return ctx.BadRequest(jerrors)
	}

	return application.Transactional(c.db, func(appl application.Application) error {
		identity, err := appl.Identities().Load(ctx, id)
		if err != nil || identity == nil {
			log.Error(ctx, map[string]interface{}{
				"identity_id": id,
			}, "auth token containers id %s of unknown Identity", id)
			jerrors, _ := jsonapi.ErrorToJSONAPIErrors(goa.ErrUnauthorized(fmt.Sprintf("Auth token contains id %s of unknown Identity\n", id)))
			return ctx.Unauthorized(jerrors)
		}

		var user *account.User
		userID := identity.UserID
		if userID.Valid {
			user, err = appl.Users().Load(ctx.Context, userID.UUID)
			if err != nil {
				return jsonapi.JSONErrorResponse(ctx, errors.Wrap(err, fmt.Sprintf("Can't load user with id %s", userID.UUID)))
			}
		}

		return ctx.OK(ConvertUser(ctx.RequestData, identity, user))
	})
}
// Show returns the authorized user based on the provided Token
Show returns the authorized user based on the provided Token
// Show returns the authorized user based on the provided Token
func (c *UserController) Show(ctx *app.ShowUserContext) error {
	id, err := c.tokenManager.Locate(ctx)
	if err != nil {
		jerrors, _ := jsonapi.ErrorToJSONAPIErrors(goa.ErrBadRequest(err.Error()))
		return ctx.BadRequest(jerrors)
	}
	return application.Transactional(c.db, func(appl application.Application) error {
		identity, err := appl.Identities().Load(ctx, id)
		if err != nil || identity == nil {
			log.Error(ctx, map[string]interface{}{
				"identity_id": id,
			}, "auth token containers id %s of unknown Identity", id)
			jerrors, _ := jsonapi.ErrorToJSONAPIErrors(goa.ErrUnauthorized(fmt.Sprintf("Auth token contains id %s of unknown Identity\n", id)))
			return ctx.Unauthorized(jerrors)
		}
		var user *account.User
		userID := identity.UserID
		if userID.Valid {
			user, err = appl.Users().Load(ctx.Context, userID.UUID)
			if err != nil {
				return jsonapi.JSONErrorResponse(ctx, errors.Wrap(err, fmt.Sprintf("Can't load user with id %s", userID.UUID)))
			}
		}
		return ctx.OK(ConvertUser(ctx.RequestData, identity, user))
	})
}
func ( c * UserController ) Show ( ctx * app . ShowUserContext ) error { id , err := c . tokenManager . Locate ( ctx ) if err != nil { jerrors , _ := jsonapi . ErrorToJSONAPIErrors ( goa . ErrBadRequest ( err . Error ( ) ) ) return ctx . BadRequest ( jerrors ) } return application . Transactional ( c . db , func ( appl application . Application ) error { identity , err := appl . Identities ( ) . Load ( ctx , id ) if err != nil || identity == nil { log . Error ( ctx , map [ string ] interface { } { " " : id , } , " " , id ) jerrors , _ := jsonapi . ErrorToJSONAPIErrors ( goa . ErrUnauthorized ( fmt . Sprintf ( " \n " , id ) ) ) return ctx . Unauthorized ( jerrors ) } var user * account . User userID := identity . UserID if userID . Valid { user , err = appl . Users ( ) . Load ( ctx . Context , userID . UUID ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , errors . Wrap ( err , fmt . Sprintf ( " " , userID . UUID ) ) ) } } return ctx . OK ( ConvertUser ( ctx . RequestData , identity , user ) ) } ) }
Show returns the authorized user based on the provided Token
Show returns the authorized user based on the provided Token