[MM-61756] Attribute Based Access Control - Phase 1 (#30785)

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>
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2025-05-15 11:33:08 +02:00
коммит произвёл GitHub
родитель 4b445cbf16
Коммит a344b3225b
156 изменённых файлов: 14382 добавлений и 621 удалений

Просмотреть файл

@@ -34,4 +34,6 @@ import (
_ "github.com/mattermost/enterprise/ip_filtering"
// Needed to ensure the init() method in the EE gets run
_ "github.com/mattermost/enterprise/outgoing_oauth_connections"
// Needed to ensure the init() method in the EE gets run
_ "github.com/mattermost/enterprise/access_control"
)

Просмотреть файл

@@ -236,9 +236,9 @@ type MetricsInterfaceImpl struct {
DesktopClientCPUUsage *prometheus.HistogramVec
DesktopClientMemoryUsage *prometheus.HistogramVec
AccessControlEngineInitDuration prometheus.Histogram
AccessControlExpressionCompileDuration prometheus.Histogram
AccessControlEvaluateDuration prometheus.Histogram
AccessControlSearchQueryDuration prometheus.Histogram
AccessControlCacheInvalidation prometheus.Counter
}
@@ -1541,34 +1541,31 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
)
m.Registry.MustRegister(m.DesktopClientMemoryUsage)
m.AccessControlEngineInitDuration = prometheus.NewHistogram(
prometheus.HistogramOpts{
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemAccessControl,
Name: "engine_init_duration_seconds",
Help: "Duration of the time taken to initialize the access control engine (seconds)",
ConstLabels: additionalLabels,
})
m.Registry.MustRegister(m.AccessControlEngineInitDuration)
m.AccessControlSearchQueryDuration = prometheus.NewHistogram(
withLabels(prometheus.HistogramOpts{
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemAccessControl,
Name: "search_query_duration_seconds",
Help: "Duration of the time taken to query users against an expression (seconds)",
}))
m.Registry.MustRegister(m.AccessControlSearchQueryDuration)
m.AccessControlEvaluateDuration = prometheus.NewHistogram(
prometheus.HistogramOpts{
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemAccessControl,
Name: "evaluate_duration_seconds",
Help: "Duration of the time taken to evaluate the access control engine (seconds)",
ConstLabels: additionalLabels,
})
withLabels(prometheus.HistogramOpts{
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemAccessControl,
Name: "evaluate_duration_seconds",
Help: "Duration of the time taken to evaluate the access control engine (seconds)",
}))
m.Registry.MustRegister(m.AccessControlEvaluateDuration)
m.AccessControlExpressionCompileDuration = prometheus.NewHistogram(
prometheus.HistogramOpts{
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemAccessControl,
Name: "expression_compile_duration_seconds",
Help: "Duration of the time taken to compile the access control engine expression (seconds)",
ConstLabels: additionalLabels,
})
withLabels(prometheus.HistogramOpts{
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemAccessControl,
Name: "expression_compile_duration_seconds",
Help: "Duration of the time taken to compile the access control engine expression (seconds)",
}))
m.Registry.MustRegister(m.AccessControlExpressionCompileDuration)
m.AccessControlCacheInvalidation = prometheus.NewCounter(
@@ -2177,8 +2174,8 @@ func (mi *MetricsInterfaceImpl) ObserveMobileClientSessionMetadata(version, plat
mi.MobileClientSessionMetadataGauge.With(prometheus.Labels{"version": version, "platform": platform, "notifications_disabled": notificationDisabled}).Set(value)
}
func (mi *MetricsInterfaceImpl) ObserveAccessControlEngineInitDuration(value float64) {
mi.AccessControlEngineInitDuration.Observe(value)
func (mi *MetricsInterfaceImpl) ObserveAccessControlSearchQueryDuration(value float64) {
mi.AccessControlSearchQueryDuration.Observe(value)
}
func (mi *MetricsInterfaceImpl) ObserveAccessControlExpressionCompileDuration(value float64) {