implicitly assume validator endpoints are authorized
This commit is contained in:
parent
803223d331
commit
89fda96e7a
@ -170,15 +170,7 @@ func (svc *Service) UpdateSubmissionModel(ctx context.Context, params api.Update
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/publish
|
// POST /submissions/{SubmissionID}/status/publish
|
||||||
func (svc *Service) ActionSubmissionPublish(ctx context.Context, params api.ActionSubmissionPublishParams) error {
|
func (svc *Service) ActionSubmissionPublish(ctx context.Context, params api.ActionSubmissionPublishParams) error {
|
||||||
userInfo, ok := ctx.Value("UserInfo").(UserInfo)
|
println("[ActionSubmissionPublish] Implicit Validator permission granted!")
|
||||||
if !ok{
|
|
||||||
return ErrUserInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if caller has required role
|
|
||||||
if !userInfo.Roles.Validator{
|
|
||||||
return ErrPermissionDenied
|
|
||||||
}
|
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
@ -387,15 +379,7 @@ func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/validate
|
// POST /submissions/{SubmissionID}/status/validate
|
||||||
func (svc *Service) ActionSubmissionValidate(ctx context.Context, params api.ActionSubmissionValidateParams) error {
|
func (svc *Service) ActionSubmissionValidate(ctx context.Context, params api.ActionSubmissionValidateParams) error {
|
||||||
userInfo, ok := ctx.Value("UserInfo").(UserInfo)
|
println("[ActionSubmissionValidate] Implicit Validator permission granted!")
|
||||||
if !ok{
|
|
||||||
return ErrUserInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if caller has required role
|
|
||||||
if !userInfo.Roles.Validator{
|
|
||||||
return ErrPermissionDenied
|
|
||||||
}
|
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
|
Loading…
Reference in New Issue
Block a user