mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-10 04:00:24 +08:00
增加服务之间拷贝配置的API(开源版本只有定义,没有完全实现)
This commit is contained in:
@@ -96,6 +96,27 @@ func (this *HTTPAuthPolicyDAO) UpdateHTTPAuthPolicy(tx *dbs.Tx, policyId int64,
|
||||
return this.NotifyUpdate(tx, policyId)
|
||||
}
|
||||
|
||||
// CloneAuthPolicy 复制策略
|
||||
func (this *HTTPAuthPolicyDAO) CloneAuthPolicy(tx *dbs.Tx, fromPolicyId int64) (int64, error) {
|
||||
policyOne, err := this.Query(tx).
|
||||
Pk(fromPolicyId).
|
||||
Find()
|
||||
if err != nil || policyOne == nil {
|
||||
return 0, err
|
||||
}
|
||||
var policy = policyOne.(*HTTPAuthPolicy)
|
||||
|
||||
var op = NewHTTPAuthPolicyOperator()
|
||||
op.IsOn = policy.IsOn
|
||||
op.Name = policy.Name
|
||||
op.Type = policy.Type
|
||||
if len(policy.Params) > 0 {
|
||||
op.Params = policy.Params
|
||||
}
|
||||
op.State = policy.State
|
||||
return this.SaveInt64(tx, op)
|
||||
}
|
||||
|
||||
// ComposePolicyConfig 组合配置
|
||||
func (this *HTTPAuthPolicyDAO) ComposePolicyConfig(tx *dbs.Tx, policyId int64, cacheMap *utils.CacheMap) (*serverconfigs.HTTPAuthPolicy, error) {
|
||||
if cacheMap == nil {
|
||||
|
||||
Reference in New Issue
Block a user