MCPcopy Create free account
hub / github.com/apache/casbin-server / parseParam

Method parseParam

server/enforcer.go:148–164  ·  view source on GitHub ↗
(param, matcher string)

Source from the content-addressed store, hash-verified

146}
147
148func (s *Server) parseParam(param, matcher string) (interface{}, string) {
149 if strings.HasPrefix(param, "ABAC::") {
150 attrList, err := resolveABAC(param)
151 if err != nil {
152 panic(err)
153 }
154 for k, v := range attrList.nameMap {
155 old := "." + k
156 if strings.Contains(matcher, old) {
157 matcher = strings.Replace(matcher, old, "."+v, -1)
158 }
159 }
160 return attrList, matcher
161 } else {
162 return param, matcher
163 }
164}
165
166func (s *Server) Enforce(ctx context.Context, in *pb.EnforceRequest) (*pb.BoolReply, error) {
167 e, err := s.getEnforcer(int(in.EnforcerHandler))

Callers 1

EnforceMethod · 0.95

Calls 1

resolveABACFunction · 0.85

Tested by

no test coverage detected