Fixes from PR review

This commit is contained in:
max furman 2021-07-03 12:08:30 -07:00
parent 77fdfc9fa3
commit 5679c9933d
2 changed files with 1 additions and 13 deletions

View file

@ -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
}
*/

View file

@ -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")