forked from TrueCloudLab/certificates
Fixes from PR review
This commit is contained in:
parent
77fdfc9fa3
commit
5679c9933d
2 changed files with 1 additions and 13 deletions
|
@ -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
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue