cloudwan / gohan

Gohan is an API Gateway Server written by Go that makes it easy for developers to create and maintain REST-style API
http://www.slideshare.net/natiueno/gohan-61170476
Other
109 stars 44 forks source link

gohan_model_update in post_state_update_in_transaction occurs panic #132

Open morrisson opened 8 years ago

morrisson commented 8 years ago

When JS extension calls gohan_model_update in post_state_update_in_transaction, panic occurs with following message.

11:10:19.630 gohan.server ERROR Panic interface conversion: interface {} is nil, not *schema.Policy

This is because context["policy"] is not available when gohan_model_update calls UpdateResourceInTransaction. The possible solution is that gohanmodel* fills context["policy"] field with loadPolicy if this is not available. I can take care of it if this solution looks OK.

morrisson commented 8 years ago

Ah, it might be a bit difficult because PolicyValidate requires auth information but auth info cannot be acquired from state update.