mirror of https://github.com/status-im/consul.git
state: remove support for updating legacy ACL tokens
This commit is contained in:
parent
0784a31e85
commit
65d48e5042
|
@ -498,11 +498,7 @@ func aclTokenSetTxn(tx WriteTxn, idx uint64, token *structs.ACLToken, opts ACLTo
|
|||
}
|
||||
|
||||
if opts.Legacy && original != nil {
|
||||
if original.UsesNonLegacyFields() {
|
||||
return fmt.Errorf("failed inserting acl token: cannot use legacy endpoint to modify a non-legacy token")
|
||||
}
|
||||
|
||||
token.AccessorID = original.AccessorID
|
||||
return fmt.Errorf("legacy tokens can not be modified")
|
||||
}
|
||||
|
||||
if err := aclTokenUpsertValidateEnterprise(tx, token, original); err != nil {
|
||||
|
|
|
@ -412,18 +412,6 @@ func (t *ACLToken) HasExpirationTime() bool {
|
|||
return t.ExpirationTime != nil && !t.ExpirationTime.IsZero()
|
||||
}
|
||||
|
||||
// TODO(ACL-Legacy-Compat): remove
|
||||
func (t *ACLToken) UsesNonLegacyFields() bool {
|
||||
return len(t.Policies) > 0 ||
|
||||
len(t.ServiceIdentities) > 0 ||
|
||||
len(t.NodeIdentities) > 0 ||
|
||||
len(t.Roles) > 0 ||
|
||||
t.Type == "" ||
|
||||
t.HasExpirationTime() ||
|
||||
t.ExpirationTTL != 0 ||
|
||||
t.AuthMethod != ""
|
||||
}
|
||||
|
||||
func (t *ACLToken) EnterpriseMetadata() *EnterpriseMeta {
|
||||
return &t.EnterpriseMeta
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue