diff options
author | jloup <jloup@jloup.work> | 2018-05-13 23:14:26 +0200 |
---|---|---|
committer | jloup <jloup@jloup.work> | 2018-05-13 23:18:48 +0200 |
commit | 2e4885d98ec49203180deb7e4e9148762e4720e7 (patch) | |
tree | f018a158d2f39133a21dba899176f6fde606bd92 /api/user.go | |
parent | 6bf174a95ba0f71abf25397316fc101405381cdf (diff) | |
download | Front-2e4885d98ec49203180deb7e4e9148762e4720e7.tar.gz Front-2e4885d98ec49203180deb7e4e9148762e4720e7.tar.zst Front-2e4885d98ec49203180deb7e4e9148762e4720e7.zip |
Admin minimal dashboard.v0.0.14
Diffstat (limited to 'api/user.go')
-rw-r--r-- | api/user.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/api/user.go b/api/user.go index bc24bbb..ff539f0 100644 --- a/api/user.go +++ b/api/user.go | |||
@@ -62,7 +62,8 @@ type SignParams struct { | |||
62 | } | 62 | } |
63 | 63 | ||
64 | type SignResult struct { | 64 | type SignResult struct { |
65 | Token string `json:"token"` | 65 | Token string `json:"token"` |
66 | IsAdmin bool `json:"isAdmin"` | ||
66 | } | 67 | } |
67 | 68 | ||
68 | func (s SignParams) Validate() *Error { | 69 | func (s SignParams) Validate() *Error { |
@@ -142,7 +143,7 @@ func (q SignupQuery) Run() (interface{}, *Error) { | |||
142 | } | 143 | } |
143 | } | 144 | } |
144 | 145 | ||
145 | return SignResult{token}, nil | 146 | return SignResult{token, newUser.Role == db.RoleAdmin}, nil |
146 | } | 147 | } |
147 | 148 | ||
148 | type SigninQuery struct { | 149 | type SigninQuery struct { |
@@ -173,7 +174,7 @@ func (q SigninQuery) Run() (interface{}, *Error) { | |||
173 | return nil, NewInternalError(err) | 174 | return nil, NewInternalError(err) |
174 | } | 175 | } |
175 | 176 | ||
176 | return SignResult{token}, nil | 177 | return SignResult{token, user.Role == db.RoleAdmin}, nil |
177 | } | 178 | } |
178 | 179 | ||
179 | type ConfirmEmailQuery struct { | 180 | type ConfirmEmailQuery struct { |