Skip to content

Commit dcead71

Browse files
authored
Merge pull request #286 from nspcc-dev/feature/256-acl-missing-attr
Support new operators in eACL rules
2 parents 533950f + 541cd3c commit dcead71

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

acl/types.proto

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ enum MatchType {
3333

3434
// Return true if strings are different
3535
STRING_NOT_EQUAL = 2;
36+
37+
// Absence of attribute
38+
NOT_PRESENT = 3;
39+
40+
// Numeric 'greater than'
41+
NUM_GT = 4;
42+
43+
// Numeric 'greater or equal than'
44+
NUM_GE = 5;
45+
46+
// Numeric 'less than'
47+
NUM_LT = 6;
48+
49+
// Numeric 'less or equal than'
50+
NUM_LE = 7;
3651
}
3752

3853
// Request's operation type to match if the rule is applicable to a particular
@@ -102,9 +117,14 @@ message EACLRecord {
102117

103118
// Filter to check particular properties of the request or the object.
104119
//
120+
// The `value` field must be empty if `match_type` is an unary operator
121+
// (e.g. `NOT_PRESENT`). If `match_type` field is numeric (e.g. `NUM_GT`),
122+
// the `value` field must be a base-10 integer.
123+
//
105124
// By default `key` field refers to the corresponding object's `Attribute`.
106125
// Some Object's header fields can also be accessed by adding `$Object:`
107-
// prefix to the name. Here is the list of fields available via this prefix:
126+
// prefix to the name. For such attributes, field 'match_type' must not be
127+
// 'NOT_PRESENT'. Here is the list of fields available via this prefix:
108128
//
109129
// * $Object:version \
110130
// version
@@ -125,6 +145,9 @@ message EACLRecord {
125145
// * $Object:homomorphicHash \
126146
// homomorphic_hash
127147
//
148+
// Numeric `match_type` field can only be used with `$Object:creationEpoch`
149+
// and `$Object:payloadLength` system attributes.
150+
//
128151
// Please note, that if request or response does not have object's headers of
129152
// full object (Range, RangeHash, Search, Delete), it will not be possible to
130153
// filter by object header fields or user attributes. From the well-known list

proto-docs/acl.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,14 @@ Describes a single eACL rule.
9595
### Message EACLRecord.Filter
9696
Filter to check particular properties of the request or the object.
9797

98+
The `value` field must be empty if `match_type` is an unary operator
99+
(e.g. `NOT_PRESENT`). If `match_type` field is numeric (e.g. `NUM_GT`),
100+
the `value` field must be a base-10 integer.
101+
98102
By default `key` field refers to the corresponding object's `Attribute`.
99103
Some Object's header fields can also be accessed by adding `$Object:`
100-
prefix to the name. Here is the list of fields available via this prefix:
104+
prefix to the name. For such attributes, field 'match_type' must not be
105+
'NOT_PRESENT'. Here is the list of fields available via this prefix:
101106

102107
* $Object:version \
103108
version
@@ -118,6 +123,9 @@ prefix to the name. Here is the list of fields available via this prefix:
118123
* $Object:homomorphicHash \
119124
homomorphic_hash
120125

126+
Numeric `match_type` field can only be used with `$Object:creationEpoch`
127+
and `$Object:payloadLength` system attributes.
128+
121129
Please note, that if request or response does not have object's headers of
122130
full object (Range, RangeHash, Search, Delete), it will not be possible to
123131
filter by object header fields or user attributes. From the well-known list
@@ -202,6 +210,11 @@ MatchType is an enumeration of match types.
202210
| MATCH_TYPE_UNSPECIFIED | 0 | Unspecified match type, default value. |
203211
| STRING_EQUAL | 1 | Return true if strings are equal |
204212
| STRING_NOT_EQUAL | 2 | Return true if strings are different |
213+
| NOT_PRESENT | 3 | Absence of attribute |
214+
| NUM_GT | 4 | Numeric 'greater than' |
215+
| NUM_GE | 5 | Numeric 'greater or equal than' |
216+
| NUM_LT | 6 | Numeric 'less than' |
217+
| NUM_LE | 7 | Numeric 'less or equal than' |
205218

206219

207220

0 commit comments

Comments
 (0)