Merge branch 'oauth2'

This commit is contained in:
Morgan Bazalgette
2017-07-25 10:41:09 +02:00
6 changed files with 151 additions and 10 deletions

View File

@@ -143,3 +143,8 @@ func (md MethodData) HasQuery(q string) bool {
func (md MethodData) Unmarshal(into interface{}) error {
return json.Unmarshal(md.Ctx.PostBody(), into)
}
// IsBearer tells whether the current token is a Bearer (oauth) token.
func (md MethodData) IsBearer() bool {
return md.User.ID == -1
}