...
|
...
|
@@ -25,7 +25,7 @@ func NewPermissionOptionBase() PermissionOptionObject { |
|
|
}
|
|
|
}
|
|
|
|
|
|
func (p *PermissionOptionBase) ValidDefault(obj UserObject) bool {
|
|
|
func (p *PermissionOptionBase) ValidDefault() bool {
|
|
|
if p.Check == 1 {
|
|
|
return true
|
|
|
}
|
...
|
...
|
@@ -33,14 +33,15 @@ func (p *PermissionOptionBase) ValidDefault(obj UserObject) bool { |
|
|
}
|
|
|
|
|
|
//GetValidFunc PermissionOptionBase 接口实现
|
|
|
func (p *PermissionOptionBase) GetValidFunc(k string) func(UserObject) bool {
|
|
|
m := map[string]func(UserObject) bool{
|
|
|
func (p *PermissionOptionBase) GetValidFunc(k string) bool {
|
|
|
m := map[string]func() bool{
|
|
|
"default": p.ValidDefault,
|
|
|
}
|
|
|
if _, ok := m[k]; ok {
|
|
|
return m[k]
|
|
|
if fn, ok := m[k]; ok {
|
|
|
b := fn()
|
|
|
return b
|
|
|
}
|
|
|
return nil
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
func (p *PermissionOptionBase) MergeObject(jsonString string) error {
|
...
|
...
|
@@ -131,14 +132,15 @@ func NewOptionOpportunity() PermissionOptionObject { |
|
|
}
|
|
|
|
|
|
//GetValidFunc PermissionOptionBase 接口实现
|
|
|
func (p *OptionOpportunity) GetValidFunc(k string) func(UserObject) bool {
|
|
|
m := map[string]func(UserObject) bool{
|
|
|
func (p *OptionOpportunity) GetValidFunc(k string) bool {
|
|
|
m := map[string]func() bool{
|
|
|
"check": p.ValidCheck,
|
|
|
}
|
|
|
if _, ok := m[k]; ok {
|
|
|
return m[k]
|
|
|
if fn, ok := m[k]; ok {
|
|
|
b := fn()
|
|
|
return b
|
|
|
}
|
|
|
return nil
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
//MergeObject PermissionOptionBase 接口实现
|
...
|
...
|
@@ -195,20 +197,20 @@ func (p *OptionOpportunity) MergeObject(jsonString string) error { |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (p *OptionOpportunity) ValidCheck(obj UserObject) bool {
|
|
|
func (p *OptionOpportunity) ValidCheck() bool {
|
|
|
if p.Check > 0 {
|
|
|
return true
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
func (p *OptionOpportunity) ValidEditSorce(obj UserObject) bool {
|
|
|
func (p *OptionOpportunity) ValidEditSorce() bool {
|
|
|
if p.EditSorce > 0 {
|
|
|
return true
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
func (p *OptionOpportunity) ValidEditPublicStatus(obj UserObject) bool {
|
|
|
func (p *OptionOpportunity) ValidEditPublicStatus() bool {
|
|
|
if p.EditPublicStatus > 0 {
|
|
|
return true
|
|
|
}
|
...
|
...
|
|