From 5679c9933df5077736fa1d242cef7490f0157a28 Mon Sep 17 00:00:00 2001 From: max furman Date: Sat, 3 Jul 2021 12:08:30 -0700 Subject: [PATCH] Fixes from PR review --- authority/admin/api/middleware.go | 12 ------------ authority/administrator/collection.go | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/authority/admin/api/middleware.go b/authority/admin/api/middleware.go index 137bd6f75..0261047ad 100644 --- a/authority/admin/api/middleware.go +++ b/authority/admin/api/middleware.go @@ -52,15 +52,3 @@ const ( // adminContextKey account key adminContextKey = ContextKey("admin") ) - -/* -// adminFromContext searches the context for the token. Returns the -// token or an error. -func adminFromContext(ctx context.Context) (*linkedca.Admin, error) { - val, ok := ctx.Value(adminContextKey).(*linkedca.Admin) - if !ok || val == nil { - return nil, admin.NewErrorISE("admin not in context") - } - return val, nil -} -*/ diff --git a/authority/administrator/collection.go b/authority/administrator/collection.go index 47d3a35d4..ff04a41fb 100644 --- a/authority/administrator/collection.go +++ b/authority/administrator/collection.go @@ -184,7 +184,7 @@ func (c *Collection) Update(id string, nu *linkedca.Admin) (*linkedca.Admin, err return nil, admin.NewError(admin.ErrorNotFoundType, "admin %s not found", adm.Id) } if adm.Type == nu.Type { - return nil, admin.NewError(admin.ErrorBadRequestType, "admin %s already has type %s", id, adm.Type) + return adm, nil } if adm.Type == linkedca.Admin_SUPER_ADMIN && c.SuperCount() == 1 { return nil, admin.NewError(admin.ErrorBadRequestType, "cannot change role of last super admin")