mirror of
https://github.com/datarhei/core.git
synced 2025-10-06 08:27:08 +08:00
Dump casbin, replace with own policy enforcer
This commit is contained in:
@@ -28,8 +28,8 @@ import (
|
||||
httpfs "github.com/datarhei/core/v16/http/fs"
|
||||
"github.com/datarhei/core/v16/http/router"
|
||||
"github.com/datarhei/core/v16/iam"
|
||||
iamaccess "github.com/datarhei/core/v16/iam/access"
|
||||
iamidentity "github.com/datarhei/core/v16/iam/identity"
|
||||
iampolicy "github.com/datarhei/core/v16/iam/policy"
|
||||
"github.com/datarhei/core/v16/io/fs"
|
||||
"github.com/datarhei/core/v16/log"
|
||||
"github.com/datarhei/core/v16/math/rand"
|
||||
@@ -669,7 +669,7 @@ func (a *api) start(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
policyAdapter, err := iamaccess.NewJSONAdapter(rfs, "./policy.json", nil)
|
||||
policyAdapter, err := iampolicy.NewJSONAdapter(rfs, "./policy.json", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -694,7 +694,7 @@ func (a *api) start(ctx context.Context) error {
|
||||
// Check if there are already file created by IAM. If not, create policies
|
||||
// and users based on the config in order to mimic the behaviour before IAM.
|
||||
if len(rfs.List("/", fs.ListOptions{Pattern: "/*.json"})) == 0 {
|
||||
policies := []iamaccess.Policy{
|
||||
policies := []iampolicy.Policy{
|
||||
{
|
||||
Name: "$anon",
|
||||
Domain: "$none",
|
||||
@@ -730,7 +730,7 @@ func (a *api) start(ctx context.Context) error {
|
||||
},
|
||||
}
|
||||
|
||||
policies = append(policies, iamaccess.Policy{
|
||||
policies = append(policies, iampolicy.Policy{
|
||||
Name: cfg.Storage.Memory.Auth.Username,
|
||||
Domain: "$none",
|
||||
Types: []string{"fs"},
|
||||
@@ -756,7 +756,7 @@ func (a *api) start(ctx context.Context) error {
|
||||
users[s.Auth.Username] = user
|
||||
}
|
||||
|
||||
policies = append(policies, iamaccess.Policy{
|
||||
policies = append(policies, iampolicy.Policy{
|
||||
Name: s.Auth.Username,
|
||||
Domain: "$none",
|
||||
Types: []string{"fs"},
|
||||
@@ -767,7 +767,7 @@ func (a *api) start(ctx context.Context) error {
|
||||
}
|
||||
|
||||
if cfg.RTMP.Enable && len(cfg.RTMP.Token) == 0 {
|
||||
policies = append(policies, iamaccess.Policy{
|
||||
policies = append(policies, iampolicy.Policy{
|
||||
Name: "$anon",
|
||||
Domain: "$none",
|
||||
Types: []string{"rtmp"},
|
||||
@@ -777,7 +777,7 @@ func (a *api) start(ctx context.Context) error {
|
||||
}
|
||||
|
||||
if cfg.SRT.Enable && len(cfg.SRT.Token) == 0 {
|
||||
policies = append(policies, iamaccess.Policy{
|
||||
policies = append(policies, iampolicy.Policy{
|
||||
Name: "$anon",
|
||||
Domain: "$none",
|
||||
Types: []string{"srt"},
|
||||
|
Reference in New Issue
Block a user