mirror of
https://github.com/status-im/consul.git
synced 2025-02-16 23:57:07 +00:00
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 opts.Legacy && original != nil {
|
||||||
if original.UsesNonLegacyFields() {
|
return fmt.Errorf("legacy tokens can not be modified")
|
||||||
return fmt.Errorf("failed inserting acl token: cannot use legacy endpoint to modify a non-legacy token")
|
|
||||||
}
|
|
||||||
|
|
||||||
token.AccessorID = original.AccessorID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := aclTokenUpsertValidateEnterprise(tx, token, original); err != nil {
|
if err := aclTokenUpsertValidateEnterprise(tx, token, original); err != nil {
|
||||||
|
@ -412,18 +412,6 @@ func (t *ACLToken) HasExpirationTime() bool {
|
|||||||
return t.ExpirationTime != nil && !t.ExpirationTime.IsZero()
|
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 {
|
func (t *ACLToken) EnterpriseMetadata() *EnterpriseMeta {
|
||||||
return &t.EnterpriseMeta
|
return &t.EnterpriseMeta
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user