Attribute Based Access Control - Base * MM-63662 * MM-63919 * MM-63954 * MM-63955 * MM-63425 * MM-63426 * MM-63458 * MM-63459 * MM-63603 * MM-63845 * MM-64146 * MM-64199 * MM-64201 * MM-64233 * MM-64247 * MM-64268 --------- Co-authored-by: Harshil Sharma <harshilsharma63@gmail.com> Co-authored-by: Pablo Andrés Vélez Vidal <pablovv2012@gmail.com> Co-authored-by: abhijit-singh <abhijitsingh0702@gmail.com> Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
31 строка
1.0 KiB
Go
31 строка
1.0 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package model
|
|
|
|
// ValueType indicates whether a value is a literal or another attribute.
|
|
type ValueType int
|
|
|
|
const (
|
|
LiteralValue ValueType = iota
|
|
AttrValue
|
|
)
|
|
|
|
// Condition represents a single logical condition (e.g., user.attributes.Team == "Engineering").
|
|
type Condition struct {
|
|
// Left-hand side attribute selector (e.g., "user.attributes.Team").
|
|
Attribute string `json:"attribute"`
|
|
// The comparison operator.
|
|
Operator string `json:"operator"`
|
|
// Right-hand side value(s). Can be a single value or a slice for 'in'.
|
|
Value any `json:"value"`
|
|
// Type of the Value (LiteralValue or AttributeValue). Needed for comparisons like user.attr1 == user.attr2.
|
|
ValueType ValueType `json:"value_type"`
|
|
}
|
|
|
|
// VisualExpression represents a series of conditions combined with logical AND.
|
|
type VisualExpression struct {
|
|
// Conditions is a list of individual conditions that will be ANDed together.
|
|
Conditions []Condition `json:"conditions"`
|
|
}
|