2023-03-28 20:12:41 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 20:12:41 +00:00
|
|
|
|
2021-11-16 18:04:01 +00:00
|
|
|
//go:build !consulent
|
2019-10-15 20:58:50 +00:00
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package acl
|
|
|
|
|
|
|
|
// enterprisePolicyAuthorizer stub
|
|
|
|
type enterprisePolicyAuthorizer struct{}
|
|
|
|
|
2019-12-18 18:44:32 +00:00
|
|
|
func (authz *enterprisePolicyAuthorizer) init(*Config) {
|
2019-10-15 20:58:50 +00:00
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
|
2019-12-18 18:43:24 +00:00
|
|
|
func (authz *enterprisePolicyAuthorizer) enforce(_ *EnterpriseRule, _ *AuthorizerContext) EnforcementDecision {
|
2019-10-15 20:58:50 +00:00
|
|
|
return Default
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewPolicyAuthorizer merges the policies and returns an Authorizer that will enforce them
|
2019-12-18 18:44:32 +00:00
|
|
|
func NewPolicyAuthorizer(policies []*Policy, entConfig *Config) (Authorizer, error) {
|
2019-10-15 20:58:50 +00:00
|
|
|
return newPolicyAuthorizer(policies, entConfig)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewPolicyAuthorizerWithDefaults will actually created a ChainedAuthorizer with
|
|
|
|
// the policies compiled into one Authorizer and the backup policy of the defaultAuthz
|
2019-12-18 18:44:32 +00:00
|
|
|
func NewPolicyAuthorizerWithDefaults(defaultAuthz Authorizer, policies []*Policy, entConfig *Config) (Authorizer, error) {
|
2019-10-15 20:58:50 +00:00
|
|
|
authz, err := newPolicyAuthorizer(policies, entConfig)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return NewChainedAuthorizer([]Authorizer{authz, defaultAuthz}), nil
|
|
|
|
}
|