RequireIsAdmin checks that the context is authenticated as admin.
(ctx context.Context)
| 113 | |
| 114 | // RequireIsAdmin checks that the context is authenticated as admin. |
| 115 | func RequireIsAdmin(ctx context.Context) error { |
| 116 | authInfo, err := AuthInfo(ctx) |
| 117 | if err != nil { |
| 118 | return err |
| 119 | } |
| 120 | if !authInfo.GetIsAdmin() { |
| 121 | return ErrNoAdmin.New() |
| 122 | } |
| 123 | return nil |
| 124 | } |
| 125 | |
| 126 | // RequireApplication checks that context contains the required rights for the |
| 127 | // given application ID. |