|
@@ -25,7 +25,7 @@ func NewPermissionOptionBase() PermissionOptionObject { |
|
@@ -25,7 +25,7 @@ func NewPermissionOptionBase() PermissionOptionObject { |
25
|
}
|
25
|
}
|
26
|
}
|
26
|
}
|
27
|
|
27
|
|
28
|
-func (p *PermissionOptionBase) ValidDefault(obj UserObject) bool {
|
28
|
+func (p *PermissionOptionBase) ValidDefault() bool {
|
29
|
if p.Check == 1 {
|
29
|
if p.Check == 1 {
|
30
|
return true
|
30
|
return true
|
31
|
}
|
31
|
}
|
|
@@ -33,14 +33,15 @@ func (p *PermissionOptionBase) ValidDefault(obj UserObject) bool { |
|
@@ -33,14 +33,15 @@ func (p *PermissionOptionBase) ValidDefault(obj UserObject) bool { |
33
|
}
|
33
|
}
|
34
|
|
34
|
|
35
|
//GetValidFunc PermissionOptionBase 接口实现
|
35
|
//GetValidFunc PermissionOptionBase 接口实现
|
36
|
-func (p *PermissionOptionBase) GetValidFunc(k string) func(UserObject) bool {
|
|
|
37
|
- m := map[string]func(UserObject) bool{
|
36
|
+func (p *PermissionOptionBase) GetValidFunc(k string) bool {
|
|
|
37
|
+ m := map[string]func() bool{
|
38
|
"default": p.ValidDefault,
|
38
|
"default": p.ValidDefault,
|
39
|
}
|
39
|
}
|
40
|
- if _, ok := m[k]; ok {
|
|
|
41
|
- return m[k]
|
40
|
+ if fn, ok := m[k]; ok {
|
|
|
41
|
+ b := fn()
|
|
|
42
|
+ return b
|
42
|
}
|
43
|
}
|
43
|
- return nil
|
44
|
+ return false
|
44
|
}
|
45
|
}
|
45
|
|
46
|
|
46
|
func (p *PermissionOptionBase) MergeObject(jsonString string) error {
|
47
|
func (p *PermissionOptionBase) MergeObject(jsonString string) error {
|
|
@@ -131,14 +132,15 @@ func NewOptionOpportunity() PermissionOptionObject { |
|
@@ -131,14 +132,15 @@ func NewOptionOpportunity() PermissionOptionObject { |
131
|
}
|
132
|
}
|
132
|
|
133
|
|
133
|
//GetValidFunc PermissionOptionBase 接口实现
|
134
|
//GetValidFunc PermissionOptionBase 接口实现
|
134
|
-func (p *OptionOpportunity) GetValidFunc(k string) func(UserObject) bool {
|
|
|
135
|
- m := map[string]func(UserObject) bool{
|
135
|
+func (p *OptionOpportunity) GetValidFunc(k string) bool {
|
|
|
136
|
+ m := map[string]func() bool{
|
136
|
"check": p.ValidCheck,
|
137
|
"check": p.ValidCheck,
|
137
|
}
|
138
|
}
|
138
|
- if _, ok := m[k]; ok {
|
|
|
139
|
- return m[k]
|
139
|
+ if fn, ok := m[k]; ok {
|
|
|
140
|
+ b := fn()
|
|
|
141
|
+ return b
|
140
|
}
|
142
|
}
|
141
|
- return nil
|
143
|
+ return false
|
142
|
}
|
144
|
}
|
143
|
|
145
|
|
144
|
//MergeObject PermissionOptionBase 接口实现
|
146
|
//MergeObject PermissionOptionBase 接口实现
|
|
@@ -195,20 +197,20 @@ func (p *OptionOpportunity) MergeObject(jsonString string) error { |
|
@@ -195,20 +197,20 @@ func (p *OptionOpportunity) MergeObject(jsonString string) error { |
195
|
return nil
|
197
|
return nil
|
196
|
}
|
198
|
}
|
197
|
|
199
|
|
198
|
-func (p *OptionOpportunity) ValidCheck(obj UserObject) bool {
|
200
|
+func (p *OptionOpportunity) ValidCheck() bool {
|
199
|
if p.Check > 0 {
|
201
|
if p.Check > 0 {
|
200
|
return true
|
202
|
return true
|
201
|
}
|
203
|
}
|
202
|
return false
|
204
|
return false
|
203
|
}
|
205
|
}
|
204
|
|
206
|
|
205
|
-func (p *OptionOpportunity) ValidEditSorce(obj UserObject) bool {
|
207
|
+func (p *OptionOpportunity) ValidEditSorce() bool {
|
206
|
if p.EditSorce > 0 {
|
208
|
if p.EditSorce > 0 {
|
207
|
return true
|
209
|
return true
|
208
|
}
|
210
|
}
|
209
|
return false
|
211
|
return false
|
210
|
}
|
212
|
}
|
211
|
-func (p *OptionOpportunity) ValidEditPublicStatus(obj UserObject) bool {
|
213
|
+func (p *OptionOpportunity) ValidEditPublicStatus() bool {
|
212
|
if p.EditPublicStatus > 0 {
|
214
|
if p.EditPublicStatus > 0 {
|
213
|
return true
|
215
|
return true
|
214
|
}
|
216
|
}
|