|
|
package rbac
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
)
|
|
|
|
|
|
type UserObject struct {
|
|
|
UserId int64 `json:"user_id"`
|
|
|
CompanyId int64 `json:"company_id"`
|
...
|
...
|
@@ -37,6 +41,16 @@ func (p *PermissionOptionBase) GetValidFunc(k string) func(UserObject) bool { |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (p *PermissionOptionBase) MergeObject(jsonString string) error {
|
|
|
var obj PermissionBase
|
|
|
err := json.Unmarshal([]byte(jsonString), &obj)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
// if o
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// //StringUnmarshal PermissionOptionBase 接口实现
|
|
|
// func (p *PermissionOptionBase) StringUnmarshal(s string) error {
|
|
|
// err := json.Unmarshal([]byte(s), p)
|
...
|
...
|
@@ -119,6 +133,11 @@ func (p *OptionOpportunity) GetValidFunc(k string) func(UserObject) bool { |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//MergeObject PermissionOptionBase 接口实现
|
|
|
func (p *OptionOpportunity) MergeObject(string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (p *OptionOpportunity) ValidCheck(obj UserObject) bool {
|
|
|
if p.Check > 0 {
|
|
|
return true
|
...
|
...
|
|