Mercurial > gemma
comparison auth/middleware.go @ 326:a7b2db8b3d18
Added type for roles.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 02 Aug 2018 18:39:01 +0200 |
parents | 3771788d3dae |
children |
comparison
equal
deleted
inserted
replaced
325:c23eb0f34e39 | 326:a7b2db8b3d18 |
---|---|
62 } | 62 } |
63 | 63 |
64 func HasRole(roles ...string) func(*Session) bool { | 64 func HasRole(roles ...string) func(*Session) bool { |
65 return func(session *Session) bool { | 65 return func(session *Session) bool { |
66 for _, r1 := range roles { | 66 for _, r1 := range roles { |
67 for _, r2 := range session.Roles { | 67 if session.Roles.Has(r1) { |
68 if r1 == r2 { | 68 return true |
69 return true | |
70 } | |
71 } | 69 } |
72 } | 70 } |
73 return false | 71 return false |
74 } | 72 } |
75 } | 73 } |