mirror of
https://gitee.com/gokins/gokins.git
synced 2024-11-29 17:57:50 +08:00
21 lines
386 B
Go
21 lines
386 B
Go
package service
|
|
|
|
import (
|
|
"errors"
|
|
"github.com/gokins/gokins/model"
|
|
)
|
|
|
|
func TriggerPerm(tt *model.TTrigger) error {
|
|
lgus := &model.TUser{
|
|
Id: tt.Uid,
|
|
}
|
|
perm := NewPipePerm(lgus, tt.PipelineId)
|
|
if perm.Pipeline() == nil {
|
|
return errors.New("流水线不存在")
|
|
}
|
|
if !IsAdmin(lgus) && !perm.CanWrite() {
|
|
return errors.New("触发器创建者没有权限")
|
|
}
|
|
return nil
|
|
}
|