From 930b84b557e9a3fadb8b3f3af89e961bb8f1b495 Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Thu, 25 May 2023 10:29:55 +0200 Subject: [PATCH] Add Enforcer interface --- http/handler/api/restream.go | 2 +- iam/iam.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/http/handler/api/restream.go b/http/handler/api/restream.go index 0ff7072a..dbe9674e 100644 --- a/http/handler/api/restream.go +++ b/http/handler/api/restream.go @@ -16,7 +16,7 @@ import ( // The RestreamHandler type provides functions to interact with a Restreamer instance type RestreamHandler struct { restream restream.Restreamer - iam iam.IAM + iam iam.Enforcer } // NewRestream return a new Restream type. You have to provide a valid Restreamer instance. diff --git a/iam/iam.go b/iam/iam.go index b742bf76..e611f05b 100644 --- a/iam/iam.go +++ b/iam/iam.go @@ -5,8 +5,12 @@ import ( "github.com/datarhei/core/v16/log" ) -type IAM interface { +type Enforcer interface { Enforce(name, domain, resource, action string) bool +} + +type IAM interface { + Enforcer HasDomain(domain string) bool ListDomains() []string