├── examples ├── basic_without_resources_policy.csv ├── rbac_with_domains_policy.csv ├── abac_model.conf ├── basic_without_resources_model.conf ├── rbac_model.conf ├── rbac_policy.csv └── rbac_with_domains_model.conf ├── .github ├── semantic.yml └── workflows │ └── default.yml ├── config ├── connection_config.json ├── connection_config_redis_example.json ├── connection_config_mongo_example.json └── connection_config_psql_example.json ├── .gitignore ├── .releaserc.json ├── server ├── test_util.go ├── abac.go ├── adapter_test.go ├── model_test.go ├── adapter.go ├── enforcer.go ├── rbac_api.go ├── rbac_api_test.go ├── management_api_test.go └── management_api.go ├── Dockerfile ├── main.go ├── go.mod ├── proto ├── casbin.proto └── casbin.pb.go ├── README.md ├── LICENSE └── go.sum /examples/basic_without_resources_policy.csv: -------------------------------------------------------------------------------- 1 | p, alice, read 2 | p, bob, write -------------------------------------------------------------------------------- /.github/semantic.yml: -------------------------------------------------------------------------------- 1 | # Always validate the PR title AND all the commits 2 | titleAndCommits: true -------------------------------------------------------------------------------- /config/connection_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "file", 3 | "connection": "examples/rbac_policy.csv", 4 | "enforcer": "examples/rbac_model.conf" 5 | } 6 | -------------------------------------------------------------------------------- /config/connection_config_redis_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "redis", 3 | "connection": "localhost:6379", 4 | "enforcer": "examples/rbac_model.conf" 5 | } 6 | -------------------------------------------------------------------------------- /examples/rbac_with_domains_policy.csv: -------------------------------------------------------------------------------- 1 | p, admin, domain1, data1, read 2 | p, admin, domain1, data1, write 3 | p, admin, domain2, data2, read 4 | p, admin, domain2, data2, write 5 | g, alice, admin, domain1 6 | g, bob, admin, domain2 -------------------------------------------------------------------------------- /examples/abac_model.conf: -------------------------------------------------------------------------------- 1 | [request_definition] 2 | r = sub, obj, act 3 | 4 | [policy_definition] 5 | p = sub, obj, act 6 | 7 | [policy_effect] 8 | e = some(where (p.eft == allow)) 9 | 10 | [matchers] 11 | m = r.sub == r.obj.Owner -------------------------------------------------------------------------------- /config/connection_config_mongo_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "mongodb", 3 | "connection": "mongodb://username:password@localhost:27017/mydatabase?ssl=true&replicaSet=myReplicaSet&authSource=admin", 4 | "enforcer": "examples/rbac_model.conf" 5 | } 6 | -------------------------------------------------------------------------------- /config/connection_config_psql_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "postgres", 3 | "connection": "host=$DB_HOST port=$DB_PORT user=$DB_USERNAME dbname=$DB_NAME password=$DB_PASSWORD", 4 | "enforcer": "examples/rbac_model.conf", 5 | "dbSpecified" : true 6 | } 7 | -------------------------------------------------------------------------------- /examples/basic_without_resources_model.conf: -------------------------------------------------------------------------------- 1 | [request_definition] 2 | r = sub, act 3 | 4 | [policy_definition] 5 | p = sub, act 6 | 7 | [policy_effect] 8 | e = some(where (p.eft == allow)) 9 | 10 | [matchers] 11 | m = r.sub == p.sub && r.act == p.act -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | casbin-server 8 | 9 | # Test binary, build with `go test -c` 10 | *.test 11 | 12 | # Output of the go coverage tool, specifically when used with LiteIDE 13 | *.out 14 | 15 | .idea/ 16 | *.iml 17 | -------------------------------------------------------------------------------- /examples/rbac_model.conf: -------------------------------------------------------------------------------- 1 | [request_definition] 2 | r = sub, obj, act 3 | 4 | [policy_definition] 5 | p = sub, obj, act 6 | 7 | [role_definition] 8 | g = _, _ 9 | 10 | [policy_effect] 11 | e = some(where (p.eft == allow)) 12 | 13 | [matchers] 14 | m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act -------------------------------------------------------------------------------- /examples/rbac_policy.csv: -------------------------------------------------------------------------------- 1 | p, alice, data1, read 2 | p, bob, data2, write 3 | p, data2_admin, data2, read 4 | p, data2_admin, data2, write 5 | 6 | g, alice, data2_admin 7 | 8 | g, george, data3_admin 9 | g, data3_admin, data4_admin 10 | 11 | p, data3_admin, data3, admin 12 | p, data4_admin, data4, read -------------------------------------------------------------------------------- /examples/rbac_with_domains_model.conf: -------------------------------------------------------------------------------- 1 | [request_definition] 2 | r = sub, dom, obj, act 3 | 4 | [policy_definition] 5 | p = sub, dom, obj, act 6 | 7 | [role_definition] 8 | g = _, _, _ 9 | 10 | [policy_effect] 11 | e = some(where (p.eft == allow)) 12 | 13 | [matchers] 14 | m = g(r.sub, p.sub, r.dom) && r.dom == p.dom && r.obj == p.obj && r.act == p.act -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "debug": true, 3 | "branches": [ 4 | "+([0-9])?(.{+([0-9]),x}).x", 5 | "master", 6 | { 7 | "name": "beta", 8 | "prerelease": true 9 | } 10 | ], 11 | "plugins": [ 12 | "@semantic-release/commit-analyzer", 13 | "@semantic-release/release-notes-generator", 14 | "@semantic-release/github" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /server/test_util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package server 16 | 17 | import ( 18 | "context" 19 | "io/ioutil" 20 | "testing" 21 | 22 | pb "github.com/casbin/casbin-server/proto" 23 | ) 24 | 25 | type testEngine struct { 26 | s *Server 27 | ctx context.Context 28 | h int32 29 | } 30 | 31 | func newTestEngine(t *testing.T, from, connectStr string, modelLoc string) *testEngine { 32 | s := NewServer() 33 | ctx := context.Background() 34 | 35 | _, err := s.NewAdapter(ctx, &pb.NewAdapterRequest{DriverName: from, ConnectString: connectStr}) 36 | if err != nil { 37 | t.Fatal(err) 38 | } 39 | 40 | modelText, err := ioutil.ReadFile(modelLoc) 41 | if err != nil { 42 | t.Fatal(err) 43 | } 44 | 45 | resp, err := s.NewEnforcer(ctx, &pb.NewEnforcerRequest{ModelText: string(modelText), AdapterHandle: 0, EnableAcceptJsonRequest: true}) 46 | if err != nil { 47 | t.Fatal(err) 48 | } 49 | 50 | return &testEngine{s: s, ctx: ctx, h: resp.Handler} 51 | } 52 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.19 as BACK 2 | 3 | RUN apt-get update && \ 4 | apt-get -y install unzip build-essential autoconf libtool 5 | 6 | WORKDIR /go/src 7 | COPY . . 8 | 9 | # Install protobuf from source 10 | RUN curl -LjO https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.17.3.zip && \ 11 | unzip v3.17.3.zip && \ 12 | cd protobuf-3.17.3 && \ 13 | ./autogen.sh && \ 14 | ./configure && \ 15 | make && \ 16 | make install && \ 17 | ldconfig && \ 18 | make clean && \ 19 | cd .. && \ 20 | rm -r protobuf-3.17.3 && \ 21 | rm v3.17.3.zip 22 | 23 | # Go environment variable to enable Go modules 24 | ARG TARGETOS 25 | ARG TARGETARCH 26 | ENV GO111MODULE=on \ 27 | CGO_ENABLED=0 \ 28 | GOOS=${TARGETOS} \ 29 | GOARCH=${TARGETARCH} 30 | 31 | # Download dependencies 32 | RUN go mod download 33 | 34 | # Install protoc-gen-go 35 | RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.0 36 | RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0 37 | 38 | # Copy the source and generate the .proto file 39 | ADD . /go/src/github.com/casbin/casbin-server 40 | WORKDIR $GOPATH/src/github.com/casbin/casbin-server 41 | RUN protoc --go_out=. --go_opt=paths=source_relative \ 42 | --go-grpc_out=. --go-grpc_opt=require_unimplemented_servers=false \ 43 | --go-grpc_opt=paths=source_relative proto/casbin.proto 44 | 45 | # Install app 46 | RUN go install . 47 | 48 | RUN cd /go/src && go build -o casbin-server 49 | 50 | FROM alpine:latest as STANDARD 51 | WORKDIR /app 52 | COPY --from=BACK /go/src/casbin-server /app/ 53 | ENTRYPOINT ./casbin-server 54 | 55 | EXPOSE 50051 56 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //go:generate protoc -I proto --go_out=plugins=grpc:proto proto/casbin.proto 16 | 17 | package main 18 | 19 | import ( 20 | "flag" 21 | "fmt" 22 | "log" 23 | "net" 24 | 25 | pb "github.com/casbin/casbin-server/proto" 26 | "github.com/casbin/casbin-server/server" 27 | "google.golang.org/grpc" 28 | "google.golang.org/grpc/reflection" 29 | ) 30 | 31 | func main() { 32 | var port int 33 | flag.IntVar(&port, "port", 50051, "listening port") 34 | flag.Parse() 35 | 36 | if port < 1 || port > 65535 { 37 | panic(fmt.Sprintf("invalid port number: %d", port)) 38 | } 39 | 40 | lis, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) 41 | if err != nil { 42 | log.Fatalf("failed to listen: %v", err) 43 | } 44 | s := grpc.NewServer() 45 | pb.RegisterCasbinServer(s, server.NewServer()) 46 | // Register reflection service on gRPC server. 47 | reflection.Register(s) 48 | log.Println("Listening on", port) 49 | if err := s.Serve(lis); err != nil { 50 | log.Fatalf("failed to serve: %v", err) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /server/abac.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package server 16 | 17 | import ( 18 | "encoding/json" 19 | "fmt" 20 | "strconv" 21 | "unicode" 22 | ) 23 | 24 | type AbacAttrList struct { 25 | V0 string 26 | V1 string 27 | V2 string 28 | V3 string 29 | V4 string 30 | V5 string 31 | V6 string 32 | V7 string 33 | V8 string 34 | V9 string 35 | V10 string 36 | nameMap map[string]string 37 | } 38 | 39 | func toUpperFirstChar(str string) string { 40 | for i, v := range str { 41 | return string(unicode.ToUpper(v)) + str[i+1:] 42 | } 43 | return "" 44 | } 45 | 46 | func MakeABAC(obj interface{}) (string, error) { 47 | data, err := json.Marshal(&obj) 48 | if err != nil { 49 | return "", err 50 | } 51 | return "ABAC::" + string(data), nil 52 | } 53 | 54 | func resolveABAC(obj string) (AbacAttrList, error) { 55 | var jsonMap map[string]interface{} 56 | attrList := AbacAttrList{nameMap: map[string]string{}} 57 | 58 | err := json.Unmarshal([]byte(obj[len("ABAC::"):]), &jsonMap) 59 | if err != nil { 60 | return attrList, err 61 | } 62 | 63 | i := 0 64 | for k, v := range jsonMap { 65 | key := toUpperFirstChar(k) 66 | value := fmt.Sprintf("%v", v) 67 | attrList.nameMap[key] = "V" + strconv.Itoa(i) 68 | switch i { 69 | case 0: 70 | attrList.V0 = value 71 | case 1: 72 | attrList.V1 = value 73 | case 2: 74 | attrList.V2 = value 75 | case 3: 76 | attrList.V3 = value 77 | case 4: 78 | attrList.V4 = value 79 | case 5: 80 | attrList.V5 = value 81 | case 6: 82 | attrList.V6 = value 83 | case 7: 84 | attrList.V7 = value 85 | case 8: 86 | attrList.V8 = value 87 | case 9: 88 | attrList.V9 = value 89 | case 10: 90 | attrList.V10 = value 91 | } 92 | i++ 93 | } 94 | 95 | return attrList, nil 96 | } 97 | 98 | func (attr AbacAttrList) GetCacheKey() string { 99 | res, _ := MakeABAC(&attr) 100 | return res 101 | } -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/casbin/casbin-server 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/alicebob/miniredis/v2 v2.35.0 7 | github.com/casbin/casbin/v2 v2.100.0 8 | github.com/casbin/gorm-adapter/v3 v3.14.0 9 | github.com/casbin/mongodb-adapter/v3 v3.7.0 10 | github.com/casbin/redis-adapter/v3 v3.6.0 11 | github.com/stretchr/testify v1.8.0 12 | google.golang.org/grpc v1.42.0 13 | google.golang.org/protobuf v1.27.1 14 | ) 15 | 16 | require ( 17 | github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect 18 | github.com/casbin/govaluate v1.2.0 // indirect 19 | github.com/davecgh/go-spew v1.1.1 // indirect 20 | github.com/glebarez/go-sqlite v1.19.1 // indirect 21 | github.com/glebarez/sqlite v1.5.0 // indirect 22 | github.com/go-sql-driver/mysql v1.6.0 // indirect 23 | github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect 24 | github.com/golang-sql/sqlexp v0.1.0 // indirect 25 | github.com/golang/protobuf v1.5.0 // indirect 26 | github.com/golang/snappy v0.0.1 // indirect 27 | github.com/gomodule/redigo v1.8.9 // indirect 28 | github.com/google/uuid v1.3.0 // indirect 29 | github.com/jackc/chunkreader/v2 v2.0.1 // indirect 30 | github.com/jackc/pgconn v1.13.0 // indirect 31 | github.com/jackc/pgio v1.0.0 // indirect 32 | github.com/jackc/pgpassfile v1.0.0 // indirect 33 | github.com/jackc/pgproto3/v2 v2.3.1 // indirect 34 | github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect 35 | github.com/jackc/pgtype v1.12.0 // indirect 36 | github.com/jackc/pgx/v4 v4.17.2 // indirect 37 | github.com/jinzhu/inflection v1.0.0 // indirect 38 | github.com/jinzhu/now v1.1.5 // indirect 39 | github.com/klauspost/compress v1.13.6 // indirect 40 | github.com/kr/pretty v0.3.0 // indirect 41 | github.com/mattn/go-isatty v0.0.16 // indirect 42 | github.com/microsoft/go-mssqldb v0.17.0 // indirect 43 | github.com/montanaflynn/stats v0.6.6 // indirect 44 | github.com/pmezard/go-difflib v1.0.0 // indirect 45 | github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect 46 | github.com/xdg-go/pbkdf2 v1.0.0 // indirect 47 | github.com/xdg-go/scram v1.1.2 // indirect 48 | github.com/xdg-go/stringprep v1.0.4 // indirect 49 | github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect 50 | github.com/yuin/gopher-lua v1.1.1 // indirect 51 | go.mongodb.org/mongo-driver v1.12.0 // indirect 52 | golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b // indirect 53 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect 54 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect 55 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect 56 | golang.org/x/text v0.7.0 // indirect 57 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect 58 | gopkg.in/yaml.v3 v3.0.1 // indirect 59 | gorm.io/driver/mysql v1.4.1 // indirect 60 | gorm.io/driver/postgres v1.4.4 // indirect 61 | gorm.io/driver/sqlserver v1.4.1 // indirect 62 | gorm.io/gorm v1.24.0 // indirect 63 | gorm.io/plugin/dbresolver v1.3.0 // indirect 64 | modernc.org/libc v1.19.0 // indirect 65 | modernc.org/mathutil v1.5.0 // indirect 66 | modernc.org/memory v1.4.0 // indirect 67 | modernc.org/sqlite v1.19.1 // indirect 68 | ) 69 | -------------------------------------------------------------------------------- /.github/workflows/default.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: [ push, pull_request ] 4 | 5 | jobs: 6 | coveralls: 7 | name: Test with Coverage 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Set up Go 11 | uses: actions/setup-go@v2 12 | with: 13 | go-version: '1.19' 14 | - name: Check out code 15 | uses: actions/checkout@v3 16 | - name: Install dependencies 17 | run: | 18 | go mod download 19 | - name: Run Unit tests 20 | run: | 21 | go test -race -covermode atomic -coverprofile=covprofile ./... 22 | - name: Install goveralls 23 | run: go install github.com/mattn/goveralls@latest 24 | - name: Send coverage 25 | env: 26 | COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} 27 | run: goveralls -coverprofile=covprofile -service=github 28 | 29 | release-and-push: 30 | name: Release And Push 31 | runs-on: ubuntu-latest 32 | if: github.repository == 'casbin/casbin-server' && github.event_name == 'push' 33 | needs: [ coveralls ] 34 | steps: 35 | - name: Checkout 36 | uses: actions/checkout@v2 37 | 38 | - name: Fetch Previous version 39 | id: get-previous-tag 40 | uses: actions-ecosystem/action-get-latest-tag@v1.6.0 41 | 42 | - name: Run semantic-release 43 | run: | 44 | npm install --save-dev semantic-release@17.2.4 45 | npx semantic-release 46 | env: 47 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 48 | 49 | - name: Fetch Current version 50 | id: get-current-tag 51 | uses: actions-ecosystem/action-get-latest-tag@v1.6.0 52 | 53 | - name: Decide Should Push Or Not 54 | id: should_push 55 | run: | 56 | old_version=${{steps.get-previous-tag.outputs.tag}} 57 | new_version=${{steps.get-current-tag.outputs.tag }} 58 | old_array=(${old_version//\./ }) 59 | new_array=(${new_version//\./ }) 60 | if [ ${old_array[0]} != ${new_array[0]} ] 61 | then 62 | echo ::set-output name=push::'true' 63 | elif [ ${old_array[1]} != ${new_array[1]} ] 64 | then 65 | echo ::set-output name=push::'true' 66 | 67 | else 68 | echo ::set-output name=push::'false' 69 | 70 | fi 71 | - name: Set up QEMU 72 | uses: docker/setup-qemu-action@v2 73 | 74 | - name: Set up buildx 75 | id: buildx 76 | uses: docker/setup-buildx-action@v2 77 | with: 78 | version: latest 79 | 80 | - name: Log in to Docker Hub 81 | uses: docker/login-action@v1 82 | if: github.repository == 'casbin/casbin-server' && github.event_name == 'push' && steps.should_push.outputs.push=='true' 83 | with: 84 | username: ${{ secrets.DOCKERHUB_USERNAME }} 85 | password: ${{ secrets.DOCKERHUB_PASSWORD }} 86 | 87 | - name: Push to Docker Hub 88 | uses: docker/build-push-action@v3 89 | if: github.repository == 'casbin/casbin-server' && github.event_name == 'push' && steps.should_push.outputs.push=='true' 90 | with: 91 | target: STANDARD 92 | platforms: linux/amd64,linux/arm64 93 | push: true 94 | tags: casbin/casbin-server:${{steps.get-current-tag.outputs.tag }},casbin/casbin-server:latest -------------------------------------------------------------------------------- /server/adapter_test.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "os" 5 | "testing" 6 | 7 | miniredis "github.com/alicebob/miniredis/v2" 8 | 9 | pb "github.com/casbin/casbin-server/proto" 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func TestGetLocalConfig(t *testing.T) { 14 | assert.Equal(t, configFileDefaultPath, getLocalConfigPath(), "read from default connection config path if environment variable is not set") 15 | 16 | os.Setenv(configFilePathEnvironmentVariable, "dir/custom_path.json") 17 | assert.Equal(t, "dir/custom_path.json", getLocalConfigPath()) 18 | } 19 | 20 | func runFakeRedis(username string, password string) (host string, port string, err error) { 21 | s, err := miniredis.Run() 22 | if err != nil { 23 | return "", "", err 24 | } 25 | if username != "" && password != "" { 26 | s.RequireUserAuth(username, password) 27 | } 28 | return s.Host(), s.Port(), err 29 | } 30 | 31 | func TestRedisAdapterConfig(t *testing.T) { 32 | os.Setenv(configFilePathEnvironmentVariable, "../config/connection_config.json") 33 | 34 | host, port, err := runFakeRedis("", "") 35 | 36 | in := &pb.NewAdapterRequest{ 37 | DriverName: "redis", 38 | ConnectString: "redis://" + host + ":" + port, 39 | } 40 | 41 | a, err := newAdapter(in) 42 | assert.NoError(t, err, "should create redis adapter without error") 43 | assert.NotNil(t, a, "adapter should not be nil") 44 | } 45 | 46 | func TestRedisAdapterConfigWithUsernameAndPassword(t *testing.T) { 47 | os.Setenv(configFilePathEnvironmentVariable, "../config/connection_config.json") 48 | 49 | username, password := "foo", "bar" 50 | host, port, err := runFakeRedis(username, password) 51 | 52 | in := &pb.NewAdapterRequest{ 53 | DriverName: "redis", 54 | ConnectString: "redis://" + username + ":" + password + "@" + host + ":" + port, 55 | } 56 | 57 | a, err := newAdapter(in) 58 | assert.NoError(t, err, "should create redis adapter without error") 59 | assert.NotNil(t, a, "adapter should not be nil") 60 | } 61 | 62 | func TestRedisAdapterConfigWithoutPrefix(t *testing.T) { 63 | os.Setenv(configFilePathEnvironmentVariable, "../config/connection_config.json") 64 | 65 | host, port, err := runFakeRedis("", "") 66 | 67 | in := &pb.NewAdapterRequest{ 68 | DriverName: "redis", 69 | ConnectString: host + ":" + port, 70 | } 71 | 72 | a, err := newAdapter(in) 73 | assert.NoError(t, err, "should create redis adapter without error") 74 | assert.NotNil(t, a, "adapter should not be nil") 75 | } 76 | 77 | func TestInvalidRedisAdapterConfig(t *testing.T) { 78 | os.Setenv(configFilePathEnvironmentVariable, "../config/connection_config.json") 79 | 80 | _, _, err := runFakeRedis("", "") 81 | 82 | in := &pb.NewAdapterRequest{ 83 | DriverName: "redis", 84 | ConnectString: "invalid-address", 85 | } 86 | 87 | a, err := newAdapter(in) 88 | assert.Error(t, err, "should cause an redis adapter without error") 89 | assert.ErrorContains(t, err, "dial tcp: lookup invalid-address") 90 | assert.Nil(t, a, "adapter should be nil") 91 | } 92 | 93 | func TestRedisAdapterConfigReturnDefaultFallback(t *testing.T) { 94 | os.Setenv(configFilePathEnvironmentVariable, "../config/connection_config.json") 95 | 96 | in := &pb.NewAdapterRequest{ 97 | DriverName: "redis", 98 | ConnectString: "", 99 | } 100 | 101 | a, err := newAdapter(in) 102 | assert.NoError(t, err, "should create file default adapter without error") 103 | assert.NotNil(t, a, "adapter should not be nil") 104 | } 105 | -------------------------------------------------------------------------------- /server/model_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package server 16 | 17 | import ( 18 | "context" 19 | "os" 20 | "testing" 21 | 22 | pb "github.com/casbin/casbin-server/proto" 23 | "github.com/stretchr/testify/assert" 24 | ) 25 | 26 | func testEnforce(t *testing.T, e *testEngine, sub string, obj string, act string, res bool) { 27 | t.Helper() 28 | reply, err := e.s.Enforce(e.ctx, &pb.EnforceRequest{EnforcerHandler: e.h, Params: []string{sub, obj, act}}) 29 | assert.NoError(t, err) 30 | 31 | if reply.Res != res { 32 | t.Errorf("%s, %v, %s: %t, supposed to be %t", sub, obj, act, !res, res) 33 | } else { 34 | t.Logf("Enforce for %s, %s, %s : %v", sub, obj, act, reply.Res) 35 | } 36 | } 37 | 38 | func testEnforceWithoutUsers(t *testing.T, e *testEngine, obj string, act string, res bool) { 39 | t.Helper() 40 | reply, err := e.s.Enforce(e.ctx, &pb.EnforceRequest{EnforcerHandler: e.h, Params: []string{obj, act}}) 41 | assert.NoError(t, err) 42 | 43 | if reply.Res != res { 44 | t.Errorf("%s, %s: %t, supposed to be %t", obj, act, !res, res) 45 | } 46 | } 47 | 48 | func TestRBACModel(t *testing.T) { 49 | s := NewServer() 50 | ctx := context.Background() 51 | 52 | _, err := s.NewAdapter(ctx, &pb.NewAdapterRequest{DriverName: "file", ConnectString: "../examples/rbac_policy.csv"}) 53 | if err != nil { 54 | t.Error(err) 55 | } 56 | 57 | modelText, err := os.ReadFile("../examples/rbac_model.conf") 58 | if err != nil { 59 | t.Error(err) 60 | } 61 | 62 | resp, err := s.NewEnforcer(ctx, &pb.NewEnforcerRequest{ModelText: string(modelText), AdapterHandle: 0, EnableAcceptJsonRequest: false}) 63 | if err != nil { 64 | t.Error(err) 65 | } 66 | e := resp.Handler 67 | 68 | sub := "alice" 69 | obj := "data1" 70 | act := "read" 71 | res := true 72 | 73 | resp2, err := s.Enforce(ctx, &pb.EnforceRequest{EnforcerHandler: e, Params: []string{sub, obj, act}}) 74 | if err != nil { 75 | t.Error(err) 76 | } 77 | myRes := resp2.Res 78 | 79 | if myRes != res { 80 | t.Errorf("%s, %s, %s: %t, supposed to be %t", sub, obj, act, myRes, res) 81 | } 82 | } 83 | 84 | func TestABACModel(t *testing.T) { 85 | s := NewServer() 86 | ctx := context.Background() 87 | 88 | modelText, err := os.ReadFile("../examples/abac_model.conf") 89 | if err != nil { 90 | t.Error(err) 91 | } 92 | 93 | resp, err := s.NewEnforcer(ctx, &pb.NewEnforcerRequest{ModelText: string(modelText), AdapterHandle: -1, EnableAcceptJsonRequest: false}) 94 | if err != nil { 95 | t.Error(err) 96 | } 97 | type ABACModel struct { 98 | Name string 99 | Owner string 100 | } 101 | e := resp.Handler 102 | 103 | data1, _ := MakeABAC(ABACModel{Name: "data1", Owner: "alice"}) 104 | data2, _ := MakeABAC(ABACModel{Name: "data2", Owner: "bob"}) 105 | 106 | testModel(t, s, e, "alice", data1, "read", true) 107 | testModel(t, s, e, "alice", data1, "write", true) 108 | testModel(t, s, e, "alice", data2, "read", false) 109 | testModel(t, s, e, "alice", data2, "write", false) 110 | testModel(t, s, e, "bob", data1, "read", false) 111 | testModel(t, s, e, "bob", data1, "write", false) 112 | testModel(t, s, e, "bob", data2, "read", true) 113 | testModel(t, s, e, "bob", data2, "write", true) 114 | 115 | } 116 | 117 | func testModel(t *testing.T, s *Server, enforcerHandler int32, sub string, obj string, act string, res bool) { 118 | t.Helper() 119 | 120 | reply, err := s.Enforce(context.TODO(), &pb.EnforceRequest{EnforcerHandler: enforcerHandler, Params: []string{sub, obj, act}}) 121 | assert.NoError(t, err) 122 | 123 | if reply.Res != res { 124 | t.Errorf("%s, %v, %s: %t, supposed to be %t", sub, obj, act, !res, res) 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /server/adapter.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package server 16 | 17 | import ( 18 | "encoding/json" 19 | "errors" 20 | "fmt" 21 | "net/url" 22 | "os" 23 | "regexp" 24 | "strings" 25 | 26 | pb "github.com/casbin/casbin-server/proto" 27 | "github.com/casbin/casbin/v2/persist" 28 | fileadapter "github.com/casbin/casbin/v2/persist/file-adapter" 29 | gormadapter "github.com/casbin/gorm-adapter/v3" 30 | mongodbadapter "github.com/casbin/mongodb-adapter/v3" 31 | redisadapter "github.com/casbin/redis-adapter/v3" 32 | ) 33 | 34 | var errDriverName = errors.New("currently supported DriverName: file | mysql | postgres | mssql") 35 | 36 | func parseRedisUrl(redisURL string) (host, port, username, password string, err error) { 37 | if redisURL == "" { 38 | return "", "", "", "", errors.New("redis URL cannot be empty") 39 | } 40 | if !strings.Contains(redisURL, "://") { 41 | redisURL = "redis://" + redisURL 42 | } 43 | u, err := url.Parse(redisURL) 44 | if err != nil { 45 | return "", "", "", "", err 46 | } 47 | host = u.Hostname() 48 | port = u.Port() 49 | if u.User != nil { 50 | username = u.User.Username() 51 | password, _ = u.User.Password() 52 | } 53 | return host, port, username, password, nil 54 | } 55 | 56 | func newAdapter(in *pb.NewAdapterRequest) (persist.Adapter, error) { 57 | var a persist.Adapter 58 | in = checkLocalConfig(in) 59 | supportDriverNames := [...]string{"file", "mysql", "postgres", "mssql", "mongodb"} 60 | 61 | switch in.DriverName { 62 | case "file": 63 | a = fileadapter.NewAdapter(in.ConnectString) 64 | case "mongodb": 65 | var err error 66 | a, err = mongodbadapter.NewAdapter(in.ConnectString) 67 | if err != nil { 68 | return nil, err 69 | } 70 | case "redis": 71 | var err error 72 | host, port, username, password, err := parseRedisUrl(in.ConnectString) 73 | if err != nil { 74 | return nil, err 75 | } 76 | hostWithPort := fmt.Sprintf("%s:%s", host, port) 77 | 78 | config := &redisadapter.Config{ 79 | Network: "tcp", 80 | Address: hostWithPort, 81 | Username: username, 82 | Password: password, 83 | } 84 | a, err = redisadapter.NewAdapter(config) 85 | if err != nil { 86 | return nil, err 87 | } 88 | default: 89 | var support = false 90 | for _, driverName := range supportDriverNames { 91 | if driverName == in.DriverName { 92 | support = true 93 | break 94 | } 95 | } 96 | if !support { 97 | return nil, errDriverName 98 | } 99 | 100 | var err error 101 | a, err = gormadapter.NewAdapter(in.DriverName, in.ConnectString, in.DbSpecified) 102 | if err != nil { 103 | return nil, err 104 | } 105 | } 106 | 107 | return a, nil 108 | } 109 | 110 | func checkLocalConfig(in *pb.NewAdapterRequest) *pb.NewAdapterRequest { 111 | cfg := LoadConfiguration(getLocalConfigPath()) 112 | if in.ConnectString == "" || in.DriverName == "" { 113 | in.DriverName = cfg.Driver 114 | in.ConnectString = cfg.Connection 115 | in.DbSpecified = cfg.DBSpecified 116 | } 117 | return in 118 | } 119 | 120 | const ( 121 | configFileDefaultPath = "config/connection_config.json" 122 | configFilePathEnvironmentVariable = "CONNECTION_CONFIG_PATH" 123 | ) 124 | 125 | func getLocalConfigPath() string { 126 | configFilePath := os.Getenv(configFilePathEnvironmentVariable) 127 | if configFilePath == "" { 128 | configFilePath = configFileDefaultPath 129 | } 130 | return configFilePath 131 | } 132 | 133 | func LoadConfiguration(file string) Config { 134 | //Loads a default config from adapter_config in case a custom adapter isn't provided by the client. 135 | //DriverName, ConnectionString, and dbSpecified can be configured in the file. Defaults to 'file' mode. 136 | 137 | configFile, err := os.Open(file) 138 | if err != nil { 139 | fmt.Println(err.Error()) 140 | } 141 | decoder := json.NewDecoder(configFile) 142 | config := Config{} 143 | decoder.Decode(&config) 144 | re := regexp.MustCompile(`\$\b((\w*))\b`) 145 | config.Connection = re.ReplaceAllStringFunc(config.Connection, func(s string) string { 146 | return os.Getenv(strings.TrimPrefix(s, `$`)) 147 | }) 148 | 149 | return config 150 | } 151 | 152 | type Config struct { 153 | Driver string 154 | Connection string 155 | Enforcer string 156 | DBSpecified bool 157 | } 158 | -------------------------------------------------------------------------------- /server/enforcer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package server 16 | 17 | import ( 18 | "context" 19 | "errors" 20 | "os" 21 | "strings" 22 | "sync" 23 | 24 | pb "github.com/casbin/casbin-server/proto" 25 | "github.com/casbin/casbin/v2" 26 | "github.com/casbin/casbin/v2/model" 27 | "github.com/casbin/casbin/v2/persist" 28 | ) 29 | 30 | // Server is used to implement proto.CasbinServer. 31 | type Server struct { 32 | enforcerMap map[int]*casbin.Enforcer 33 | adapterMap map[int]persist.Adapter 34 | muE sync.RWMutex 35 | muA sync.RWMutex 36 | } 37 | 38 | func NewServer() *Server { 39 | s := Server{} 40 | 41 | s.enforcerMap = map[int]*casbin.Enforcer{} 42 | s.adapterMap = map[int]persist.Adapter{} 43 | 44 | return &s 45 | } 46 | 47 | func (s *Server) getEnforcer(handle int) (*casbin.Enforcer, error) { 48 | s.muE.RLock() 49 | defer s.muE.RUnlock() 50 | 51 | if e, ok := s.enforcerMap[handle]; ok { 52 | return e, nil 53 | } else { 54 | return nil, errors.New("enforcer not found") 55 | } 56 | } 57 | 58 | func (s *Server) getAdapter(handle int) (persist.Adapter, error) { 59 | s.muA.RLock() 60 | defer s.muA.RUnlock() 61 | 62 | if a, ok := s.adapterMap[handle]; ok { 63 | return a, nil 64 | } else { 65 | return nil, errors.New("adapter not found") 66 | } 67 | } 68 | 69 | func (s *Server) addEnforcer(e *casbin.Enforcer) int { 70 | s.muE.Lock() 71 | defer s.muE.Unlock() 72 | 73 | cnt := len(s.enforcerMap) 74 | s.enforcerMap[cnt] = e 75 | return cnt 76 | } 77 | 78 | func (s *Server) addAdapter(a persist.Adapter) int { 79 | s.muA.Lock() 80 | defer s.muA.Unlock() 81 | 82 | cnt := len(s.adapterMap) 83 | s.adapterMap[cnt] = a 84 | return cnt 85 | } 86 | 87 | func (s *Server) NewEnforcer(ctx context.Context, in *pb.NewEnforcerRequest) (*pb.NewEnforcerReply, error) { 88 | var a persist.Adapter 89 | var e *casbin.Enforcer 90 | 91 | if in.AdapterHandle != -1 { 92 | var err error 93 | a, err = s.getAdapter(int(in.AdapterHandle)) 94 | if err != nil { 95 | return &pb.NewEnforcerReply{Handler: 0}, err 96 | } 97 | } 98 | 99 | if in.ModelText == "" { 100 | cfg := LoadConfiguration(getLocalConfigPath()) 101 | data, err := os.ReadFile(cfg.Enforcer) 102 | if err != nil { 103 | return &pb.NewEnforcerReply{Handler: 0}, err 104 | } 105 | in.ModelText = string(data) 106 | } 107 | 108 | if a == nil { 109 | m, err := model.NewModelFromString(in.ModelText) 110 | if err != nil { 111 | return &pb.NewEnforcerReply{Handler: 0}, err 112 | } 113 | 114 | e, err = casbin.NewEnforcer(m, false) 115 | if err != nil { 116 | return &pb.NewEnforcerReply{Handler: 0}, err 117 | } 118 | } else { 119 | m, err := model.NewModelFromString(in.ModelText) 120 | if err != nil { 121 | return &pb.NewEnforcerReply{Handler: 0}, err 122 | } 123 | 124 | e, err = casbin.NewEnforcer(m, a) 125 | if err != nil { 126 | return &pb.NewEnforcerReply{Handler: 0}, err 127 | } 128 | } 129 | 130 | e.EnableAcceptJsonRequest(in.EnableAcceptJsonRequest) 131 | 132 | h := s.addEnforcer(e) 133 | 134 | return &pb.NewEnforcerReply{Handler: int32(h)}, nil 135 | } 136 | 137 | func (s *Server) NewAdapter(ctx context.Context, in *pb.NewAdapterRequest) (*pb.NewAdapterReply, error) { 138 | a, err := newAdapter(in) 139 | if err != nil { 140 | return nil, err 141 | } 142 | 143 | h := s.addAdapter(a) 144 | 145 | return &pb.NewAdapterReply{Handler: int32(h)}, nil 146 | } 147 | 148 | func (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 | 166 | func (s *Server) Enforce(ctx context.Context, in *pb.EnforceRequest) (*pb.BoolReply, error) { 167 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 168 | if err != nil { 169 | return &pb.BoolReply{Res: false}, err 170 | } 171 | var param interface{} 172 | params := make([]interface{}, 0, len(in.Params)) 173 | m := e.GetModel()["m"]["m"].Value 174 | 175 | for index := range in.Params { 176 | param, m = s.parseParam(in.Params[index], m) 177 | params = append(params, param) 178 | } 179 | 180 | res, err := e.EnforceWithMatcher(m, params...) 181 | if err != nil { 182 | return &pb.BoolReply{Res: false}, err 183 | } 184 | 185 | return &pb.BoolReply{Res: res}, nil 186 | } 187 | 188 | func (s *Server) LoadPolicy(ctx context.Context, in *pb.EmptyRequest) (*pb.EmptyReply, error) { 189 | e, err := s.getEnforcer(int(in.Handler)) 190 | if err != nil { 191 | return &pb.EmptyReply{}, err 192 | } 193 | 194 | err = e.LoadPolicy() 195 | 196 | return &pb.EmptyReply{}, err 197 | } 198 | 199 | func (s *Server) SavePolicy(ctx context.Context, in *pb.EmptyRequest) (*pb.EmptyReply, error) { 200 | e, err := s.getEnforcer(int(in.Handler)) 201 | if err != nil { 202 | return &pb.EmptyReply{}, err 203 | } 204 | 205 | err = e.SavePolicy() 206 | 207 | return &pb.EmptyReply{}, err 208 | } 209 | -------------------------------------------------------------------------------- /proto/casbin.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | option java_multiple_files = true; 18 | option java_package = "io.grpc.examples.proto"; 19 | option java_outer_classname = "CasbinProto"; 20 | option go_package = "./;proto"; 21 | option csharp_namespace = "CasbinOrg.Grpc"; 22 | 23 | package proto; 24 | 25 | // The Casbin service definition. 26 | service Casbin { 27 | rpc NewEnforcer (NewEnforcerRequest) returns (NewEnforcerReply) {} 28 | rpc NewAdapter (NewAdapterRequest) returns (NewAdapterReply) {} 29 | 30 | rpc Enforce (EnforceRequest) returns (BoolReply) {} 31 | 32 | rpc LoadPolicy (EmptyRequest) returns (EmptyReply) {} 33 | rpc SavePolicy (EmptyRequest) returns (EmptyReply) {} 34 | 35 | rpc AddPolicy (PolicyRequest) returns (BoolReply) {} 36 | rpc AddNamedPolicy (PolicyRequest) returns (BoolReply) {} 37 | rpc RemovePolicy (PolicyRequest) returns (BoolReply) {} 38 | rpc RemoveNamedPolicy (PolicyRequest) returns (BoolReply) {} 39 | rpc RemoveFilteredPolicy (FilteredPolicyRequest) returns (BoolReply) {} 40 | rpc RemoveFilteredNamedPolicy (FilteredPolicyRequest) returns (BoolReply) {} 41 | rpc GetPolicy (EmptyRequest) returns (Array2DReply) {} 42 | rpc GetNamedPolicy (PolicyRequest) returns (Array2DReply) {} 43 | rpc GetFilteredPolicy (FilteredPolicyRequest) returns (Array2DReply) {} 44 | rpc GetFilteredNamedPolicy (FilteredPolicyRequest) returns (Array2DReply) {} 45 | 46 | rpc AddGroupingPolicy (PolicyRequest) returns (BoolReply) {} 47 | rpc AddNamedGroupingPolicy (PolicyRequest) returns (BoolReply) {} 48 | rpc RemoveGroupingPolicy (PolicyRequest) returns (BoolReply) {} 49 | rpc RemoveNamedGroupingPolicy (PolicyRequest) returns (BoolReply) {} 50 | rpc RemoveFilteredGroupingPolicy (FilteredPolicyRequest) returns (BoolReply) {} 51 | rpc RemoveFilteredNamedGroupingPolicy (FilteredPolicyRequest) returns (BoolReply) {} 52 | rpc GetGroupingPolicy (EmptyRequest) returns (Array2DReply) {} 53 | rpc GetNamedGroupingPolicy(PolicyRequest) returns (Array2DReply) {} 54 | rpc GetFilteredGroupingPolicy (FilteredPolicyRequest) returns (Array2DReply) {} 55 | rpc GetFilteredNamedGroupingPolicy (FilteredPolicyRequest) returns (Array2DReply) {} 56 | 57 | rpc GetAllSubjects (EmptyRequest) returns (ArrayReply) {} 58 | rpc GetAllNamedSubjects (SimpleGetRequest) returns (ArrayReply) {} 59 | rpc GetAllObjects (EmptyRequest) returns (ArrayReply) {} 60 | rpc GetAllNamedObjects (SimpleGetRequest) returns (ArrayReply) {} 61 | rpc GetAllActions (EmptyRequest) returns (ArrayReply) {} 62 | rpc GetAllNamedActions (SimpleGetRequest) returns (ArrayReply) {} 63 | rpc GetAllRoles (EmptyRequest) returns (ArrayReply) {} 64 | rpc GetAllNamedRoles (SimpleGetRequest) returns (ArrayReply) {} 65 | 66 | rpc HasPolicy (PolicyRequest) returns (BoolReply) {} 67 | rpc HasNamedPolicy (PolicyRequest) returns (BoolReply) {} 68 | rpc HasGroupingPolicy (PolicyRequest) returns (BoolReply) {} 69 | rpc HasNamedGroupingPolicy (PolicyRequest) returns (BoolReply) {} 70 | 71 | rpc GetDomains(UserRoleRequest) returns (ArrayReply) {} 72 | 73 | rpc GetRolesForUser (UserRoleRequest) returns (ArrayReply) {} 74 | rpc GetImplicitRolesForUser (UserRoleRequest) returns (ArrayReply) {} 75 | rpc GetUsersForRole (UserRoleRequest) returns (ArrayReply) {} 76 | rpc HasRoleForUser (UserRoleRequest) returns (BoolReply) {} 77 | rpc AddRoleForUser (UserRoleRequest) returns (BoolReply) {} 78 | rpc DeleteRoleForUser (UserRoleRequest) returns (BoolReply) {} 79 | rpc DeleteRolesForUser (UserRoleRequest) returns (BoolReply) {} 80 | rpc DeleteUser (UserRoleRequest) returns (BoolReply) {} 81 | rpc DeleteRole (UserRoleRequest) returns (EmptyReply) {} 82 | 83 | rpc GetPermissionsForUser (PermissionRequest) returns (Array2DReply) {} 84 | rpc GetImplicitPermissionsForUser (PermissionRequest) returns (Array2DReply) {} 85 | rpc DeletePermission (PermissionRequest) returns (BoolReply) {} 86 | rpc AddPermissionForUser (PermissionRequest) returns (BoolReply) {} 87 | rpc DeletePermissionForUser (PermissionRequest) returns (BoolReply) {} 88 | rpc DeletePermissionsForUser (PermissionRequest) returns (BoolReply) {} 89 | rpc HasPermissionForUser (PermissionRequest) returns (BoolReply) {} 90 | 91 | } 92 | 93 | message NewEnforcerRequest { 94 | string modelText = 1; 95 | int32 adapterHandle = 2; 96 | bool enableAcceptJsonRequest = 3; 97 | } 98 | 99 | message NewEnforcerReply { 100 | int32 handler = 1; 101 | } 102 | 103 | message NewAdapterRequest { 104 | string adapterName = 1; 105 | string driverName = 2; 106 | string connectString = 3; 107 | bool dbSpecified = 4; 108 | } 109 | 110 | message NewAdapterReply { 111 | int32 handler = 1; 112 | } 113 | 114 | message EnforceRequest { 115 | int32 enforcerHandler = 1; 116 | repeated string params = 2; 117 | } 118 | 119 | message BoolReply { 120 | bool res = 1; 121 | } 122 | 123 | message EmptyRequest { 124 | int32 handler = 1; 125 | } 126 | 127 | message EmptyReply { 128 | } 129 | 130 | message PolicyRequest { 131 | int32 enforcerHandler = 1; 132 | string pType = 2; 133 | repeated string params = 3; 134 | } 135 | 136 | message SimpleGetRequest { 137 | int32 enforcerHandler = 1; 138 | string pType = 2; 139 | } 140 | 141 | message ArrayReply { 142 | repeated string array = 1; 143 | } 144 | 145 | message FilteredPolicyRequest { 146 | int32 enforcerHandler = 1; 147 | string pType = 2; 148 | int32 fieldIndex = 3; 149 | repeated string fieldValues = 4; 150 | } 151 | 152 | message UserRoleRequest { 153 | int32 enforcerHandler = 1; 154 | string user = 2; 155 | string role = 3; 156 | repeated string domain =4; 157 | } 158 | 159 | message PermissionRequest { 160 | int32 enforcerHandler = 1; 161 | string user = 2; 162 | repeated string permissions = 3; 163 | repeated string domain =4; 164 | } 165 | 166 | message Array2DReply { 167 | message d { 168 | repeated string d1 = 1; 169 | } 170 | 171 | repeated d d2 = 1; 172 | } 173 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Casbin Server 2 | ==== 3 | 4 |

5 | 6 | semantic-release 7 | 8 | 9 | docker pull casbin/casbin-server 10 | 11 | 12 | GitHub Workflow Status (branch) 13 | 14 | 15 | GitHub Release 16 | 17 | 18 | Coverage Status 19 | 20 | 21 | Docker Image Version (latest semver) 22 | 23 |

24 | 25 |

26 | 27 | Go Report Card 28 | 29 | 30 | license 31 | 32 | 33 | Discord 34 | 35 |

36 | 37 | 38 | Casbin Server is the ``Access Control as a Service (ACaaS)`` solution based on [Casbin](https://github.com/casbin/casbin). It provides [gRPC](https://grpc.io/) interface for Casbin authorization. 39 | 40 | ## What is ``Casbin Server``? 41 | 42 | Casbin-Server is just a container of Casbin enforcers and adapters. Casbin-Server performs the policy enforcement check, which may take a fair amount of processing depending on the model and number of policies, interfacing to external data stores such as databases for policy data. Just like how native Casbin library works, each Casbin enforcer in Casbin-Server can use its own adapter, which is linked with external database for policy storage. 43 | 44 | Of course, you can setup Casbin-Server together with your policy database in the same machine. But they can be separated. If you want to achieve high availability, you can use a Redis cluster as policy storage, then link Casbin-Server's adapter with it. In this sense, Casbin enforcer can be viewed as stateless component. It just retrieves the policy rules it is interested in (via sharding), does some computation and then returns ``allow`` or ``deny``. 45 | 46 | ## Architecture 47 | 48 | Casbin-Server uses the client-server architecture. Casbin-Server itself is the server (in Golang only for now). The clients for Casbin-Server are listed here: 49 | 50 | Language | Author | Client 51 | ----|----|---- 52 | Golang | Casbin | https://github.com/casbin/casbin-go-client 53 | Java | [Accept008](https://github.com/Accept008) | https://github.com/Accept008/grpc-client 54 | PHP | Casbin | https://github.com/php-casbin/casbin-client 55 | Python | [@prathik-kaliyambath](https://github.com/prathik-kaliyambath)| https://github.com/prathik-kaliyambath/casbin-python-client 56 | 57 | Contributions for clients in other languages are welcome :) 58 | 59 | ## Prerequisites 60 | 61 | ### Protobuf (if not installed): 62 | 63 | As Casbin-Server uses ``gRPC``, you need to [install Protocol Buffers](https://github.com/golang/protobuf#installation) first to generate the ``.proto`` file. The command is: 64 | 65 | ``` 66 | protoc -I proto --go_out=plugins=grpc:proto proto/casbin.proto 67 | ``` 68 | 69 | Alternatively, you can also [run it from an IDE](https://github.com/casbin/casbin-server/blob/6b46c48c8845dc1b8021f2872be08b8e1a62b092/main.go#L15). 70 | 71 | ## Installation 72 | 73 | go get github.com/casbin/casbin-server 74 | 75 | ## Database Support 76 | 77 | Similar to Casbin, Casbin-Server also uses adapters to provide policy storage. However, because Casbin-Server is a service instead of a library, the adapters have to be implemented inside Casbin-Server. As Golang is a static language, each adapter requires to import 3rd-party library for that database. We cannot import all those 3rd-party libraries inside Casbin-Server's code, as it causes dependency overhead. 78 | 79 | For now, [Gorm Adapter](https://github.com/casbin/casbin-server/blob/master/server/adapter.go) (with ``mssql``, ``mysql``, ``postgres``), MongoDB und Redis Adapter are built-in imports all commented. If you want to use ``Gorm Adapter`` with one of those databases, you should uncomment that import line, or add your own import, or even use another adapter by modifying Casbin-Server's source code. 80 | 81 | To allow Casbin-Server to be production-ready, the adapter configuration supports environment variables. For example, assume we created a ``postgres`` database for our RBAC model and want Casbin-Server to use it. Assuming that the environment in which the Casbin-Server runs contains the necessary variables, we can simply use the ``$ENV_VAR`` notation to provide these to the adapter. 82 | 83 | ``` 84 | { 85 | "driver": "postgres", 86 | "connection": "host=$DB_HOST port=$DB_PORT user=$DB_USERNAME dbname=$DB_NAME password=$DB_PASSWORD", 87 | "enforcer": "examples/rbac_policy.csv", 88 | "dbSpecified" : true 89 | } 90 | ``` 91 | The connection config file path can also be set using the environment variable `CONNECTION_CONFIG_PATH`. If this variable is not set, connection config is read from the path "config/connection_config.json". 92 | 93 | ## Docker Way 94 | 95 | ``` 96 | docker run -id -p 50051:50051 --name my-casbin-server casbin/casbin-server 97 | ``` 98 | 99 | If you want to define your own connection file 100 | 101 | ``` 102 | docker run -id -p 50051:50051 \ 103 | -e CONNECTION_CONFIG_PATH=/data/connection_config.json \ 104 | -v ${your local file path}:/data \ 105 | --name my-casbin-server \ 106 | -d casbin/casbin-server 107 | ``` 108 | 109 | If you want to build your own image 110 | 111 | ``` 112 | docker build -f ./Dockerfile -t my-casbin-server-image . 113 | ``` 114 | 115 | ## Limitation of ABAC 116 | 117 | Casbin-Server also supports the ABAC model as the Casbin library does. You may wonder how Casbin-Server passes the Go structs to the server-side via network? Good question. In fact, Casbin-Server's client dumps Go struct into JSON and transmits the JSON string prefixed by ``ABAC::`` to Casbin-Server. Casbin-Server will recognize the prefix and load the JSON string into a pre-defined Go struct with 11 string members, then pass it to Casbin. So there will be several limitations for Casbin-Server's ABAC compared to Casbin's ABAC: 118 | 119 | 1. The Go struct should be flat, all members should be primitive types, e.g., string, int, boolean. No nested struct, no slice or map. 120 | 121 | 2. All members should be public (first letter capitalized). 122 | 123 | 3. The Go struct is limited to 11 members at most. If you want to have more members, you should modify [Casbin-Server's source code](https://github.com/casbin/casbin-server/blob/5e21d10e863c7d8461f951417eb1c63fa00204fb/server/abac.go#L27-L40) by adding more members and rebuild it. 124 | 125 | ## Getting Help 126 | 127 | - [Casbin](https://github.com/casbin/casbin) 128 | 129 | ## License 130 | 131 | This project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text. 132 | -------------------------------------------------------------------------------- /server/rbac_api.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package server 16 | 17 | import ( 18 | "context" 19 | "errors" 20 | 21 | pb "github.com/casbin/casbin-server/proto" 22 | ) 23 | 24 | // GetDomains gets the domains that a user has. 25 | func (s *Server) GetDomains(ctx context.Context, in *pb.UserRoleRequest) (*pb.ArrayReply, error) { 26 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 27 | if err != nil { 28 | return &pb.ArrayReply{}, err 29 | } 30 | 31 | rm := e.GetModel()["g"]["g"].RM 32 | if rm == nil { 33 | return nil, errors.New("RoleManager is nil") 34 | } 35 | 36 | res, _ := rm.GetDomains(in.User) 37 | 38 | return &pb.ArrayReply{Array: res}, nil 39 | } 40 | 41 | // GetRolesForUser gets the roles that a user has. 42 | func (s *Server) GetRolesForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.ArrayReply, error) { 43 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 44 | if err != nil { 45 | return &pb.ArrayReply{}, err 46 | } 47 | 48 | rm := e.GetModel()["g"]["g"].RM 49 | if rm == nil { 50 | return nil, errors.New("RoleManager is nil") 51 | } 52 | 53 | res, _ := rm.GetRoles(in.User, in.Domain...) 54 | 55 | return &pb.ArrayReply{Array: res}, nil 56 | } 57 | 58 | // GetImplicitRolesForUser gets implicit roles that a user has. 59 | func (s *Server) GetImplicitRolesForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.ArrayReply, error) { 60 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 61 | if err != nil { 62 | return &pb.ArrayReply{}, err 63 | } 64 | res, err := e.GetImplicitRolesForUser(in.User) 65 | return &pb.ArrayReply{Array: res}, err 66 | } 67 | 68 | // GetUsersForRole gets the users that have a role. 69 | func (s *Server) GetUsersForRole(ctx context.Context, in *pb.UserRoleRequest) (*pb.ArrayReply, error) { 70 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 71 | if err != nil { 72 | return &pb.ArrayReply{}, err 73 | } 74 | 75 | rm := e.GetModel()["g"]["g"].RM 76 | if rm == nil { 77 | return nil, errors.New("RoleManager is nil") 78 | } 79 | 80 | res, _ := rm.GetUsers(in.Role) 81 | 82 | return &pb.ArrayReply{Array: res}, nil 83 | } 84 | 85 | // HasRoleForUser determines whether a user has a role. 86 | func (s *Server) HasRoleForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error) { 87 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 88 | if err != nil { 89 | return &pb.BoolReply{}, err 90 | } 91 | 92 | roles, err := e.GetRolesForUser(in.User) 93 | if err != nil { 94 | return &pb.BoolReply{}, err 95 | } 96 | 97 | for _, r := range roles { 98 | if r == in.Role { 99 | return &pb.BoolReply{Res: true}, nil 100 | } 101 | } 102 | 103 | return &pb.BoolReply{}, nil 104 | } 105 | 106 | // AddRoleForUser adds a role for a user. 107 | // Returns false if the user already has the role (aka not affected). 108 | func (s *Server) AddRoleForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error) { 109 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 110 | if err != nil { 111 | return &pb.BoolReply{}, err 112 | } 113 | 114 | ruleAdded, err := e.AddGroupingPolicy(in.User, in.Role) 115 | return &pb.BoolReply{Res: ruleAdded}, err 116 | } 117 | 118 | // DeleteRoleForUser deletes a role for a user. 119 | // Returns false if the user does not have the role (aka not affected). 120 | func (s *Server) DeleteRoleForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error) { 121 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 122 | if err != nil { 123 | return &pb.BoolReply{}, err 124 | } 125 | 126 | ruleRemoved, err := e.RemoveGroupingPolicy(in.User, in.Role) 127 | return &pb.BoolReply{Res: ruleRemoved}, err 128 | } 129 | 130 | // DeleteRolesForUser deletes all roles for a user. 131 | // Returns false if the user does not have any roles (aka not affected). 132 | func (s *Server) DeleteRolesForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error) { 133 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 134 | if err != nil { 135 | return &pb.BoolReply{}, err 136 | } 137 | 138 | ruleRemoved, err := e.RemoveFilteredGroupingPolicy(0, in.User) 139 | return &pb.BoolReply{Res: ruleRemoved}, err 140 | } 141 | 142 | // DeleteUser deletes a user. 143 | // Returns false if the user does not exist (aka not affected). 144 | func (s *Server) DeleteUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error) { 145 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 146 | if err != nil { 147 | return &pb.BoolReply{}, err 148 | } 149 | 150 | ruleRemoved, err := e.RemoveFilteredGroupingPolicy(0, in.User) 151 | return &pb.BoolReply{Res: ruleRemoved}, err 152 | } 153 | 154 | // DeleteRole deletes a role. 155 | func (s *Server) DeleteRole(ctx context.Context, in *pb.UserRoleRequest) (*pb.EmptyReply, error) { 156 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 157 | if err != nil { 158 | return &pb.EmptyReply{}, err 159 | } 160 | 161 | _, err = e.DeleteRole(in.Role) 162 | return &pb.EmptyReply{}, err 163 | } 164 | 165 | // DeletePermission deletes a permission. 166 | // Returns false if the permission does not exist (aka not affected). 167 | func (s *Server) DeletePermission(ctx context.Context, in *pb.PermissionRequest) (*pb.BoolReply, error) { 168 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 169 | if err != nil { 170 | return &pb.BoolReply{}, err 171 | } 172 | 173 | ruleRemoved, err := e.RemoveFilteredPolicy(1, in.Permissions...) 174 | return &pb.BoolReply{Res: ruleRemoved}, err 175 | } 176 | 177 | // AddPermissionForUser adds a permission for a user or role. 178 | // Returns false if the user or role already has the permission (aka not affected). 179 | func (s *Server) AddPermissionForUser(ctx context.Context, in *pb.PermissionRequest) (*pb.BoolReply, error) { 180 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 181 | if err != nil { 182 | return &pb.BoolReply{}, err 183 | } 184 | 185 | ruleAdded, err := e.AddPolicy(s.convertPermissions(in.User, in.Permissions...)...) 186 | return &pb.BoolReply{Res: ruleAdded}, err 187 | } 188 | 189 | // DeletePermissionForUser deletes a permission for a user or role. 190 | // Returns false if the user or role does not have the permission (aka not affected). 191 | func (s *Server) DeletePermissionForUser(ctx context.Context, in *pb.PermissionRequest) (*pb.BoolReply, error) { 192 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 193 | if err != nil { 194 | return &pb.BoolReply{}, err 195 | } 196 | 197 | ruleRemoved, err := e.RemovePolicy(s.convertPermissions(in.User, in.Permissions...)...) 198 | return &pb.BoolReply{Res: ruleRemoved}, err 199 | } 200 | 201 | // DeletePermissionsForUser deletes permissions for a user or role. 202 | // Returns false if the user or role does not have any permissions (aka not affected). 203 | func (s *Server) DeletePermissionsForUser(ctx context.Context, in *pb.PermissionRequest) (*pb.BoolReply, error) { 204 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 205 | if err != nil { 206 | return &pb.BoolReply{}, err 207 | } 208 | 209 | ruleRemoved, err := e.RemoveFilteredPolicy(0, in.User) 210 | return &pb.BoolReply{Res: ruleRemoved}, err 211 | } 212 | 213 | // GetPermissionsForUser gets permissions for a user or role. 214 | func (s *Server) GetPermissionsForUser(ctx context.Context, in *pb.PermissionRequest) (*pb.Array2DReply, error) { 215 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 216 | if err != nil { 217 | return &pb.Array2DReply{}, err 218 | } 219 | 220 | filteredPolicy, err := e.GetFilteredPolicy(0, in.User) 221 | if err != nil { 222 | return &pb.Array2DReply{}, err 223 | } 224 | 225 | return s.wrapPlainPolicy(filteredPolicy), nil 226 | } 227 | 228 | // GetImplicitPermissionsForUser gets all permissions(including children) for a user or role. 229 | func (s *Server) GetImplicitPermissionsForUser(ctx context.Context, in *pb.PermissionRequest) (*pb.Array2DReply, error) { 230 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 231 | if err != nil { 232 | return &pb.Array2DReply{}, err 233 | } 234 | resp, err := e.GetImplicitPermissionsForUser(in.User, in.Domain...) 235 | return s.wrapPlainPolicy(resp), err 236 | } 237 | 238 | // HasPermissionForUser determines whether a user has a permission. 239 | func (s *Server) HasPermissionForUser(ctx context.Context, in *pb.PermissionRequest) (*pb.BoolReply, error) { 240 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 241 | if err != nil { 242 | return &pb.BoolReply{}, err 243 | } 244 | 245 | hasPolicy, err := e.HasPolicy(s.convertPermissions(in.User, in.Permissions...)...) 246 | if err != nil { 247 | return &pb.BoolReply{}, err 248 | } 249 | 250 | return &pb.BoolReply{Res: hasPolicy}, nil 251 | } 252 | 253 | func (s *Server) convertPermissions(user string, permissions ...string) []interface{} { 254 | params := make([]interface{}, 0, len(permissions)+1) 255 | params = append(params, user) 256 | for _, perm := range permissions { 257 | params = append(params, perm) 258 | } 259 | 260 | return params 261 | } 262 | -------------------------------------------------------------------------------- /server/rbac_api_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package server 16 | 17 | import ( 18 | "testing" 19 | 20 | pb "github.com/casbin/casbin-server/proto" 21 | "github.com/casbin/casbin/v2/util" 22 | "github.com/stretchr/testify/assert" 23 | ) 24 | 25 | func testGetRoles(t *testing.T, e *testEngine, name string, res []string) { 26 | t.Helper() 27 | reply, err := e.s.GetRolesForUser(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, User: name}) 28 | assert.NoError(t, err) 29 | 30 | t.Log("Roles for ", name, ": ", reply.Array) 31 | 32 | if !util.SetEquals(res, reply.Array) { 33 | t.Error("Roles for ", name, ": ", reply.Array, ", supposed to be ", res) 34 | } 35 | } 36 | 37 | func testGetImplicitRoles(t *testing.T, e *testEngine, name string, res []string) { 38 | t.Helper() 39 | reply, err := e.s.GetImplicitRolesForUser(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, User: name}) 40 | assert.NoError(t, err) 41 | 42 | t.Log("Implicit Roles for ", name, ": ", reply.Array) 43 | 44 | if !util.SetEquals(res, reply.Array) { 45 | t.Error("Implicit Roles for ", name, ": ", reply.Array, ", supposed to be ", res) 46 | } 47 | } 48 | 49 | func testGetUsers(t *testing.T, e *testEngine, name string, res []string) { 50 | t.Helper() 51 | reply, err := e.s.GetUsersForRole(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, Role: name}) 52 | assert.NoError(t, err) 53 | 54 | t.Log("Users for ", name, ": ", reply.Array) 55 | 56 | if !util.SetEquals(res, reply.Array) { 57 | t.Error("Users for ", name, ": ", reply.Array, ", supposed to be ", res) 58 | } 59 | } 60 | 61 | func testHasRole(t *testing.T, e *testEngine, name string, role string, res bool) { 62 | t.Helper() 63 | reply, err := e.s.HasRoleForUser(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, User: name, Role: role}) 64 | assert.NoError(t, err) 65 | 66 | t.Log(name, " has role ", role, ": ", reply.Res) 67 | 68 | if res != reply.Res { 69 | t.Error(name, " has role ", role, ": ", reply.Res, ", supposed to be ", res) 70 | } 71 | } 72 | 73 | func TestRoleAPI(t *testing.T) { 74 | e := newTestEngine(t, "file", "../examples/rbac_policy.csv", "../examples/rbac_model.conf") 75 | 76 | testGetRoles(t, e, "alice", []string{"data2_admin"}) 77 | testGetRoles(t, e, "bob", []string{}) 78 | testGetRoles(t, e, "data2_admin", []string{}) 79 | testGetRoles(t, e, "non_exist", []string{}) 80 | 81 | testHasRole(t, e, "alice", "data1_admin", false) 82 | testHasRole(t, e, "alice", "data2_admin", true) 83 | 84 | _, err := e.s.AddRoleForUser(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, User: "alice", Role: "data1_admin"}) 85 | assert.NoError(t, err) 86 | 87 | testGetRoles(t, e, "alice", []string{"data1_admin", "data2_admin"}) 88 | testGetRoles(t, e, "bob", []string{}) 89 | testGetRoles(t, e, "data2_admin", []string{}) 90 | 91 | _, err = e.s.DeleteRoleForUser(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, User: "alice", Role: "data1_admin"}) 92 | assert.NoError(t, err) 93 | 94 | testGetRoles(t, e, "alice", []string{"data2_admin"}) 95 | testGetRoles(t, e, "bob", []string{}) 96 | testGetRoles(t, e, "data2_admin", []string{}) 97 | 98 | testGetImplicitRoles(t, e, "alice", []string{"data2_admin"}) 99 | testGetImplicitRoles(t, e, "bob", []string{}) 100 | testGetImplicitRoles(t, e, "george", []string{"data3_admin", "data4_admin"}) 101 | 102 | _, err = e.s.DeleteRolesForUser(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, User: "alice"}) 103 | assert.NoError(t, err) 104 | 105 | testGetRoles(t, e, "alice", []string{}) 106 | testGetRoles(t, e, "bob", []string{}) 107 | testGetRoles(t, e, "data2_admin", []string{}) 108 | 109 | _, err = e.s.AddRoleForUser(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, User: "alice", Role: "data1_admin"}) 110 | assert.NoError(t, err) 111 | 112 | _, err = e.s.DeleteUser(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, User: "alice"}) 113 | assert.NoError(t, err) 114 | 115 | testGetRoles(t, e, "alice", []string{}) 116 | testGetRoles(t, e, "bob", []string{}) 117 | testGetRoles(t, e, "data2_admin", []string{}) 118 | 119 | _, err = e.s.AddRoleForUser(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, User: "alice", Role: "data2_admin"}) 120 | assert.NoError(t, err) 121 | 122 | testEnforce(t, e, "alice", "data1", "read", true) 123 | testEnforce(t, e, "alice", "data1", "write", false) 124 | testEnforce(t, e, "alice", "data2", "read", true) 125 | testEnforce(t, e, "alice", "data2", "write", true) 126 | testEnforce(t, e, "bob", "data1", "read", false) 127 | testEnforce(t, e, "bob", "data1", "write", false) 128 | testEnforce(t, e, "bob", "data2", "read", false) 129 | testEnforce(t, e, "bob", "data2", "write", true) 130 | testEnforce(t, e, "bob", "data4", "read", false) 131 | testEnforce(t, e, "george", "data4", "write", false) 132 | testEnforce(t, e, "george", "data4", "read", true) 133 | 134 | _, err = e.s.DeleteRole(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, Role: "data2_admin"}) 135 | assert.NoError(t, err) 136 | 137 | testEnforce(t, e, "alice", "data1", "read", true) 138 | testEnforce(t, e, "alice", "data1", "write", false) 139 | testEnforce(t, e, "alice", "data2", "read", false) 140 | testEnforce(t, e, "alice", "data2", "write", false) 141 | testEnforce(t, e, "bob", "data1", "read", false) 142 | testEnforce(t, e, "bob", "data1", "write", false) 143 | testEnforce(t, e, "bob", "data2", "read", false) 144 | testEnforce(t, e, "bob", "data2", "write", true) 145 | 146 | testGetPermissions(t, e, "alice", [][]string{{"alice", "data1", "read"}}) //Added these in this class as it's part of RBAC. 147 | testGetPermissions(t, e, "bob", [][]string{{"bob", "data2", "write"}}) 148 | testGetPermissions(t, e, "george", [][]string{}) 149 | testGetPermissions(t, e, "data3_admin", [][]string{{"data3_admin", "data3", "admin"}}) 150 | 151 | testGetImplicitPermissions(t, e, "bob", [][]string{{"bob", "data2", "write"}}) 152 | testGetImplicitPermissions(t, e, "data3_admin", [][]string{{"data3_admin", "data3", "admin"}, {"data4_admin", "data4", "read"}}) 153 | } 154 | 155 | func testGetPermissions(t *testing.T, e *testEngine, name string, res [][]string) { 156 | t.Helper() 157 | reply, err := e.s.GetPermissionsForUser(e.ctx, &pb.PermissionRequest{EnforcerHandler: e.h, User: name}) 158 | assert.NoError(t, err) 159 | 160 | myRes := extractFromArray2DReply(reply) 161 | t.Log("Permissions for ", name, ": ", myRes) 162 | 163 | if !util.Array2DEquals(res, myRes) { 164 | t.Error("Permissions for ", name, ": ", myRes, ", supposed to be ", res) 165 | } 166 | } 167 | 168 | func testGetImplicitPermissions(t *testing.T, e *testEngine, name string, res [][]string) { 169 | t.Helper() 170 | reply, err := e.s.GetImplicitPermissionsForUser(e.ctx, &pb.PermissionRequest{EnforcerHandler: e.h, User: name}) 171 | assert.NoError(t, err) 172 | 173 | myRes := extractFromArray2DReply(reply) 174 | t.Log("Implicit Permissions for ", name, ": ", myRes) 175 | 176 | if !util.Array2DEquals(res, myRes) { 177 | t.Error("Implicit Permissions for ", name, ": ", myRes, ", supposed to be ", res) 178 | } 179 | } 180 | 181 | func testHasPermission(t *testing.T, e *testEngine, name string, permission []string, res bool) { 182 | t.Helper() 183 | reply, err := e.s.HasPermissionForUser(e.ctx, &pb.PermissionRequest{EnforcerHandler: e.h, User: name, Permissions: permission}) 184 | assert.NoError(t, err) 185 | 186 | t.Log(name, " has permission ", util.ArrayToString(permission), ": ", reply.Res) 187 | 188 | if res != reply.Res { 189 | t.Error(name, " has permission ", util.ArrayToString(permission), ": ", reply.Res, ", supposed to be ", res) 190 | } 191 | } 192 | 193 | func TestPermissionAPI(t *testing.T) { 194 | e := newTestEngine(t, "file", "../examples/basic_without_resources_policy.csv", 195 | "../examples/basic_without_resources_model.conf") 196 | 197 | testEnforceWithoutUsers(t, e, "alice", "read", true) 198 | testEnforceWithoutUsers(t, e, "alice", "write", false) 199 | testEnforceWithoutUsers(t, e, "bob", "read", false) 200 | testEnforceWithoutUsers(t, e, "bob", "write", true) 201 | 202 | testGetPermissions(t, e, "alice", [][]string{{"alice", "read"}}) 203 | testGetPermissions(t, e, "bob", [][]string{{"bob", "write"}}) 204 | 205 | testHasPermission(t, e, "alice", []string{"read"}, true) 206 | testHasPermission(t, e, "alice", []string{"write"}, false) 207 | testHasPermission(t, e, "bob", []string{"read"}, false) 208 | testHasPermission(t, e, "bob", []string{"write"}, true) 209 | 210 | _, err := e.s.DeletePermission(e.ctx, &pb.PermissionRequest{EnforcerHandler: e.h, Permissions: []string{"read"}}) 211 | assert.NoError(t, err) 212 | 213 | testEnforceWithoutUsers(t, e, "alice", "read", false) 214 | testEnforceWithoutUsers(t, e, "alice", "write", false) 215 | testEnforceWithoutUsers(t, e, "bob", "read", false) 216 | testEnforceWithoutUsers(t, e, "bob", "write", true) 217 | 218 | _, err = e.s.AddPermissionForUser(e.ctx, &pb.PermissionRequest{EnforcerHandler: e.h, User: "bob", Permissions: []string{"read"}}) 219 | assert.NoError(t, err) 220 | 221 | testEnforceWithoutUsers(t, e, "alice", "read", false) 222 | testEnforceWithoutUsers(t, e, "alice", "write", false) 223 | testEnforceWithoutUsers(t, e, "bob", "read", true) 224 | testEnforceWithoutUsers(t, e, "bob", "write", true) 225 | 226 | _, err = e.s.DeletePermissionForUser(e.ctx, &pb.PermissionRequest{EnforcerHandler: e.h, User: "bob", Permissions: []string{"read"}}) 227 | assert.NoError(t, err) 228 | 229 | testEnforceWithoutUsers(t, e, "alice", "read", false) 230 | testEnforceWithoutUsers(t, e, "alice", "write", false) 231 | testEnforceWithoutUsers(t, e, "bob", "read", false) 232 | testEnforceWithoutUsers(t, e, "bob", "write", true) 233 | 234 | _, err = e.s.DeletePermissionsForUser(e.ctx, &pb.PermissionRequest{EnforcerHandler: e.h, User: "bob"}) 235 | assert.NoError(t, err) 236 | 237 | testEnforceWithoutUsers(t, e, "alice", "read", false) 238 | testEnforceWithoutUsers(t, e, "alice", "write", false) 239 | testEnforceWithoutUsers(t, e, "bob", "read", false) 240 | testEnforceWithoutUsers(t, e, "bob", "write", false) 241 | } 242 | 243 | func testGetDomains(t *testing.T, e *testEngine, name string, res []string) { 244 | t.Helper() 245 | reply, err := e.s.GetDomains(e.ctx, &pb.UserRoleRequest{EnforcerHandler: e.h, User: name}) 246 | assert.NoError(t, err) 247 | 248 | t.Log("Domains for ", name, ": ", reply.Array) 249 | 250 | if !util.SetEquals(res, reply.Array) { 251 | t.Error("Domains for ", name, ": ", reply.Array, ", supposed to be ", res) 252 | } 253 | } 254 | 255 | func TestRoleDomainAPI(t *testing.T) { 256 | e := newTestEngine(t, "file", "../examples/rbac_with_domains_policy.csv", "../examples/rbac_with_domains_model.conf") 257 | 258 | testGetDomains(t, e, "alice", []string{"domain1"}) 259 | testGetDomains(t, e, "bob", []string{"domain2"}) 260 | } 261 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /server/management_api_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package server 16 | 17 | import ( 18 | "testing" 19 | 20 | pb "github.com/casbin/casbin-server/proto" 21 | "github.com/casbin/casbin/v2/util" 22 | "github.com/stretchr/testify/assert" 23 | ) 24 | 25 | func testStringList(t *testing.T, title string, f func() []string, res []string) { 26 | t.Helper() 27 | myRes := f() 28 | t.Log(title+": ", myRes) 29 | 30 | if !util.ArrayEquals(res, myRes) { 31 | t.Error(title+": ", myRes, ", supposed to be ", res) 32 | } 33 | } 34 | 35 | func extractFromArrayReply(reply *pb.ArrayReply) func() []string { 36 | return func() []string { 37 | return reply.Array 38 | } 39 | } 40 | 41 | func TestGetList(t *testing.T) { 42 | e := newTestEngine(t, "file", "../examples/rbac_policy.csv", "../examples/rbac_model.conf") 43 | 44 | subjects, err := e.s.GetAllSubjects(e.ctx, &pb.EmptyRequest{Handler: e.h}) 45 | if err != nil { 46 | t.Fatal(err) 47 | } 48 | testStringList(t, "Subjects", extractFromArrayReply(subjects), []string{"alice", "bob", "data2_admin", "data3_admin", "data4_admin"}) 49 | 50 | objects, err := e.s.GetAllObjects(e.ctx, &pb.EmptyRequest{Handler: e.h}) 51 | if err != nil { 52 | t.Fatal(err) 53 | } 54 | testStringList(t, "Objects", extractFromArrayReply(objects), []string{"data1", "data2", "data3", "data4"}) 55 | 56 | actions, err := e.s.GetAllActions(e.ctx, &pb.EmptyRequest{Handler: e.h}) 57 | if err != nil { 58 | t.Fatal(err) 59 | } 60 | testStringList(t, "Actions", extractFromArrayReply(actions), []string{"read", "write", "admin"}) 61 | 62 | roles, err := e.s.GetAllRoles(e.ctx, &pb.EmptyRequest{Handler: e.h}) 63 | if err != nil { 64 | t.Fatal(err) 65 | } 66 | testStringList(t, "Roles", extractFromArrayReply(roles), []string{"data2_admin", "data3_admin", "data4_admin"}) 67 | } 68 | 69 | func extractFromArray2DReply(reply *pb.Array2DReply) [][]string { 70 | array2d := make([][]string, len(reply.D2)) 71 | for i := 0; i < len(reply.D2); i++ { 72 | array2d[i] = reply.D2[i].D1 73 | } 74 | 75 | return array2d 76 | } 77 | 78 | func testGetPolicy(t *testing.T, e *testEngine, res [][]string) { 79 | t.Helper() 80 | req := &pb.EmptyRequest{Handler: e.h} 81 | reply, err := e.s.GetPolicy(e.ctx, req) 82 | assert.NoError(t, err) 83 | 84 | myRes := extractFromArray2DReply(reply) 85 | t.Log("Policy: ", myRes) 86 | 87 | if !util.Array2DEquals(res, myRes) { 88 | t.Error("Policy: ", myRes, ", supposed to be ", res) 89 | } 90 | } 91 | 92 | func testGetFilteredPolicy(t *testing.T, e *testEngine, fieldIndex int, res [][]string, fieldValues ...string) { 93 | t.Helper() 94 | req := &pb.FilteredPolicyRequest{ 95 | EnforcerHandler: e.h, FieldIndex: int32(fieldIndex), FieldValues: fieldValues} 96 | reply, err := e.s.GetFilteredPolicy(e.ctx, req) 97 | assert.NoError(t, err) 98 | 99 | myRes := extractFromArray2DReply(reply) 100 | t.Log("Policy for ", util.ParamsToString(req.FieldValues...), ": ", myRes) 101 | 102 | if !util.Array2DEquals(res, myRes) { 103 | t.Error("Policy for ", util.ParamsToString(req.FieldValues...), ": ", myRes, ", supposed to be ", res) 104 | } 105 | } 106 | 107 | func testGetGroupingPolicy(t *testing.T, e *testEngine, res [][]string) { 108 | t.Helper() 109 | req := &pb.EmptyRequest{Handler: e.h} 110 | reply, err := e.s.GetGroupingPolicy(e.ctx, req) 111 | assert.NoError(t, err) 112 | 113 | myRes := extractFromArray2DReply(reply) 114 | t.Log("Grouping policy: ", myRes) 115 | 116 | if !util.Array2DEquals(res, myRes) { 117 | t.Error("Grouping policy: ", myRes, ", supposed to be ", res) 118 | } 119 | } 120 | 121 | func testGetFilteredGroupingPolicy(t *testing.T, e *testEngine, fieldIndex int, res [][]string, fieldValues ...string) { 122 | t.Helper() 123 | req := &pb.FilteredPolicyRequest{ 124 | EnforcerHandler: e.h, FieldIndex: int32(fieldIndex), FieldValues: fieldValues} 125 | reply, err := e.s.GetFilteredGroupingPolicy(e.ctx, req) 126 | assert.NoError(t, err) 127 | 128 | myRes := extractFromArray2DReply(reply) 129 | t.Log("Grouping policy for ", util.ParamsToString(fieldValues...), ": ", myRes) 130 | 131 | if !util.Array2DEquals(res, myRes) { 132 | t.Error("Grouping policy for ", util.ParamsToString(fieldValues...), ": ", myRes, ", supposed to be ", res) 133 | } 134 | } 135 | 136 | func testHasPolicy(t *testing.T, e *testEngine, policy []string, res bool) { 137 | t.Helper() 138 | req := &pb.PolicyRequest{EnforcerHandler: e.h, PType: "p", Params: policy} 139 | reply, err := e.s.HasPolicy(e.ctx, req) 140 | assert.NoError(t, err) 141 | 142 | myRes := reply.Res 143 | t.Log("Has policy ", util.ArrayToString(policy), ": ", myRes) 144 | 145 | if res != myRes { 146 | t.Error("Has policy ", util.ArrayToString(policy), ": ", myRes, ", supposed to be ", res) 147 | } 148 | } 149 | 150 | func testHasGroupingPolicy(t *testing.T, e *testEngine, policy []string, res bool) { 151 | t.Helper() 152 | req := &pb.PolicyRequest{EnforcerHandler: e.h, PType: "g", Params: policy} 153 | reply, err := e.s.HasNamedGroupingPolicy(e.ctx, req) 154 | assert.NoError(t, err) 155 | 156 | myRes := reply.Res 157 | t.Log("Has grouping policy ", util.ArrayToString(policy), ": ", myRes) 158 | 159 | if res != myRes { 160 | t.Error("Has grouping policy ", util.ArrayToString(policy), ": ", myRes, ", supposed to be ", res) 161 | } 162 | } 163 | 164 | func TestGetPolicyAPI(t *testing.T) { 165 | e := newTestEngine(t, "file", "../examples/rbac_policy.csv", "../examples/rbac_model.conf") 166 | 167 | testGetPolicy(t, e, [][]string{ 168 | {"alice", "data1", "read"}, 169 | {"bob", "data2", "write"}, 170 | {"data2_admin", "data2", "read"}, 171 | {"data2_admin", "data2", "write"}, 172 | {"data3_admin", "data3", "admin"}, 173 | {"data4_admin", "data4", "read"}}) 174 | 175 | testGetFilteredPolicy(t, e, 0, [][]string{{"alice", "data1", "read"}}, "alice") 176 | testGetFilteredPolicy(t, e, 0, [][]string{{"bob", "data2", "write"}}, "bob") 177 | testGetFilteredPolicy(t, e, 0, [][]string{{"data2_admin", "data2", "read"}, 178 | {"data2_admin", "data2", "write"}}, "data2_admin") 179 | testGetFilteredPolicy(t, e, 1, [][]string{{"alice", "data1", "read"}}, "data1") 180 | testGetFilteredPolicy(t, e, 1, [][]string{{"bob", "data2", "write"}, {"data2_admin", "data2", "read"}, 181 | {"data2_admin", "data2", "write"}}, "data2") 182 | testGetFilteredPolicy(t, e, 2, [][]string{{"alice", "data1", "read"}, {"data2_admin", "data2", "read"},{"data4_admin", "data4", "read"}}, "read") 183 | testGetFilteredPolicy(t, e, 2, [][]string{{"bob", "data2", "write"}, {"data2_admin", "data2", "write"}}, "write") 184 | 185 | testGetFilteredPolicy(t, e, 0, [][]string{{"data2_admin", "data2", "read"}, 186 | {"data2_admin", "data2", "write"}}, "data2_admin", "data2") 187 | // Note: "" (empty string) in fieldValues means matching all values. 188 | testGetFilteredPolicy(t, e, 0, [][]string{{"data2_admin", "data2", "read"}}, "data2_admin", "", "read") 189 | testGetFilteredPolicy(t, e, 1, [][]string{{"bob", "data2", "write"}, 190 | {"data2_admin", "data2", "write"}}, "data2", "write") 191 | 192 | testHasPolicy(t, e, []string{"alice", "data1", "read"}, true) 193 | testHasPolicy(t, e, []string{"bob", "data2", "write"}, true) 194 | testHasPolicy(t, e, []string{"alice", "data2", "read"}, false) 195 | testHasPolicy(t, e, []string{"bob", "data3", "write"}, false) 196 | 197 | testGetGroupingPolicy(t, e, [][]string{{"alice", "data2_admin"},{"george", "data3_admin"},{"data3_admin", "data4_admin"}}) 198 | 199 | testGetFilteredGroupingPolicy(t, e, 0, [][]string{{"alice", "data2_admin"}}, "alice") 200 | testGetFilteredGroupingPolicy(t, e, 0, [][]string{}, "bob") 201 | testGetFilteredGroupingPolicy(t, e, 1, [][]string{}, "data1_admin") 202 | testGetFilteredGroupingPolicy(t, e, 1, [][]string{{"alice", "data2_admin"}}, "data2_admin") 203 | // Note: "" (empty string) in fieldValues means matching all values. 204 | testGetFilteredGroupingPolicy(t, e, 0, [][]string{{"alice", "data2_admin"}}, "", "data2_admin") 205 | 206 | testHasGroupingPolicy(t, e, []string{"alice", "data2_admin"}, true) 207 | testHasGroupingPolicy(t, e, []string{"bob", "data2_admin"}, false) 208 | } 209 | 210 | func TestModifyPolicyAPI(t *testing.T) { 211 | e := newTestEngine(t, "file", "../examples/rbac_policy.csv", "../examples/rbac_model.conf") 212 | 213 | testGetPolicy(t, e, [][]string{ 214 | {"alice", "data1", "read"}, 215 | {"bob", "data2", "write"}, 216 | {"data2_admin", "data2", "read"}, 217 | {"data2_admin", "data2", "write"}, 218 | {"data3_admin", "data3", "admin"}, 219 | {"data4_admin", "data4", "read"}}) 220 | 221 | _, err := e.s.RemovePolicy(e.ctx, &pb.PolicyRequest{EnforcerHandler: e.h, Params: []string{"alice", "data1", "read"}}) 222 | assert.NoError(t, err) 223 | _, err = e.s.RemovePolicy(e.ctx, &pb.PolicyRequest{EnforcerHandler: e.h, Params: []string{"bob", "data2", "write"}}) 224 | assert.NoError(t, err) 225 | _, err = e.s.RemovePolicy(e.ctx, &pb.PolicyRequest{EnforcerHandler: e.h, Params: []string{"alice", "data1", "read"}}) 226 | assert.NoError(t, err) 227 | 228 | _, err = e.s.AddPolicy(e.ctx, &pb.PolicyRequest{EnforcerHandler: e.h, Params: []string{"eve", "data3", "read"}}) 229 | assert.NoError(t, err) 230 | _, err = e.s.AddPolicy(e.ctx, &pb.PolicyRequest{EnforcerHandler: e.h, Params: []string{"eve", "data3", "read"}}) 231 | assert.NoError(t, err) 232 | 233 | namedPolicy := []string{"eve", "data3", "read"} 234 | _, err = e.s.RemovePolicy(e.ctx, &pb.PolicyRequest{EnforcerHandler: e.h, PType: "p", Params: namedPolicy}) 235 | assert.NoError(t, err) 236 | _, err = e.s.AddNamedPolicy(e.ctx, &pb.PolicyRequest{EnforcerHandler: e.h, PType: "p", Params: namedPolicy}) 237 | assert.NoError(t, err) 238 | 239 | testGetPolicy(t, e, [][]string{ 240 | {"data2_admin", "data2", "read"}, 241 | {"data2_admin", "data2", "write"}, 242 | {"data3_admin", "data3", "admin"}, 243 | {"data4_admin", "data4", "read"}, 244 | {"eve", "data3", "read"}}) 245 | 246 | _, err = e.s.RemoveFilteredPolicy(e.ctx, &pb.FilteredPolicyRequest{EnforcerHandler: e.h, FieldIndex: 1, FieldValues: []string{"data2"}}) 247 | assert.NoError(t, err) 248 | 249 | _, err = e.s.RemoveFilteredPolicy(e.ctx, &pb.FilteredPolicyRequest{EnforcerHandler: e.h, FieldIndex: 1, FieldValues: []string{"data4"}}) 250 | assert.NoError(t, err) 251 | 252 | testGetPolicy(t, e, [][]string{{"data3_admin", "data3", "admin"},{"eve", "data3", "read"}}) 253 | } 254 | 255 | func TestModifyGroupingPolicyAPI(t *testing.T) { 256 | e := newTestEngine(t, "file", "../examples/rbac_policy.csv", "../examples/rbac_model.conf") 257 | 258 | testGetRoles(t, e, "alice", []string{"data2_admin"}) 259 | testGetRoles(t, e, "bob", []string{}) 260 | testGetRoles(t, e, "eve", []string{}) 261 | testGetRoles(t, e, "non_exist", []string{}) 262 | 263 | _, err := e.s.RemoveGroupingPolicy(e.ctx, 264 | &pb.PolicyRequest{EnforcerHandler: e.h, Params: []string{"alice", "data2_admin"}}) 265 | assert.NoError(t, err) 266 | 267 | _, err = e.s.AddGroupingPolicy(e.ctx, &pb.PolicyRequest{EnforcerHandler: e.h, Params: []string{"bob", "data1_admin"}}) 268 | assert.NoError(t, err) 269 | 270 | _, err = e.s.AddGroupingPolicy(e.ctx, &pb.PolicyRequest{EnforcerHandler: e.h, Params: []string{"eve", "data3_admin"}}) 271 | assert.NoError(t, err) 272 | 273 | namedGroupingPolicy := []string{"alice", "data2_admin"} 274 | testGetRoles(t, e, "alice", []string{}) 275 | 276 | _, err = e.s.AddNamedGroupingPolicy(e.ctx, 277 | &pb.PolicyRequest{EnforcerHandler: e.h, PType: "g", Params: namedGroupingPolicy}) 278 | assert.NoError(t, err) 279 | 280 | testGetRoles(t, e, "alice", []string{"data2_admin"}) 281 | 282 | _, err = e.s.RemoveNamedGroupingPolicy(e.ctx, 283 | &pb.PolicyRequest{EnforcerHandler: e.h, PType: "g", Params: namedGroupingPolicy}) 284 | assert.NoError(t, err) 285 | 286 | testGetRoles(t, e, "alice", []string{}) 287 | testGetRoles(t, e, "bob", []string{"data1_admin"}) 288 | testGetRoles(t, e, "eve", []string{"data3_admin"}) 289 | testGetRoles(t, e, "non_exist", []string{}) 290 | 291 | testGetUsers(t, e, "data1_admin", []string{"bob"}) 292 | testGetUsers(t, e, "data2_admin", []string{}) 293 | testGetUsers(t, e, "data3_admin", []string{"eve", "george"}) 294 | testGetUsers(t, e, "data4_admin", []string{"data3_admin"}) 295 | 296 | _, err = e.s.RemoveFilteredGroupingPolicy(e.ctx, 297 | &pb.FilteredPolicyRequest{EnforcerHandler: e.h, FieldIndex: 0, FieldValues: []string{"bob"}}) 298 | assert.NoError(t, err) 299 | 300 | testGetRoles(t, e, "alice", []string{}) 301 | testGetRoles(t, e, "bob", []string{}) 302 | testGetRoles(t, e, "eve", []string{"data3_admin"}) 303 | testGetRoles(t, e, "non_exist", []string{}) 304 | 305 | testGetUsers(t, e, "data1_admin", []string{}) 306 | testGetUsers(t, e, "data2_admin", []string{}) 307 | testGetUsers(t, e, "data3_admin", []string{"george","eve"}) 308 | } 309 | -------------------------------------------------------------------------------- /server/management_api.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package server 16 | 17 | import ( 18 | "context" 19 | 20 | pb "github.com/casbin/casbin-server/proto" 21 | ) 22 | 23 | func (s *Server) wrapPlainPolicy(policy [][]string) *pb.Array2DReply { 24 | if len(policy) == 0 { 25 | return &pb.Array2DReply{} 26 | } 27 | 28 | policyReply := &pb.Array2DReply{} 29 | policyReply.D2 = make([]*pb.Array2DReplyD, len(policy)) 30 | for e := range policy { 31 | policyReply.D2[e] = &pb.Array2DReplyD{D1: policy[e]} 32 | } 33 | 34 | return policyReply 35 | } 36 | 37 | // GetAllSubjects gets the list of subjects that show up in the current policy. 38 | func (s *Server) GetAllSubjects(ctx context.Context, in *pb.EmptyRequest) (*pb.ArrayReply, error) { 39 | return s.GetAllNamedSubjects(ctx, &pb.SimpleGetRequest{EnforcerHandler: in.Handler, PType: "p"}) 40 | } 41 | 42 | // GetAllNamedSubjects gets the list of subjects that show up in the current named policy. 43 | func (s *Server) GetAllNamedSubjects(ctx context.Context, in *pb.SimpleGetRequest) (*pb.ArrayReply, error) { 44 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 45 | if err != nil { 46 | return &pb.ArrayReply{}, err 47 | } 48 | 49 | valuesForFieldInPolicy, err := e.GetModel().GetValuesForFieldInPolicy("p", in.PType, 0) 50 | if err != nil { 51 | return &pb.ArrayReply{}, err 52 | } 53 | 54 | return &pb.ArrayReply{Array: valuesForFieldInPolicy}, nil 55 | } 56 | 57 | // GetAllObjects gets the list of objects that show up in the current policy. 58 | func (s *Server) GetAllObjects(ctx context.Context, in *pb.EmptyRequest) (*pb.ArrayReply, error) { 59 | return s.GetAllNamedObjects(ctx, &pb.SimpleGetRequest{EnforcerHandler: in.Handler, PType: "p"}) 60 | } 61 | 62 | // GetAllNamedObjects gets the list of objects that show up in the current named policy. 63 | func (s *Server) GetAllNamedObjects(ctx context.Context, in *pb.SimpleGetRequest) (*pb.ArrayReply, error) { 64 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 65 | if err != nil { 66 | return &pb.ArrayReply{}, err 67 | } 68 | 69 | valuesForFieldInPolicy, err := e.GetModel().GetValuesForFieldInPolicy("p", in.PType, 1) 70 | if err != nil { 71 | return &pb.ArrayReply{}, err 72 | } 73 | 74 | return &pb.ArrayReply{Array: valuesForFieldInPolicy}, nil 75 | } 76 | 77 | // GetAllActions gets the list of actions that show up in the current policy. 78 | func (s *Server) GetAllActions(ctx context.Context, in *pb.EmptyRequest) (*pb.ArrayReply, error) { 79 | return s.GetAllNamedActions(ctx, &pb.SimpleGetRequest{EnforcerHandler: in.Handler, PType: "p"}) 80 | } 81 | 82 | // GetAllNamedActions gets the list of actions that show up in the current named policy. 83 | func (s *Server) GetAllNamedActions(ctx context.Context, in *pb.SimpleGetRequest) (*pb.ArrayReply, error) { 84 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 85 | if err != nil { 86 | return &pb.ArrayReply{}, err 87 | } 88 | 89 | valuesForFieldInPolicy, err := e.GetModel().GetValuesForFieldInPolicy("p", in.PType, 2) 90 | if err != nil { 91 | return &pb.ArrayReply{}, err 92 | } 93 | 94 | return &pb.ArrayReply{Array: valuesForFieldInPolicy}, nil 95 | } 96 | 97 | // GetAllRoles gets the list of roles that show up in the current policy. 98 | func (s *Server) GetAllRoles(ctx context.Context, in *pb.EmptyRequest) (*pb.ArrayReply, error) { 99 | return s.GetAllNamedRoles(ctx, &pb.SimpleGetRequest{EnforcerHandler: in.Handler, PType: "g"}) 100 | } 101 | 102 | // GetAllNamedRoles gets the list of roles that show up in the current named policy. 103 | func (s *Server) GetAllNamedRoles(ctx context.Context, in *pb.SimpleGetRequest) (*pb.ArrayReply, error) { 104 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 105 | if err != nil { 106 | return &pb.ArrayReply{}, err 107 | } 108 | 109 | valuesForFieldInPolicy, err := e.GetModel().GetValuesForFieldInPolicy("g", in.PType, 1) 110 | if err != nil { 111 | return &pb.ArrayReply{}, err 112 | } 113 | 114 | return &pb.ArrayReply{Array: valuesForFieldInPolicy}, nil 115 | } 116 | 117 | // GetPolicy gets all the authorization rules in the policy. 118 | func (s *Server) GetPolicy(ctx context.Context, in *pb.EmptyRequest) (*pb.Array2DReply, error) { 119 | return s.GetNamedPolicy(ctx, &pb.PolicyRequest{EnforcerHandler: in.Handler, PType: "p"}) 120 | } 121 | 122 | // GetNamedPolicy gets all the authorization rules in the named policy. 123 | func (s *Server) GetNamedPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.Array2DReply, error) { 124 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 125 | if err != nil { 126 | return &pb.Array2DReply{}, err 127 | } 128 | 129 | policy, err := e.GetModel().GetPolicy("p", in.PType) 130 | if err != nil { 131 | return &pb.Array2DReply{}, err 132 | } 133 | 134 | return s.wrapPlainPolicy(policy), nil 135 | } 136 | 137 | // GetFilteredPolicy gets all the authorization rules in the policy, field filters can be specified. 138 | func (s *Server) GetFilteredPolicy(ctx context.Context, in *pb.FilteredPolicyRequest) (*pb.Array2DReply, error) { 139 | in.PType = "p" 140 | 141 | return s.GetFilteredNamedPolicy(ctx, in) 142 | } 143 | 144 | // GetFilteredNamedPolicy gets all the authorization rules in the named policy, field filters can be specified. 145 | func (s *Server) GetFilteredNamedPolicy(ctx context.Context, in *pb.FilteredPolicyRequest) (*pb.Array2DReply, error) { 146 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 147 | if err != nil { 148 | return &pb.Array2DReply{}, err 149 | } 150 | 151 | filteredPolicy, err := e.GetModel().GetFilteredPolicy("p", in.PType, int(in.FieldIndex), in.FieldValues...) 152 | if err != nil { 153 | return &pb.Array2DReply{}, err 154 | } 155 | 156 | return s.wrapPlainPolicy(filteredPolicy), nil 157 | } 158 | 159 | // GetGroupingPolicy gets all the role inheritance rules in the policy. 160 | func (s *Server) GetGroupingPolicy(ctx context.Context, in *pb.EmptyRequest) (*pb.Array2DReply, error) { 161 | return s.GetNamedGroupingPolicy(ctx, &pb.PolicyRequest{EnforcerHandler: in.Handler, PType: "g"}) 162 | } 163 | 164 | // GetNamedGroupingPolicy gets all the role inheritance rules in the policy. 165 | func (s *Server) GetNamedGroupingPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.Array2DReply, error) { 166 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 167 | if err != nil { 168 | return &pb.Array2DReply{}, err 169 | } 170 | 171 | policy, err := e.GetModel().GetPolicy("g", in.PType) 172 | if err != nil { 173 | return &pb.Array2DReply{}, err 174 | } 175 | 176 | return s.wrapPlainPolicy(policy), nil 177 | } 178 | 179 | // GetFilteredGroupingPolicy gets all the role inheritance rules in the policy, field filters can be specified. 180 | func (s *Server) GetFilteredGroupingPolicy(ctx context.Context, in *pb.FilteredPolicyRequest) (*pb.Array2DReply, error) { 181 | in.PType = "g" 182 | 183 | return s.GetFilteredNamedGroupingPolicy(ctx, in) 184 | } 185 | 186 | // GetFilteredNamedGroupingPolicy gets all the role inheritance rules in the policy, field filters can be specified. 187 | func (s *Server) GetFilteredNamedGroupingPolicy(ctx context.Context, in *pb.FilteredPolicyRequest) (*pb.Array2DReply, error) { 188 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 189 | if err != nil { 190 | return &pb.Array2DReply{}, err 191 | } 192 | 193 | filteredPolicy, err := e.GetModel().GetFilteredPolicy("g", in.PType, int(in.FieldIndex), in.FieldValues...) 194 | if err != nil { 195 | return &pb.Array2DReply{}, err 196 | } 197 | 198 | return s.wrapPlainPolicy(filteredPolicy), nil 199 | } 200 | 201 | // HasPolicy determines whether an authorization rule exists. 202 | func (s *Server) HasPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 203 | return s.HasNamedPolicy(ctx, in) 204 | } 205 | 206 | // HasNamedPolicy determines whether a named authorization rule exists. 207 | func (s *Server) HasNamedPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 208 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 209 | if err != nil { 210 | return &pb.BoolReply{}, err 211 | } 212 | 213 | hasPolicy, err := e.GetModel().HasPolicy("p", in.PType, in.Params) 214 | if err != nil { 215 | return &pb.BoolReply{}, err 216 | } 217 | 218 | return &pb.BoolReply{Res: hasPolicy}, nil 219 | } 220 | 221 | // HasGroupingPolicy determines whether a role inheritance rule exists. 222 | func (s *Server) HasGroupingPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 223 | in.PType = "g" 224 | return s.HasNamedGroupingPolicy(ctx, in) 225 | } 226 | 227 | // HasNamedGroupingPolicy determines whether a named role inheritance rule exists. 228 | func (s *Server) HasNamedGroupingPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 229 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 230 | if err != nil { 231 | return &pb.BoolReply{}, err 232 | } 233 | 234 | haPolicy, err := e.GetModel().HasPolicy("g", in.PType, in.Params) 235 | if err != nil { 236 | return &pb.BoolReply{}, err 237 | } 238 | 239 | return &pb.BoolReply{Res: haPolicy}, nil 240 | } 241 | 242 | func (s *Server) AddPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 243 | in.PType = "p" 244 | return s.AddNamedPolicy(ctx, in) 245 | } 246 | 247 | func (s *Server) AddNamedPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 248 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 249 | if err != nil { 250 | return &pb.BoolReply{}, err 251 | } 252 | 253 | ruleAdded, err := e.AddNamedPolicy(in.PType, in.Params) 254 | return &pb.BoolReply{Res: ruleAdded}, err 255 | } 256 | 257 | func (s *Server) RemovePolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 258 | in.PType = "p" 259 | return s.RemoveNamedPolicy(ctx, in) 260 | } 261 | 262 | func (s *Server) RemoveNamedPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 263 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 264 | if err != nil { 265 | return &pb.BoolReply{}, err 266 | } 267 | 268 | ruleRemoved, err := e.RemoveNamedPolicy(in.PType, in.Params) 269 | return &pb.BoolReply{Res: ruleRemoved}, err 270 | } 271 | 272 | // RemoveFilteredPolicy removes an authorization rule from the current policy, field filters can be specified. 273 | func (s *Server) RemoveFilteredPolicy(ctx context.Context, in *pb.FilteredPolicyRequest) (*pb.BoolReply, error) { 274 | in.PType = "p" 275 | return s.RemoveFilteredNamedPolicy(ctx, in) 276 | } 277 | 278 | // RemoveFilteredNamedPolicy removes an authorization rule from the current named policy, field filters can be specified. 279 | func (s *Server) RemoveFilteredNamedPolicy(ctx context.Context, in *pb.FilteredPolicyRequest) (*pb.BoolReply, error) { 280 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 281 | if err != nil { 282 | return &pb.BoolReply{}, err 283 | } 284 | 285 | ruleRemoved, err := e.RemoveFilteredNamedPolicy(in.PType, int(in.FieldIndex), in.FieldValues...) 286 | return &pb.BoolReply{Res: ruleRemoved}, err 287 | } 288 | 289 | // AddGroupingPolicy adds a role inheritance rule to the current policy. 290 | // If the rule already exists, the function returns false and the rule will not be added. 291 | // Otherwise the function returns true by adding the new rule. 292 | func (s *Server) AddGroupingPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 293 | in.PType = "g" 294 | return s.AddNamedGroupingPolicy(ctx, in) 295 | } 296 | 297 | // AddNamedGroupingPolicy adds a named role inheritance rule to the current policy. 298 | // If the rule already exists, the function returns false and the rule will not be added. 299 | // Otherwise the function returns true by adding the new rule. 300 | func (s *Server) AddNamedGroupingPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 301 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 302 | if err != nil { 303 | return &pb.BoolReply{}, err 304 | } 305 | 306 | ruleAdded, err := e.AddNamedGroupingPolicy(in.PType, in.Params) 307 | return &pb.BoolReply{Res: ruleAdded}, err 308 | } 309 | 310 | // RemoveGroupingPolicy removes a role inheritance rule from the current policy. 311 | func (s *Server) RemoveGroupingPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 312 | in.PType = "g" 313 | return s.RemoveNamedGroupingPolicy(ctx, in) 314 | } 315 | 316 | // RemoveNamedGroupingPolicy removes a role inheritance rule from the current named policy. 317 | func (s *Server) RemoveNamedGroupingPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error) { 318 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 319 | if err != nil { 320 | return &pb.BoolReply{}, err 321 | } 322 | 323 | ruleRemoved, err := e.RemoveNamedGroupingPolicy(in.PType, in.Params) 324 | return &pb.BoolReply{Res: ruleRemoved}, err 325 | } 326 | 327 | // RemoveFilteredGroupingPolicy removes a role inheritance rule from the current policy, field filters can be specified. 328 | func (s *Server) RemoveFilteredGroupingPolicy(ctx context.Context, in *pb.FilteredPolicyRequest) (*pb.BoolReply, error) { 329 | in.PType = "g" 330 | return s.RemoveFilteredNamedGroupingPolicy(ctx, in) 331 | } 332 | 333 | // RemoveFilteredNamedGroupingPolicy removes a role inheritance rule from the current named policy, field filters can be specified. 334 | func (s *Server) RemoveFilteredNamedGroupingPolicy(ctx context.Context, in *pb.FilteredPolicyRequest) (*pb.BoolReply, error) { 335 | e, err := s.getEnforcer(int(in.EnforcerHandler)) 336 | if err != nil { 337 | return &pb.BoolReply{}, err 338 | } 339 | 340 | ruleRemoved, err := e.RemoveFilteredNamedGroupingPolicy(in.PType, int(in.FieldIndex), in.FieldValues...) 341 | return &pb.BoolReply{Res: ruleRemoved}, err 342 | } 343 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 3 | github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= 4 | github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= 5 | github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= 6 | github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 7 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 8 | github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= 9 | github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= 10 | github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= 11 | github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI= 12 | github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM= 13 | github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= 14 | github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= 15 | github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= 16 | github.com/casbin/casbin/v2 v2.55.1/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= 17 | github.com/casbin/casbin/v2 v2.60.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= 18 | github.com/casbin/casbin/v2 v2.100.0 h1:aeugSNjjHfCrgA22nHkVvw2xsscboHv5r0a13ljQKGQ= 19 | github.com/casbin/casbin/v2 v2.100.0/go.mod h1:LO7YPez4dX3LgoTCqSQAleQDo0S0BeZBDxYnPUl95Ng= 20 | github.com/casbin/gorm-adapter/v3 v3.14.0 h1:zZ6AIiNHJZ3ntdf5RBrqD+0Cb4UO+uKFk79R9yJ7mpw= 21 | github.com/casbin/gorm-adapter/v3 v3.14.0/go.mod h1:jqaf4bUITbCyMPUellaTd8IQJ77JfVAbe77gZZnx98w= 22 | github.com/casbin/govaluate v1.2.0 h1:wXCXFmqyY+1RwiKfYo3jMKyrtZmOL3kHwaqDyCPOYak= 23 | github.com/casbin/govaluate v1.2.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A= 24 | github.com/casbin/mongodb-adapter/v3 v3.7.0 h1:w9c3bea1BGK4eZTAmk17JkY52yv/xSZDSHKji8q+z6E= 25 | github.com/casbin/mongodb-adapter/v3 v3.7.0/go.mod h1:F1mu4ojoJVE/8VhIMxMedhjfwRDdIXgANYs6Sd0MgVA= 26 | github.com/casbin/redis-adapter/v3 v3.6.0 h1:JY9eUJeF428e87s1HvNZxrgUHLGFcJqNiDg5JUftkas= 27 | github.com/casbin/redis-adapter/v3 v3.6.0/go.mod h1:SGL+D0Gx7dQIR8frcnZeq8E0pT2WYuJ05gcEH4c2elY= 28 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 29 | github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 30 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 31 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= 32 | github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= 33 | github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= 34 | github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 35 | github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 36 | github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 37 | github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= 38 | github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= 39 | github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= 40 | github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= 41 | github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= 42 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 43 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 44 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 45 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 46 | github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= 47 | github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= 48 | github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= 49 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 50 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 51 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= 52 | github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= 53 | github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= 54 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 55 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 56 | github.com/glebarez/go-sqlite v1.19.1 h1:o2XhjyR8CQ2m84+bVz10G0cabmG0tY4sIMiCbrcUTrY= 57 | github.com/glebarez/go-sqlite v1.19.1/go.mod h1:9AykawGIyIcxoSfpYWiX1SgTNHTNsa/FVc75cDkbp4M= 58 | github.com/glebarez/sqlite v1.5.0 h1:+8LAEpmywqresSoGlqjjT+I9m4PseIM3NcerIJ/V7mk= 59 | github.com/glebarez/sqlite v1.5.0/go.mod h1:0wzXzTvfVJIN2GqRhCdMbnYd+m+aH5/QV7B30rM6NgY= 60 | github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= 61 | github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= 62 | github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= 63 | github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= 64 | github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= 65 | github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= 66 | github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= 67 | github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= 68 | github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= 69 | github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= 70 | github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= 71 | github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= 72 | github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= 73 | github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= 74 | github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= 75 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 76 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 77 | github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= 78 | github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= 79 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 80 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 81 | github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 82 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 83 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 84 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 85 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 86 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 87 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 88 | github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 89 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 90 | github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= 91 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 92 | github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= 93 | github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 94 | github.com/gomodule/redigo v1.8.9 h1:Sl3u+2BI/kk+VEatbj0scLdrFhjPmbxOc1myhDP41ws= 95 | github.com/gomodule/redigo v1.8.9/go.mod h1:7ArFNvsTjH8GMMzB4uy1snslv2BwmginuMs06a1uzZE= 96 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 97 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 98 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 99 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 100 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 101 | github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 102 | github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 103 | github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= 104 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 105 | github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 106 | github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 107 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 108 | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= 109 | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 110 | github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= 111 | github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= 112 | github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= 113 | github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= 114 | github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= 115 | github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= 116 | github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= 117 | github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= 118 | github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= 119 | github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= 120 | github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= 121 | github.com/jackc/pgconn v1.13.0 h1:3L1XMNV2Zvca/8BYhzcRFS70Lr0WlDg16Di6SFGAbys= 122 | github.com/jackc/pgconn v1.13.0/go.mod h1:AnowpAqO4CMIIJNZl2VJp+KrkAZciAkhEl0W0JIobpI= 123 | github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= 124 | github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= 125 | github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= 126 | github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= 127 | github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= 128 | github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= 129 | github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= 130 | github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= 131 | github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= 132 | github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= 133 | github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= 134 | github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= 135 | github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= 136 | github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= 137 | github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= 138 | github.com/jackc/pgproto3/v2 v2.3.1 h1:nwj7qwf0S+Q7ISFfBndqeLwSwxs+4DPsbRFjECT1Y4Y= 139 | github.com/jackc/pgproto3/v2 v2.3.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= 140 | github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= 141 | github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= 142 | github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= 143 | github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= 144 | github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= 145 | github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= 146 | github.com/jackc/pgtype v1.12.0 h1:Dlq8Qvcch7kiehm8wPGIW0W3KsCCHJnRacKW0UM8n5w= 147 | github.com/jackc/pgtype v1.12.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= 148 | github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= 149 | github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= 150 | github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= 151 | github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= 152 | github.com/jackc/pgx/v4 v4.17.2 h1:0Ut0rpeKwvIVbMQ1KbMBU4h6wxehBI535LK6Flheh8E= 153 | github.com/jackc/pgx/v4 v4.17.2/go.mod h1:lcxIZN44yMIrWI78a5CpucdD14hX0SBDbNRvjDBItsw= 154 | github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= 155 | github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= 156 | github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= 157 | github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= 158 | github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= 159 | github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= 160 | github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= 161 | github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= 162 | github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= 163 | github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= 164 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 165 | github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= 166 | github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= 167 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 168 | github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 169 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 170 | github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= 171 | github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= 172 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 173 | github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= 174 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 175 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 176 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 177 | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 178 | github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= 179 | github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= 180 | github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= 181 | github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= 182 | github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= 183 | github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= 184 | github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= 185 | github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 186 | github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 187 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= 188 | github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= 189 | github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 190 | github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= 191 | github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE= 192 | github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ= 193 | github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= 194 | github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= 195 | github.com/montanaflynn/stats v0.6.6 h1:Duep6KMIDpY4Yo11iFsvyqJDyfzLF9+sndUKT+v64GQ= 196 | github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= 197 | github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= 198 | github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 199 | github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= 200 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 201 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 202 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 203 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 204 | github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= 205 | github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= 206 | github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= 207 | github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 208 | github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= 209 | github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= 210 | github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= 211 | github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= 212 | github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= 213 | github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= 214 | github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= 215 | github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= 216 | github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 217 | github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= 218 | github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= 219 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 220 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 221 | github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= 222 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 223 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 224 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 225 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 226 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 227 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 228 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 229 | github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= 230 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 231 | github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= 232 | github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= 233 | github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= 234 | github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= 235 | github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= 236 | github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= 237 | github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= 238 | github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= 239 | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 240 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 241 | github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= 242 | github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= 243 | github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= 244 | go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE= 245 | go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0= 246 | go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= 247 | go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= 248 | go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= 249 | go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= 250 | go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= 251 | go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= 252 | go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= 253 | go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= 254 | go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= 255 | go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= 256 | go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= 257 | go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= 258 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 259 | golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= 260 | golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 261 | golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 262 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 263 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 264 | golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= 265 | golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 266 | golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 267 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 268 | golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 269 | golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 270 | golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 271 | golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b h1:huxqepDufQpLLIRXiVkTvnxrzJlpwmIWAObmcCcUFr0= 272 | golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 273 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 274 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 275 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 276 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 277 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 278 | golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= 279 | golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= 280 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 281 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= 282 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 283 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 284 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 285 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 286 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 287 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 288 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 289 | golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 290 | golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 291 | golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 292 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 293 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 294 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 295 | golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 296 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= 297 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 298 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 299 | golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 300 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 301 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 302 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 303 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 304 | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 305 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= 306 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 307 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 308 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 309 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 310 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 311 | golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 312 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 313 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 314 | golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 315 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 316 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 317 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 318 | golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 319 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 320 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 321 | golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 322 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 323 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 324 | golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 325 | golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 326 | golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 327 | golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 328 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 329 | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 330 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU= 331 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 332 | golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 333 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 334 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 335 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 336 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 337 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 338 | golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 339 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 340 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 341 | golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= 342 | golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= 343 | golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 344 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 345 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 346 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 347 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 348 | golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 349 | golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 350 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 351 | golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 352 | golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 353 | golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 354 | golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 355 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 356 | golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 357 | golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 358 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 359 | golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 360 | golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 361 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 362 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 363 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 364 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= 365 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 366 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 367 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 368 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 369 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 370 | google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 371 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= 372 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 373 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 374 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 375 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 376 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 377 | google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= 378 | google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= 379 | google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= 380 | google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= 381 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 382 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 383 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 384 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 385 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 386 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 387 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 388 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 389 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 390 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= 391 | google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= 392 | google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 393 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 394 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= 395 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 396 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 397 | gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= 398 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 399 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 400 | gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 401 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 402 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 403 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 404 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 405 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 406 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 407 | gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= 408 | gorm.io/driver/mysql v1.4.1 h1:4InA6SOaYtt4yYpV1NF9B2kvUKe9TbvUd1iWrvxnjic= 409 | gorm.io/driver/mysql v1.4.1/go.mod h1:sSIebwZAVPiT+27jK9HIwvsqOGKx3YMPmrA3mBJR10c= 410 | gorm.io/driver/postgres v1.4.4 h1:zt1fxJ+C+ajparn0SteEnkoPg0BQ6wOWXEQ99bteAmw= 411 | gorm.io/driver/postgres v1.4.4/go.mod h1:whNfh5WhhHs96honoLjBAMwJGYEuA3m1hvgUbNXhPCw= 412 | gorm.io/driver/sqlserver v1.4.1 h1:t4r4r6Jam5E6ejqP7N82qAJIJAht27EGT41HyPfXRw0= 413 | gorm.io/driver/sqlserver v1.4.1/go.mod h1:DJ4P+MeZbc5rvY58PnmN1Lnyvb5gw5NPzGshHDnJLig= 414 | gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= 415 | gorm.io/gorm v1.23.7/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= 416 | gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= 417 | gorm.io/gorm v1.24.0 h1:j/CoiSm6xpRpmzbFJsQHYj+I8bGYWLXVHeYEyyKlF74= 418 | gorm.io/gorm v1.24.0/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= 419 | gorm.io/plugin/dbresolver v1.3.0 h1:uFDX3bIuH9Lhj5LY2oyqR/bU6pqWuDgas35NAPF4X3M= 420 | gorm.io/plugin/dbresolver v1.3.0/go.mod h1:Pr7p5+JFlgDaiM6sOrli5olekJD16YRunMyA2S7ZfKk= 421 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 422 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 423 | honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= 424 | lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= 425 | modernc.org/cc/v3 v3.36.2/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= 426 | modernc.org/cc/v3 v3.37.0/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= 427 | modernc.org/cc/v3 v3.38.1/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= 428 | modernc.org/ccgo/v3 v3.0.0-20220904174949-82d86e1b6d56/go.mod h1:YSXjPL62P2AMSxBphRHPn7IkzhVHqkvOnRKAKh+W6ZI= 429 | modernc.org/ccgo/v3 v3.0.0-20220910160915-348f15de615a/go.mod h1:8p47QxPkdugex9J4n9P2tLZ9bK01yngIVp00g4nomW0= 430 | modernc.org/ccgo/v3 v3.16.9/go.mod h1:zNMzC9A9xeNUepy6KuZBbugn3c0Mc9TeiJO4lgvkJDo= 431 | modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= 432 | modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= 433 | modernc.org/libc v1.17.0/go.mod h1:XsgLldpP4aWlPlsjqKRdHPqCxCjISdHfM/yeWC5GyW0= 434 | modernc.org/libc v1.17.4/go.mod h1:WNg2ZH56rDEwdropAJeZPQkXmDwh+JCA1s/htl6r2fA= 435 | modernc.org/libc v1.18.0/go.mod h1:vj6zehR5bfc98ipowQOM2nIDUZnVew/wNC/2tOGS+q0= 436 | modernc.org/libc v1.19.0 h1:bXyVhGQg6KIClTr8FMVIDPl7jtbcs7aS5WP7vLDaxPs= 437 | modernc.org/libc v1.19.0/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0= 438 | modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= 439 | modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= 440 | modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= 441 | modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= 442 | modernc.org/memory v1.2.0/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= 443 | modernc.org/memory v1.3.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= 444 | modernc.org/memory v1.4.0 h1:crykUfNSnMAXaOJnnxcSzbUGMqkLWjklJKkBK2nwZwk= 445 | modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= 446 | modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= 447 | modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= 448 | modernc.org/sqlite v1.19.1 h1:8xmS5oLnZtAK//vnd4aTVj8VOeTAccEFOtUnIzfSw+4= 449 | modernc.org/sqlite v1.19.1/go.mod h1:UfQ83woKMaPW/ZBruK0T7YaFCrI+IE0LeWVY6pmnVms= 450 | modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= 451 | modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= 452 | modernc.org/tcl v1.14.0/go.mod h1:gQ7c1YPMvryCHCcmf8acB6VPabE59QBeuRQLL7cTUlM= 453 | modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= 454 | modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= 455 | modernc.org/z v1.6.0/go.mod h1:hVdgNMh8ggTuRG1rGU8x+xGRFfiQUIAw0ZqlPy8+HyQ= 456 | -------------------------------------------------------------------------------- /proto/casbin.pb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The casbin Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Code generated by protoc-gen-go. DO NOT EDIT. 16 | // versions: 17 | // protoc-gen-go v1.28.0 18 | // protoc v5.27.1 19 | // source: proto/casbin.proto 20 | 21 | package proto 22 | 23 | import ( 24 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 25 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 26 | reflect "reflect" 27 | sync "sync" 28 | ) 29 | 30 | const ( 31 | // Verify that this generated code is sufficiently up-to-date. 32 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 33 | // Verify that runtime/protoimpl is sufficiently up-to-date. 34 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 35 | ) 36 | 37 | type NewEnforcerRequest struct { 38 | state protoimpl.MessageState 39 | sizeCache protoimpl.SizeCache 40 | unknownFields protoimpl.UnknownFields 41 | 42 | ModelText string `protobuf:"bytes,1,opt,name=modelText,proto3" json:"modelText,omitempty"` 43 | AdapterHandle int32 `protobuf:"varint,2,opt,name=adapterHandle,proto3" json:"adapterHandle,omitempty"` 44 | EnableAcceptJsonRequest bool `protobuf:"varint,3,opt,name=enableAcceptJsonRequest,proto3" json:"enableAcceptJsonRequest,omitempty"` 45 | } 46 | 47 | func (x *NewEnforcerRequest) Reset() { 48 | *x = NewEnforcerRequest{} 49 | if protoimpl.UnsafeEnabled { 50 | mi := &file_proto_casbin_proto_msgTypes[0] 51 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 52 | ms.StoreMessageInfo(mi) 53 | } 54 | } 55 | 56 | func (x *NewEnforcerRequest) String() string { 57 | return protoimpl.X.MessageStringOf(x) 58 | } 59 | 60 | func (*NewEnforcerRequest) ProtoMessage() {} 61 | 62 | func (x *NewEnforcerRequest) ProtoReflect() protoreflect.Message { 63 | mi := &file_proto_casbin_proto_msgTypes[0] 64 | if protoimpl.UnsafeEnabled && x != nil { 65 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 66 | if ms.LoadMessageInfo() == nil { 67 | ms.StoreMessageInfo(mi) 68 | } 69 | return ms 70 | } 71 | return mi.MessageOf(x) 72 | } 73 | 74 | // Deprecated: Use NewEnforcerRequest.ProtoReflect.Descriptor instead. 75 | func (*NewEnforcerRequest) Descriptor() ([]byte, []int) { 76 | return file_proto_casbin_proto_rawDescGZIP(), []int{0} 77 | } 78 | 79 | func (x *NewEnforcerRequest) GetModelText() string { 80 | if x != nil { 81 | return x.ModelText 82 | } 83 | return "" 84 | } 85 | 86 | func (x *NewEnforcerRequest) GetAdapterHandle() int32 { 87 | if x != nil { 88 | return x.AdapterHandle 89 | } 90 | return 0 91 | } 92 | 93 | func (x *NewEnforcerRequest) GetEnableAcceptJsonRequest() bool { 94 | if x != nil { 95 | return x.EnableAcceptJsonRequest 96 | } 97 | return false 98 | } 99 | 100 | type NewEnforcerReply struct { 101 | state protoimpl.MessageState 102 | sizeCache protoimpl.SizeCache 103 | unknownFields protoimpl.UnknownFields 104 | 105 | Handler int32 `protobuf:"varint,1,opt,name=handler,proto3" json:"handler,omitempty"` 106 | } 107 | 108 | func (x *NewEnforcerReply) Reset() { 109 | *x = NewEnforcerReply{} 110 | if protoimpl.UnsafeEnabled { 111 | mi := &file_proto_casbin_proto_msgTypes[1] 112 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 113 | ms.StoreMessageInfo(mi) 114 | } 115 | } 116 | 117 | func (x *NewEnforcerReply) String() string { 118 | return protoimpl.X.MessageStringOf(x) 119 | } 120 | 121 | func (*NewEnforcerReply) ProtoMessage() {} 122 | 123 | func (x *NewEnforcerReply) ProtoReflect() protoreflect.Message { 124 | mi := &file_proto_casbin_proto_msgTypes[1] 125 | if protoimpl.UnsafeEnabled && x != nil { 126 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 127 | if ms.LoadMessageInfo() == nil { 128 | ms.StoreMessageInfo(mi) 129 | } 130 | return ms 131 | } 132 | return mi.MessageOf(x) 133 | } 134 | 135 | // Deprecated: Use NewEnforcerReply.ProtoReflect.Descriptor instead. 136 | func (*NewEnforcerReply) Descriptor() ([]byte, []int) { 137 | return file_proto_casbin_proto_rawDescGZIP(), []int{1} 138 | } 139 | 140 | func (x *NewEnforcerReply) GetHandler() int32 { 141 | if x != nil { 142 | return x.Handler 143 | } 144 | return 0 145 | } 146 | 147 | type NewAdapterRequest struct { 148 | state protoimpl.MessageState 149 | sizeCache protoimpl.SizeCache 150 | unknownFields protoimpl.UnknownFields 151 | 152 | AdapterName string `protobuf:"bytes,1,opt,name=adapterName,proto3" json:"adapterName,omitempty"` 153 | DriverName string `protobuf:"bytes,2,opt,name=driverName,proto3" json:"driverName,omitempty"` 154 | ConnectString string `protobuf:"bytes,3,opt,name=connectString,proto3" json:"connectString,omitempty"` 155 | DbSpecified bool `protobuf:"varint,4,opt,name=dbSpecified,proto3" json:"dbSpecified,omitempty"` 156 | } 157 | 158 | func (x *NewAdapterRequest) Reset() { 159 | *x = NewAdapterRequest{} 160 | if protoimpl.UnsafeEnabled { 161 | mi := &file_proto_casbin_proto_msgTypes[2] 162 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 163 | ms.StoreMessageInfo(mi) 164 | } 165 | } 166 | 167 | func (x *NewAdapterRequest) String() string { 168 | return protoimpl.X.MessageStringOf(x) 169 | } 170 | 171 | func (*NewAdapterRequest) ProtoMessage() {} 172 | 173 | func (x *NewAdapterRequest) ProtoReflect() protoreflect.Message { 174 | mi := &file_proto_casbin_proto_msgTypes[2] 175 | if protoimpl.UnsafeEnabled && x != nil { 176 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 177 | if ms.LoadMessageInfo() == nil { 178 | ms.StoreMessageInfo(mi) 179 | } 180 | return ms 181 | } 182 | return mi.MessageOf(x) 183 | } 184 | 185 | // Deprecated: Use NewAdapterRequest.ProtoReflect.Descriptor instead. 186 | func (*NewAdapterRequest) Descriptor() ([]byte, []int) { 187 | return file_proto_casbin_proto_rawDescGZIP(), []int{2} 188 | } 189 | 190 | func (x *NewAdapterRequest) GetAdapterName() string { 191 | if x != nil { 192 | return x.AdapterName 193 | } 194 | return "" 195 | } 196 | 197 | func (x *NewAdapterRequest) GetDriverName() string { 198 | if x != nil { 199 | return x.DriverName 200 | } 201 | return "" 202 | } 203 | 204 | func (x *NewAdapterRequest) GetConnectString() string { 205 | if x != nil { 206 | return x.ConnectString 207 | } 208 | return "" 209 | } 210 | 211 | func (x *NewAdapterRequest) GetDbSpecified() bool { 212 | if x != nil { 213 | return x.DbSpecified 214 | } 215 | return false 216 | } 217 | 218 | type NewAdapterReply struct { 219 | state protoimpl.MessageState 220 | sizeCache protoimpl.SizeCache 221 | unknownFields protoimpl.UnknownFields 222 | 223 | Handler int32 `protobuf:"varint,1,opt,name=handler,proto3" json:"handler,omitempty"` 224 | } 225 | 226 | func (x *NewAdapterReply) Reset() { 227 | *x = NewAdapterReply{} 228 | if protoimpl.UnsafeEnabled { 229 | mi := &file_proto_casbin_proto_msgTypes[3] 230 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 231 | ms.StoreMessageInfo(mi) 232 | } 233 | } 234 | 235 | func (x *NewAdapterReply) String() string { 236 | return protoimpl.X.MessageStringOf(x) 237 | } 238 | 239 | func (*NewAdapterReply) ProtoMessage() {} 240 | 241 | func (x *NewAdapterReply) ProtoReflect() protoreflect.Message { 242 | mi := &file_proto_casbin_proto_msgTypes[3] 243 | if protoimpl.UnsafeEnabled && x != nil { 244 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 245 | if ms.LoadMessageInfo() == nil { 246 | ms.StoreMessageInfo(mi) 247 | } 248 | return ms 249 | } 250 | return mi.MessageOf(x) 251 | } 252 | 253 | // Deprecated: Use NewAdapterReply.ProtoReflect.Descriptor instead. 254 | func (*NewAdapterReply) Descriptor() ([]byte, []int) { 255 | return file_proto_casbin_proto_rawDescGZIP(), []int{3} 256 | } 257 | 258 | func (x *NewAdapterReply) GetHandler() int32 { 259 | if x != nil { 260 | return x.Handler 261 | } 262 | return 0 263 | } 264 | 265 | type EnforceRequest struct { 266 | state protoimpl.MessageState 267 | sizeCache protoimpl.SizeCache 268 | unknownFields protoimpl.UnknownFields 269 | 270 | EnforcerHandler int32 `protobuf:"varint,1,opt,name=enforcerHandler,proto3" json:"enforcerHandler,omitempty"` 271 | Params []string `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` 272 | } 273 | 274 | func (x *EnforceRequest) Reset() { 275 | *x = EnforceRequest{} 276 | if protoimpl.UnsafeEnabled { 277 | mi := &file_proto_casbin_proto_msgTypes[4] 278 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 279 | ms.StoreMessageInfo(mi) 280 | } 281 | } 282 | 283 | func (x *EnforceRequest) String() string { 284 | return protoimpl.X.MessageStringOf(x) 285 | } 286 | 287 | func (*EnforceRequest) ProtoMessage() {} 288 | 289 | func (x *EnforceRequest) ProtoReflect() protoreflect.Message { 290 | mi := &file_proto_casbin_proto_msgTypes[4] 291 | if protoimpl.UnsafeEnabled && x != nil { 292 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 293 | if ms.LoadMessageInfo() == nil { 294 | ms.StoreMessageInfo(mi) 295 | } 296 | return ms 297 | } 298 | return mi.MessageOf(x) 299 | } 300 | 301 | // Deprecated: Use EnforceRequest.ProtoReflect.Descriptor instead. 302 | func (*EnforceRequest) Descriptor() ([]byte, []int) { 303 | return file_proto_casbin_proto_rawDescGZIP(), []int{4} 304 | } 305 | 306 | func (x *EnforceRequest) GetEnforcerHandler() int32 { 307 | if x != nil { 308 | return x.EnforcerHandler 309 | } 310 | return 0 311 | } 312 | 313 | func (x *EnforceRequest) GetParams() []string { 314 | if x != nil { 315 | return x.Params 316 | } 317 | return nil 318 | } 319 | 320 | type BoolReply struct { 321 | state protoimpl.MessageState 322 | sizeCache protoimpl.SizeCache 323 | unknownFields protoimpl.UnknownFields 324 | 325 | Res bool `protobuf:"varint,1,opt,name=res,proto3" json:"res,omitempty"` 326 | } 327 | 328 | func (x *BoolReply) Reset() { 329 | *x = BoolReply{} 330 | if protoimpl.UnsafeEnabled { 331 | mi := &file_proto_casbin_proto_msgTypes[5] 332 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 333 | ms.StoreMessageInfo(mi) 334 | } 335 | } 336 | 337 | func (x *BoolReply) String() string { 338 | return protoimpl.X.MessageStringOf(x) 339 | } 340 | 341 | func (*BoolReply) ProtoMessage() {} 342 | 343 | func (x *BoolReply) ProtoReflect() protoreflect.Message { 344 | mi := &file_proto_casbin_proto_msgTypes[5] 345 | if protoimpl.UnsafeEnabled && x != nil { 346 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 347 | if ms.LoadMessageInfo() == nil { 348 | ms.StoreMessageInfo(mi) 349 | } 350 | return ms 351 | } 352 | return mi.MessageOf(x) 353 | } 354 | 355 | // Deprecated: Use BoolReply.ProtoReflect.Descriptor instead. 356 | func (*BoolReply) Descriptor() ([]byte, []int) { 357 | return file_proto_casbin_proto_rawDescGZIP(), []int{5} 358 | } 359 | 360 | func (x *BoolReply) GetRes() bool { 361 | if x != nil { 362 | return x.Res 363 | } 364 | return false 365 | } 366 | 367 | type EmptyRequest struct { 368 | state protoimpl.MessageState 369 | sizeCache protoimpl.SizeCache 370 | unknownFields protoimpl.UnknownFields 371 | 372 | Handler int32 `protobuf:"varint,1,opt,name=handler,proto3" json:"handler,omitempty"` 373 | } 374 | 375 | func (x *EmptyRequest) Reset() { 376 | *x = EmptyRequest{} 377 | if protoimpl.UnsafeEnabled { 378 | mi := &file_proto_casbin_proto_msgTypes[6] 379 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 380 | ms.StoreMessageInfo(mi) 381 | } 382 | } 383 | 384 | func (x *EmptyRequest) String() string { 385 | return protoimpl.X.MessageStringOf(x) 386 | } 387 | 388 | func (*EmptyRequest) ProtoMessage() {} 389 | 390 | func (x *EmptyRequest) ProtoReflect() protoreflect.Message { 391 | mi := &file_proto_casbin_proto_msgTypes[6] 392 | if protoimpl.UnsafeEnabled && x != nil { 393 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 394 | if ms.LoadMessageInfo() == nil { 395 | ms.StoreMessageInfo(mi) 396 | } 397 | return ms 398 | } 399 | return mi.MessageOf(x) 400 | } 401 | 402 | // Deprecated: Use EmptyRequest.ProtoReflect.Descriptor instead. 403 | func (*EmptyRequest) Descriptor() ([]byte, []int) { 404 | return file_proto_casbin_proto_rawDescGZIP(), []int{6} 405 | } 406 | 407 | func (x *EmptyRequest) GetHandler() int32 { 408 | if x != nil { 409 | return x.Handler 410 | } 411 | return 0 412 | } 413 | 414 | type EmptyReply struct { 415 | state protoimpl.MessageState 416 | sizeCache protoimpl.SizeCache 417 | unknownFields protoimpl.UnknownFields 418 | } 419 | 420 | func (x *EmptyReply) Reset() { 421 | *x = EmptyReply{} 422 | if protoimpl.UnsafeEnabled { 423 | mi := &file_proto_casbin_proto_msgTypes[7] 424 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 425 | ms.StoreMessageInfo(mi) 426 | } 427 | } 428 | 429 | func (x *EmptyReply) String() string { 430 | return protoimpl.X.MessageStringOf(x) 431 | } 432 | 433 | func (*EmptyReply) ProtoMessage() {} 434 | 435 | func (x *EmptyReply) ProtoReflect() protoreflect.Message { 436 | mi := &file_proto_casbin_proto_msgTypes[7] 437 | if protoimpl.UnsafeEnabled && x != nil { 438 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 439 | if ms.LoadMessageInfo() == nil { 440 | ms.StoreMessageInfo(mi) 441 | } 442 | return ms 443 | } 444 | return mi.MessageOf(x) 445 | } 446 | 447 | // Deprecated: Use EmptyReply.ProtoReflect.Descriptor instead. 448 | func (*EmptyReply) Descriptor() ([]byte, []int) { 449 | return file_proto_casbin_proto_rawDescGZIP(), []int{7} 450 | } 451 | 452 | type PolicyRequest struct { 453 | state protoimpl.MessageState 454 | sizeCache protoimpl.SizeCache 455 | unknownFields protoimpl.UnknownFields 456 | 457 | EnforcerHandler int32 `protobuf:"varint,1,opt,name=enforcerHandler,proto3" json:"enforcerHandler,omitempty"` 458 | PType string `protobuf:"bytes,2,opt,name=pType,proto3" json:"pType,omitempty"` 459 | Params []string `protobuf:"bytes,3,rep,name=params,proto3" json:"params,omitempty"` 460 | } 461 | 462 | func (x *PolicyRequest) Reset() { 463 | *x = PolicyRequest{} 464 | if protoimpl.UnsafeEnabled { 465 | mi := &file_proto_casbin_proto_msgTypes[8] 466 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 467 | ms.StoreMessageInfo(mi) 468 | } 469 | } 470 | 471 | func (x *PolicyRequest) String() string { 472 | return protoimpl.X.MessageStringOf(x) 473 | } 474 | 475 | func (*PolicyRequest) ProtoMessage() {} 476 | 477 | func (x *PolicyRequest) ProtoReflect() protoreflect.Message { 478 | mi := &file_proto_casbin_proto_msgTypes[8] 479 | if protoimpl.UnsafeEnabled && x != nil { 480 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 481 | if ms.LoadMessageInfo() == nil { 482 | ms.StoreMessageInfo(mi) 483 | } 484 | return ms 485 | } 486 | return mi.MessageOf(x) 487 | } 488 | 489 | // Deprecated: Use PolicyRequest.ProtoReflect.Descriptor instead. 490 | func (*PolicyRequest) Descriptor() ([]byte, []int) { 491 | return file_proto_casbin_proto_rawDescGZIP(), []int{8} 492 | } 493 | 494 | func (x *PolicyRequest) GetEnforcerHandler() int32 { 495 | if x != nil { 496 | return x.EnforcerHandler 497 | } 498 | return 0 499 | } 500 | 501 | func (x *PolicyRequest) GetPType() string { 502 | if x != nil { 503 | return x.PType 504 | } 505 | return "" 506 | } 507 | 508 | func (x *PolicyRequest) GetParams() []string { 509 | if x != nil { 510 | return x.Params 511 | } 512 | return nil 513 | } 514 | 515 | type SimpleGetRequest struct { 516 | state protoimpl.MessageState 517 | sizeCache protoimpl.SizeCache 518 | unknownFields protoimpl.UnknownFields 519 | 520 | EnforcerHandler int32 `protobuf:"varint,1,opt,name=enforcerHandler,proto3" json:"enforcerHandler,omitempty"` 521 | PType string `protobuf:"bytes,2,opt,name=pType,proto3" json:"pType,omitempty"` 522 | } 523 | 524 | func (x *SimpleGetRequest) Reset() { 525 | *x = SimpleGetRequest{} 526 | if protoimpl.UnsafeEnabled { 527 | mi := &file_proto_casbin_proto_msgTypes[9] 528 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 529 | ms.StoreMessageInfo(mi) 530 | } 531 | } 532 | 533 | func (x *SimpleGetRequest) String() string { 534 | return protoimpl.X.MessageStringOf(x) 535 | } 536 | 537 | func (*SimpleGetRequest) ProtoMessage() {} 538 | 539 | func (x *SimpleGetRequest) ProtoReflect() protoreflect.Message { 540 | mi := &file_proto_casbin_proto_msgTypes[9] 541 | if protoimpl.UnsafeEnabled && x != nil { 542 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 543 | if ms.LoadMessageInfo() == nil { 544 | ms.StoreMessageInfo(mi) 545 | } 546 | return ms 547 | } 548 | return mi.MessageOf(x) 549 | } 550 | 551 | // Deprecated: Use SimpleGetRequest.ProtoReflect.Descriptor instead. 552 | func (*SimpleGetRequest) Descriptor() ([]byte, []int) { 553 | return file_proto_casbin_proto_rawDescGZIP(), []int{9} 554 | } 555 | 556 | func (x *SimpleGetRequest) GetEnforcerHandler() int32 { 557 | if x != nil { 558 | return x.EnforcerHandler 559 | } 560 | return 0 561 | } 562 | 563 | func (x *SimpleGetRequest) GetPType() string { 564 | if x != nil { 565 | return x.PType 566 | } 567 | return "" 568 | } 569 | 570 | type ArrayReply struct { 571 | state protoimpl.MessageState 572 | sizeCache protoimpl.SizeCache 573 | unknownFields protoimpl.UnknownFields 574 | 575 | Array []string `protobuf:"bytes,1,rep,name=array,proto3" json:"array,omitempty"` 576 | } 577 | 578 | func (x *ArrayReply) Reset() { 579 | *x = ArrayReply{} 580 | if protoimpl.UnsafeEnabled { 581 | mi := &file_proto_casbin_proto_msgTypes[10] 582 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 583 | ms.StoreMessageInfo(mi) 584 | } 585 | } 586 | 587 | func (x *ArrayReply) String() string { 588 | return protoimpl.X.MessageStringOf(x) 589 | } 590 | 591 | func (*ArrayReply) ProtoMessage() {} 592 | 593 | func (x *ArrayReply) ProtoReflect() protoreflect.Message { 594 | mi := &file_proto_casbin_proto_msgTypes[10] 595 | if protoimpl.UnsafeEnabled && x != nil { 596 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 597 | if ms.LoadMessageInfo() == nil { 598 | ms.StoreMessageInfo(mi) 599 | } 600 | return ms 601 | } 602 | return mi.MessageOf(x) 603 | } 604 | 605 | // Deprecated: Use ArrayReply.ProtoReflect.Descriptor instead. 606 | func (*ArrayReply) Descriptor() ([]byte, []int) { 607 | return file_proto_casbin_proto_rawDescGZIP(), []int{10} 608 | } 609 | 610 | func (x *ArrayReply) GetArray() []string { 611 | if x != nil { 612 | return x.Array 613 | } 614 | return nil 615 | } 616 | 617 | type FilteredPolicyRequest struct { 618 | state protoimpl.MessageState 619 | sizeCache protoimpl.SizeCache 620 | unknownFields protoimpl.UnknownFields 621 | 622 | EnforcerHandler int32 `protobuf:"varint,1,opt,name=enforcerHandler,proto3" json:"enforcerHandler,omitempty"` 623 | PType string `protobuf:"bytes,2,opt,name=pType,proto3" json:"pType,omitempty"` 624 | FieldIndex int32 `protobuf:"varint,3,opt,name=fieldIndex,proto3" json:"fieldIndex,omitempty"` 625 | FieldValues []string `protobuf:"bytes,4,rep,name=fieldValues,proto3" json:"fieldValues,omitempty"` 626 | } 627 | 628 | func (x *FilteredPolicyRequest) Reset() { 629 | *x = FilteredPolicyRequest{} 630 | if protoimpl.UnsafeEnabled { 631 | mi := &file_proto_casbin_proto_msgTypes[11] 632 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 633 | ms.StoreMessageInfo(mi) 634 | } 635 | } 636 | 637 | func (x *FilteredPolicyRequest) String() string { 638 | return protoimpl.X.MessageStringOf(x) 639 | } 640 | 641 | func (*FilteredPolicyRequest) ProtoMessage() {} 642 | 643 | func (x *FilteredPolicyRequest) ProtoReflect() protoreflect.Message { 644 | mi := &file_proto_casbin_proto_msgTypes[11] 645 | if protoimpl.UnsafeEnabled && x != nil { 646 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 647 | if ms.LoadMessageInfo() == nil { 648 | ms.StoreMessageInfo(mi) 649 | } 650 | return ms 651 | } 652 | return mi.MessageOf(x) 653 | } 654 | 655 | // Deprecated: Use FilteredPolicyRequest.ProtoReflect.Descriptor instead. 656 | func (*FilteredPolicyRequest) Descriptor() ([]byte, []int) { 657 | return file_proto_casbin_proto_rawDescGZIP(), []int{11} 658 | } 659 | 660 | func (x *FilteredPolicyRequest) GetEnforcerHandler() int32 { 661 | if x != nil { 662 | return x.EnforcerHandler 663 | } 664 | return 0 665 | } 666 | 667 | func (x *FilteredPolicyRequest) GetPType() string { 668 | if x != nil { 669 | return x.PType 670 | } 671 | return "" 672 | } 673 | 674 | func (x *FilteredPolicyRequest) GetFieldIndex() int32 { 675 | if x != nil { 676 | return x.FieldIndex 677 | } 678 | return 0 679 | } 680 | 681 | func (x *FilteredPolicyRequest) GetFieldValues() []string { 682 | if x != nil { 683 | return x.FieldValues 684 | } 685 | return nil 686 | } 687 | 688 | type UserRoleRequest struct { 689 | state protoimpl.MessageState 690 | sizeCache protoimpl.SizeCache 691 | unknownFields protoimpl.UnknownFields 692 | 693 | EnforcerHandler int32 `protobuf:"varint,1,opt,name=enforcerHandler,proto3" json:"enforcerHandler,omitempty"` 694 | User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` 695 | Role string `protobuf:"bytes,3,opt,name=role,proto3" json:"role,omitempty"` 696 | Domain []string `protobuf:"bytes,4,rep,name=domain,proto3" json:"domain,omitempty"` 697 | } 698 | 699 | func (x *UserRoleRequest) Reset() { 700 | *x = UserRoleRequest{} 701 | if protoimpl.UnsafeEnabled { 702 | mi := &file_proto_casbin_proto_msgTypes[12] 703 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 704 | ms.StoreMessageInfo(mi) 705 | } 706 | } 707 | 708 | func (x *UserRoleRequest) String() string { 709 | return protoimpl.X.MessageStringOf(x) 710 | } 711 | 712 | func (*UserRoleRequest) ProtoMessage() {} 713 | 714 | func (x *UserRoleRequest) ProtoReflect() protoreflect.Message { 715 | mi := &file_proto_casbin_proto_msgTypes[12] 716 | if protoimpl.UnsafeEnabled && x != nil { 717 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 718 | if ms.LoadMessageInfo() == nil { 719 | ms.StoreMessageInfo(mi) 720 | } 721 | return ms 722 | } 723 | return mi.MessageOf(x) 724 | } 725 | 726 | // Deprecated: Use UserRoleRequest.ProtoReflect.Descriptor instead. 727 | func (*UserRoleRequest) Descriptor() ([]byte, []int) { 728 | return file_proto_casbin_proto_rawDescGZIP(), []int{12} 729 | } 730 | 731 | func (x *UserRoleRequest) GetEnforcerHandler() int32 { 732 | if x != nil { 733 | return x.EnforcerHandler 734 | } 735 | return 0 736 | } 737 | 738 | func (x *UserRoleRequest) GetUser() string { 739 | if x != nil { 740 | return x.User 741 | } 742 | return "" 743 | } 744 | 745 | func (x *UserRoleRequest) GetRole() string { 746 | if x != nil { 747 | return x.Role 748 | } 749 | return "" 750 | } 751 | 752 | func (x *UserRoleRequest) GetDomain() []string { 753 | if x != nil { 754 | return x.Domain 755 | } 756 | return nil 757 | } 758 | 759 | type PermissionRequest struct { 760 | state protoimpl.MessageState 761 | sizeCache protoimpl.SizeCache 762 | unknownFields protoimpl.UnknownFields 763 | 764 | EnforcerHandler int32 `protobuf:"varint,1,opt,name=enforcerHandler,proto3" json:"enforcerHandler,omitempty"` 765 | User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` 766 | Permissions []string `protobuf:"bytes,3,rep,name=permissions,proto3" json:"permissions,omitempty"` 767 | Domain []string `protobuf:"bytes,4,rep,name=domain,proto3" json:"domain,omitempty"` 768 | } 769 | 770 | func (x *PermissionRequest) Reset() { 771 | *x = PermissionRequest{} 772 | if protoimpl.UnsafeEnabled { 773 | mi := &file_proto_casbin_proto_msgTypes[13] 774 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 775 | ms.StoreMessageInfo(mi) 776 | } 777 | } 778 | 779 | func (x *PermissionRequest) String() string { 780 | return protoimpl.X.MessageStringOf(x) 781 | } 782 | 783 | func (*PermissionRequest) ProtoMessage() {} 784 | 785 | func (x *PermissionRequest) ProtoReflect() protoreflect.Message { 786 | mi := &file_proto_casbin_proto_msgTypes[13] 787 | if protoimpl.UnsafeEnabled && x != nil { 788 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 789 | if ms.LoadMessageInfo() == nil { 790 | ms.StoreMessageInfo(mi) 791 | } 792 | return ms 793 | } 794 | return mi.MessageOf(x) 795 | } 796 | 797 | // Deprecated: Use PermissionRequest.ProtoReflect.Descriptor instead. 798 | func (*PermissionRequest) Descriptor() ([]byte, []int) { 799 | return file_proto_casbin_proto_rawDescGZIP(), []int{13} 800 | } 801 | 802 | func (x *PermissionRequest) GetEnforcerHandler() int32 { 803 | if x != nil { 804 | return x.EnforcerHandler 805 | } 806 | return 0 807 | } 808 | 809 | func (x *PermissionRequest) GetUser() string { 810 | if x != nil { 811 | return x.User 812 | } 813 | return "" 814 | } 815 | 816 | func (x *PermissionRequest) GetPermissions() []string { 817 | if x != nil { 818 | return x.Permissions 819 | } 820 | return nil 821 | } 822 | 823 | func (x *PermissionRequest) GetDomain() []string { 824 | if x != nil { 825 | return x.Domain 826 | } 827 | return nil 828 | } 829 | 830 | type Array2DReply struct { 831 | state protoimpl.MessageState 832 | sizeCache protoimpl.SizeCache 833 | unknownFields protoimpl.UnknownFields 834 | 835 | D2 []*Array2DReplyD `protobuf:"bytes,1,rep,name=d2,proto3" json:"d2,omitempty"` 836 | } 837 | 838 | func (x *Array2DReply) Reset() { 839 | *x = Array2DReply{} 840 | if protoimpl.UnsafeEnabled { 841 | mi := &file_proto_casbin_proto_msgTypes[14] 842 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 843 | ms.StoreMessageInfo(mi) 844 | } 845 | } 846 | 847 | func (x *Array2DReply) String() string { 848 | return protoimpl.X.MessageStringOf(x) 849 | } 850 | 851 | func (*Array2DReply) ProtoMessage() {} 852 | 853 | func (x *Array2DReply) ProtoReflect() protoreflect.Message { 854 | mi := &file_proto_casbin_proto_msgTypes[14] 855 | if protoimpl.UnsafeEnabled && x != nil { 856 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 857 | if ms.LoadMessageInfo() == nil { 858 | ms.StoreMessageInfo(mi) 859 | } 860 | return ms 861 | } 862 | return mi.MessageOf(x) 863 | } 864 | 865 | // Deprecated: Use Array2DReply.ProtoReflect.Descriptor instead. 866 | func (*Array2DReply) Descriptor() ([]byte, []int) { 867 | return file_proto_casbin_proto_rawDescGZIP(), []int{14} 868 | } 869 | 870 | func (x *Array2DReply) GetD2() []*Array2DReplyD { 871 | if x != nil { 872 | return x.D2 873 | } 874 | return nil 875 | } 876 | 877 | type Array2DReplyD struct { 878 | state protoimpl.MessageState 879 | sizeCache protoimpl.SizeCache 880 | unknownFields protoimpl.UnknownFields 881 | 882 | D1 []string `protobuf:"bytes,1,rep,name=d1,proto3" json:"d1,omitempty"` 883 | } 884 | 885 | func (x *Array2DReplyD) Reset() { 886 | *x = Array2DReplyD{} 887 | if protoimpl.UnsafeEnabled { 888 | mi := &file_proto_casbin_proto_msgTypes[15] 889 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 890 | ms.StoreMessageInfo(mi) 891 | } 892 | } 893 | 894 | func (x *Array2DReplyD) String() string { 895 | return protoimpl.X.MessageStringOf(x) 896 | } 897 | 898 | func (*Array2DReplyD) ProtoMessage() {} 899 | 900 | func (x *Array2DReplyD) ProtoReflect() protoreflect.Message { 901 | mi := &file_proto_casbin_proto_msgTypes[15] 902 | if protoimpl.UnsafeEnabled && x != nil { 903 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 904 | if ms.LoadMessageInfo() == nil { 905 | ms.StoreMessageInfo(mi) 906 | } 907 | return ms 908 | } 909 | return mi.MessageOf(x) 910 | } 911 | 912 | // Deprecated: Use Array2DReplyD.ProtoReflect.Descriptor instead. 913 | func (*Array2DReplyD) Descriptor() ([]byte, []int) { 914 | return file_proto_casbin_proto_rawDescGZIP(), []int{14, 0} 915 | } 916 | 917 | func (x *Array2DReplyD) GetD1() []string { 918 | if x != nil { 919 | return x.D1 920 | } 921 | return nil 922 | } 923 | 924 | var File_proto_casbin_proto protoreflect.FileDescriptor 925 | 926 | var file_proto_casbin_proto_rawDesc = []byte{ 927 | 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x61, 0x73, 0x62, 0x69, 0x6e, 0x2e, 0x70, 928 | 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x92, 0x01, 0x0a, 0x12, 929 | 0x4e, 0x65, 0x77, 0x45, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 930 | 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x54, 0x65, 0x78, 0x74, 0x18, 931 | 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x54, 0x65, 0x78, 0x74, 932 | 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 933 | 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 934 | 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x38, 0x0a, 0x17, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 935 | 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x4a, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 936 | 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 937 | 0x63, 0x63, 0x65, 0x70, 0x74, 0x4a, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 938 | 0x22, 0x2c, 0x0a, 0x10, 0x4e, 0x65, 0x77, 0x45, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x52, 939 | 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 940 | 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x22, 0x9d, 941 | 0x01, 0x0a, 0x11, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 942 | 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x4e, 943 | 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x64, 0x61, 0x70, 0x74, 944 | 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 945 | 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x72, 0x69, 0x76, 946 | 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 947 | 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 948 | 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x20, 0x0a, 0x0b, 949 | 0x64, 0x62, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 950 | 0x08, 0x52, 0x0b, 0x64, 0x62, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x22, 0x2b, 951 | 0x0a, 0x0f, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 952 | 0x79, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 953 | 0x28, 0x05, 0x52, 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x22, 0x52, 0x0a, 0x0e, 0x45, 954 | 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 955 | 0x0f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 956 | 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 957 | 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 958 | 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 959 | 0x1d, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 960 | 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x65, 0x73, 0x22, 0x28, 961 | 0x0a, 0x0c, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 962 | 0x0a, 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 963 | 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x22, 0x0c, 0x0a, 0x0a, 0x45, 0x6d, 0x70, 0x74, 964 | 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x67, 0x0a, 0x0d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 965 | 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 966 | 0x63, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 967 | 0x52, 0x0f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 968 | 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 969 | 0x52, 0x05, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 970 | 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 971 | 0x52, 0x0a, 0x10, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 972 | 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x48, 973 | 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x65, 0x6e, 974 | 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x14, 0x0a, 975 | 0x05, 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x54, 976 | 0x79, 0x70, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 977 | 0x79, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 978 | 0x52, 0x05, 0x61, 0x72, 0x72, 0x61, 0x79, 0x22, 0x99, 0x01, 0x0a, 0x15, 0x46, 0x69, 0x6c, 0x74, 979 | 0x65, 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 980 | 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x48, 0x61, 0x6e, 981 | 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x65, 0x6e, 0x66, 0x6f, 982 | 0x72, 0x63, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 983 | 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x54, 0x79, 0x70, 984 | 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 985 | 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x6e, 0x64, 0x65, 986 | 0x78, 0x12, 0x20, 0x0a, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 987 | 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x56, 0x61, 0x6c, 988 | 0x75, 0x65, 0x73, 0x22, 0x7b, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 989 | 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 990 | 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 991 | 0x0f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 992 | 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 993 | 0x75, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 994 | 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 995 | 0x69, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 996 | 0x22, 0x8b, 0x01, 0x0a, 0x11, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 997 | 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 998 | 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 999 | 0x0f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 1000 | 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 1001 | 0x75, 0x73, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 1002 | 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 1003 | 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 1004 | 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0x4a, 1005 | 0x0a, 0x0c, 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x25, 1006 | 0x0a, 0x02, 0x64, 0x32, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 1007 | 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2e, 1008 | 0x64, 0x52, 0x02, 0x64, 0x32, 0x1a, 0x13, 0x0a, 0x01, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x31, 1009 | 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x64, 0x31, 0x32, 0x95, 0x1c, 0x0a, 0x06, 0x43, 1010 | 0x61, 0x73, 0x62, 0x69, 0x6e, 0x12, 0x43, 0x0a, 0x0b, 0x4e, 0x65, 0x77, 0x45, 0x6e, 0x66, 0x6f, 1011 | 0x72, 0x63, 0x65, 0x72, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x77, 1012 | 0x45, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 1013 | 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x77, 0x45, 0x6e, 0x66, 0x6f, 0x72, 1014 | 0x63, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0a, 0x4e, 0x65, 1015 | 0x77, 0x41, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 1016 | 0x2e, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 1017 | 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x77, 0x41, 0x64, 1018 | 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x07, 1019 | 0x45, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 1020 | 0x45, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 1021 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 1022 | 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0a, 0x4c, 0x6f, 0x61, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 1023 | 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 1024 | 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 1025 | 0x70, 0x74, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0a, 0x53, 0x61, 1026 | 0x76, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 1027 | 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 1028 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 1029 | 0x22, 0x00, 0x12, 0x35, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 1030 | 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 1031 | 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 1032 | 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0e, 0x41, 0x64, 0x64, 1033 | 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 1034 | 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 1035 | 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 1036 | 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x0c, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 1037 | 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 1038 | 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 1039 | 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 1040 | 0x3d, 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x6f, 1041 | 0x6c, 0x69, 0x63, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 1042 | 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 1043 | 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x48, 1044 | 0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 1045 | 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 1046 | 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 1047 | 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 1048 | 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x19, 0x52, 0x65, 0x6d, 0x6f, 1049 | 0x76, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 1050 | 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 1051 | 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 1052 | 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 1053 | 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x50, 0x6f, 1054 | 0x6c, 0x69, 0x63, 0x79, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 1055 | 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 1056 | 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 1057 | 0x12, 0x3d, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 1058 | 0x63, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 1059 | 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 1060 | 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 1061 | 0x48, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x50, 0x6f, 1062 | 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 1063 | 0x74, 0x65, 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 1064 | 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 1065 | 0x32, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x16, 0x47, 0x65, 0x74, 1066 | 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x6f, 0x6c, 1067 | 0x69, 0x63, 0x79, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x74, 1068 | 0x65, 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 1069 | 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 1070 | 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x11, 0x41, 0x64, 0x64, 0x47, 1071 | 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x14, 0x2e, 1072 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 1073 | 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 1074 | 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x16, 0x41, 0x64, 0x64, 0x4e, 0x61, 1075 | 0x6d, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x6c, 0x69, 0x63, 1076 | 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 1077 | 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 1078 | 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x14, 0x52, 1079 | 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x6c, 1080 | 0x69, 0x63, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 1081 | 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 1082 | 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x45, 0x0a, 1083 | 0x19, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 1084 | 0x70, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 1085 | 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 1086 | 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 1087 | 0x6c, 0x79, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x1c, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x46, 0x69, 1088 | 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x6f, 1089 | 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 1090 | 0x74, 0x65, 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 1091 | 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 1092 | 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x21, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 1093 | 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x47, 0x72, 0x6f, 1094 | 0x75, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1c, 0x2e, 0x70, 0x72, 1095 | 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 1096 | 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 1097 | 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3f, 0x0a, 1098 | 0x11, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x6c, 0x69, 1099 | 0x63, 0x79, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 1100 | 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 1101 | 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x45, 1102 | 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x69, 1103 | 0x6e, 0x67, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 1104 | 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 1105 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 0x44, 0x52, 0x65, 1106 | 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x74, 1107 | 0x65, 0x72, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x6c, 0x69, 1108 | 0x63, 0x79, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 1109 | 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 1110 | 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 0x44, 1111 | 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x46, 0x69, 1112 | 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 1113 | 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 1114 | 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 1115 | 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 1116 | 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 1117 | 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 1118 | 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 1119 | 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 1120 | 0x72, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x13, 0x47, 0x65, 1121 | 0x74, 0x41, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 1122 | 0x73, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 1123 | 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 1124 | 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 1125 | 0x39, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 1126 | 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 1127 | 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 1128 | 0x72, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x12, 0x47, 0x65, 1129 | 0x74, 0x41, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 1130 | 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x47, 1131 | 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 1132 | 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x39, 1133 | 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 1134 | 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 1135 | 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 1136 | 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x12, 0x47, 0x65, 0x74, 1137 | 0x41, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 1138 | 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x47, 0x65, 1139 | 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 1140 | 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 1141 | 0x0b, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x13, 0x2e, 0x70, 1142 | 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 1143 | 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 1144 | 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 1145 | 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 1146 | 0x74, 0x6f, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 1147 | 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 1148 | 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x09, 0x48, 0x61, 0x73, 0x50, 1149 | 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 1150 | 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 1151 | 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 1152 | 0x3a, 0x0a, 0x0e, 0x48, 0x61, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 1153 | 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 1154 | 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 1155 | 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x11, 0x48, 1156 | 0x61, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 1157 | 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 1158 | 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 1159 | 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x16, 0x48, 0x61, 1160 | 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x6f, 1161 | 0x6c, 0x69, 0x63, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x6f, 0x6c, 1162 | 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 1163 | 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x39, 1164 | 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x70, 1165 | 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 1166 | 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 1167 | 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0f, 0x47, 0x65, 0x74, 1168 | 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x46, 0x6f, 0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x70, 1169 | 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 1170 | 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 1171 | 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x17, 0x47, 0x65, 0x74, 1172 | 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x46, 0x6f, 0x72, 1173 | 0x55, 0x73, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 1174 | 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 1175 | 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 1176 | 0x00, 0x12, 0x3e, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x46, 0x6f, 0x72, 1177 | 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 1178 | 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 1179 | 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 1180 | 0x00, 0x12, 0x3c, 0x0a, 0x0e, 0x48, 0x61, 0x73, 0x52, 0x6f, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x55, 1181 | 0x73, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 0x72, 1182 | 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 1183 | 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 1184 | 0x3c, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x52, 0x6f, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x55, 0x73, 0x65, 1185 | 0x72, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 1186 | 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 1187 | 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3f, 0x0a, 1188 | 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x55, 0x73, 1189 | 0x65, 0x72, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 1190 | 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 1191 | 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x40, 1192 | 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x46, 0x6f, 0x72, 1193 | 0x55, 0x73, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 1194 | 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 1195 | 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 1196 | 0x12, 0x38, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x16, 1197 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 1198 | 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 1199 | 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x0a, 0x44, 0x65, 1200 | 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 1201 | 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 1202 | 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 1203 | 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x50, 0x65, 0x72, 0x6d, 1204 | 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x46, 0x6f, 0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 1205 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 1206 | 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 1207 | 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 1208 | 0x50, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x50, 0x65, 1209 | 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x46, 0x6f, 0x72, 0x55, 0x73, 0x65, 0x72, 1210 | 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 1211 | 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 1212 | 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x72, 0x61, 0x79, 0x32, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 1213 | 0x00, 0x12, 0x40, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x69, 1214 | 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 1215 | 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 1216 | 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 1217 | 0x79, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 1218 | 0x73, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x72, 1219 | 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 1220 | 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 1221 | 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x17, 0x44, 0x65, 0x6c, 1222 | 0x65, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 1223 | 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x72, 1224 | 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 1225 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 1226 | 0x22, 0x00, 0x12, 0x48, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d, 1227 | 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x46, 0x6f, 0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 1228 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 1229 | 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 1230 | 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x14, 1231 | 0x48, 0x61, 0x73, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 1232 | 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x72, 1233 | 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 1234 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 1235 | 0x22, 0x00, 0x42, 0x42, 0x0a, 0x16, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x65, 0x78, 1236 | 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x0b, 0x43, 0x61, 1237 | 0x73, 0x62, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x08, 0x2e, 0x2f, 0x3b, 1238 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xaa, 0x02, 0x0e, 0x43, 0x61, 0x73, 0x62, 0x69, 0x6e, 0x4f, 0x72, 1239 | 0x67, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 1240 | } 1241 | 1242 | var ( 1243 | file_proto_casbin_proto_rawDescOnce sync.Once 1244 | file_proto_casbin_proto_rawDescData = file_proto_casbin_proto_rawDesc 1245 | ) 1246 | 1247 | func file_proto_casbin_proto_rawDescGZIP() []byte { 1248 | file_proto_casbin_proto_rawDescOnce.Do(func() { 1249 | file_proto_casbin_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_casbin_proto_rawDescData) 1250 | }) 1251 | return file_proto_casbin_proto_rawDescData 1252 | } 1253 | 1254 | var file_proto_casbin_proto_msgTypes = make([]protoimpl.MessageInfo, 16) 1255 | var file_proto_casbin_proto_goTypes = []interface{}{ 1256 | (*NewEnforcerRequest)(nil), // 0: proto.NewEnforcerRequest 1257 | (*NewEnforcerReply)(nil), // 1: proto.NewEnforcerReply 1258 | (*NewAdapterRequest)(nil), // 2: proto.NewAdapterRequest 1259 | (*NewAdapterReply)(nil), // 3: proto.NewAdapterReply 1260 | (*EnforceRequest)(nil), // 4: proto.EnforceRequest 1261 | (*BoolReply)(nil), // 5: proto.BoolReply 1262 | (*EmptyRequest)(nil), // 6: proto.EmptyRequest 1263 | (*EmptyReply)(nil), // 7: proto.EmptyReply 1264 | (*PolicyRequest)(nil), // 8: proto.PolicyRequest 1265 | (*SimpleGetRequest)(nil), // 9: proto.SimpleGetRequest 1266 | (*ArrayReply)(nil), // 10: proto.ArrayReply 1267 | (*FilteredPolicyRequest)(nil), // 11: proto.FilteredPolicyRequest 1268 | (*UserRoleRequest)(nil), // 12: proto.UserRoleRequest 1269 | (*PermissionRequest)(nil), // 13: proto.PermissionRequest 1270 | (*Array2DReply)(nil), // 14: proto.Array2DReply 1271 | (*Array2DReplyD)(nil), // 15: proto.Array2DReply.d 1272 | } 1273 | var file_proto_casbin_proto_depIdxs = []int32{ 1274 | 15, // 0: proto.Array2DReply.d2:type_name -> proto.Array2DReply.d 1275 | 0, // 1: proto.Casbin.NewEnforcer:input_type -> proto.NewEnforcerRequest 1276 | 2, // 2: proto.Casbin.NewAdapter:input_type -> proto.NewAdapterRequest 1277 | 4, // 3: proto.Casbin.Enforce:input_type -> proto.EnforceRequest 1278 | 6, // 4: proto.Casbin.LoadPolicy:input_type -> proto.EmptyRequest 1279 | 6, // 5: proto.Casbin.SavePolicy:input_type -> proto.EmptyRequest 1280 | 8, // 6: proto.Casbin.AddPolicy:input_type -> proto.PolicyRequest 1281 | 8, // 7: proto.Casbin.AddNamedPolicy:input_type -> proto.PolicyRequest 1282 | 8, // 8: proto.Casbin.RemovePolicy:input_type -> proto.PolicyRequest 1283 | 8, // 9: proto.Casbin.RemoveNamedPolicy:input_type -> proto.PolicyRequest 1284 | 11, // 10: proto.Casbin.RemoveFilteredPolicy:input_type -> proto.FilteredPolicyRequest 1285 | 11, // 11: proto.Casbin.RemoveFilteredNamedPolicy:input_type -> proto.FilteredPolicyRequest 1286 | 6, // 12: proto.Casbin.GetPolicy:input_type -> proto.EmptyRequest 1287 | 8, // 13: proto.Casbin.GetNamedPolicy:input_type -> proto.PolicyRequest 1288 | 11, // 14: proto.Casbin.GetFilteredPolicy:input_type -> proto.FilteredPolicyRequest 1289 | 11, // 15: proto.Casbin.GetFilteredNamedPolicy:input_type -> proto.FilteredPolicyRequest 1290 | 8, // 16: proto.Casbin.AddGroupingPolicy:input_type -> proto.PolicyRequest 1291 | 8, // 17: proto.Casbin.AddNamedGroupingPolicy:input_type -> proto.PolicyRequest 1292 | 8, // 18: proto.Casbin.RemoveGroupingPolicy:input_type -> proto.PolicyRequest 1293 | 8, // 19: proto.Casbin.RemoveNamedGroupingPolicy:input_type -> proto.PolicyRequest 1294 | 11, // 20: proto.Casbin.RemoveFilteredGroupingPolicy:input_type -> proto.FilteredPolicyRequest 1295 | 11, // 21: proto.Casbin.RemoveFilteredNamedGroupingPolicy:input_type -> proto.FilteredPolicyRequest 1296 | 6, // 22: proto.Casbin.GetGroupingPolicy:input_type -> proto.EmptyRequest 1297 | 8, // 23: proto.Casbin.GetNamedGroupingPolicy:input_type -> proto.PolicyRequest 1298 | 11, // 24: proto.Casbin.GetFilteredGroupingPolicy:input_type -> proto.FilteredPolicyRequest 1299 | 11, // 25: proto.Casbin.GetFilteredNamedGroupingPolicy:input_type -> proto.FilteredPolicyRequest 1300 | 6, // 26: proto.Casbin.GetAllSubjects:input_type -> proto.EmptyRequest 1301 | 9, // 27: proto.Casbin.GetAllNamedSubjects:input_type -> proto.SimpleGetRequest 1302 | 6, // 28: proto.Casbin.GetAllObjects:input_type -> proto.EmptyRequest 1303 | 9, // 29: proto.Casbin.GetAllNamedObjects:input_type -> proto.SimpleGetRequest 1304 | 6, // 30: proto.Casbin.GetAllActions:input_type -> proto.EmptyRequest 1305 | 9, // 31: proto.Casbin.GetAllNamedActions:input_type -> proto.SimpleGetRequest 1306 | 6, // 32: proto.Casbin.GetAllRoles:input_type -> proto.EmptyRequest 1307 | 9, // 33: proto.Casbin.GetAllNamedRoles:input_type -> proto.SimpleGetRequest 1308 | 8, // 34: proto.Casbin.HasPolicy:input_type -> proto.PolicyRequest 1309 | 8, // 35: proto.Casbin.HasNamedPolicy:input_type -> proto.PolicyRequest 1310 | 8, // 36: proto.Casbin.HasGroupingPolicy:input_type -> proto.PolicyRequest 1311 | 8, // 37: proto.Casbin.HasNamedGroupingPolicy:input_type -> proto.PolicyRequest 1312 | 12, // 38: proto.Casbin.GetDomains:input_type -> proto.UserRoleRequest 1313 | 12, // 39: proto.Casbin.GetRolesForUser:input_type -> proto.UserRoleRequest 1314 | 12, // 40: proto.Casbin.GetImplicitRolesForUser:input_type -> proto.UserRoleRequest 1315 | 12, // 41: proto.Casbin.GetUsersForRole:input_type -> proto.UserRoleRequest 1316 | 12, // 42: proto.Casbin.HasRoleForUser:input_type -> proto.UserRoleRequest 1317 | 12, // 43: proto.Casbin.AddRoleForUser:input_type -> proto.UserRoleRequest 1318 | 12, // 44: proto.Casbin.DeleteRoleForUser:input_type -> proto.UserRoleRequest 1319 | 12, // 45: proto.Casbin.DeleteRolesForUser:input_type -> proto.UserRoleRequest 1320 | 12, // 46: proto.Casbin.DeleteUser:input_type -> proto.UserRoleRequest 1321 | 12, // 47: proto.Casbin.DeleteRole:input_type -> proto.UserRoleRequest 1322 | 13, // 48: proto.Casbin.GetPermissionsForUser:input_type -> proto.PermissionRequest 1323 | 13, // 49: proto.Casbin.GetImplicitPermissionsForUser:input_type -> proto.PermissionRequest 1324 | 13, // 50: proto.Casbin.DeletePermission:input_type -> proto.PermissionRequest 1325 | 13, // 51: proto.Casbin.AddPermissionForUser:input_type -> proto.PermissionRequest 1326 | 13, // 52: proto.Casbin.DeletePermissionForUser:input_type -> proto.PermissionRequest 1327 | 13, // 53: proto.Casbin.DeletePermissionsForUser:input_type -> proto.PermissionRequest 1328 | 13, // 54: proto.Casbin.HasPermissionForUser:input_type -> proto.PermissionRequest 1329 | 1, // 55: proto.Casbin.NewEnforcer:output_type -> proto.NewEnforcerReply 1330 | 3, // 56: proto.Casbin.NewAdapter:output_type -> proto.NewAdapterReply 1331 | 5, // 57: proto.Casbin.Enforce:output_type -> proto.BoolReply 1332 | 7, // 58: proto.Casbin.LoadPolicy:output_type -> proto.EmptyReply 1333 | 7, // 59: proto.Casbin.SavePolicy:output_type -> proto.EmptyReply 1334 | 5, // 60: proto.Casbin.AddPolicy:output_type -> proto.BoolReply 1335 | 5, // 61: proto.Casbin.AddNamedPolicy:output_type -> proto.BoolReply 1336 | 5, // 62: proto.Casbin.RemovePolicy:output_type -> proto.BoolReply 1337 | 5, // 63: proto.Casbin.RemoveNamedPolicy:output_type -> proto.BoolReply 1338 | 5, // 64: proto.Casbin.RemoveFilteredPolicy:output_type -> proto.BoolReply 1339 | 5, // 65: proto.Casbin.RemoveFilteredNamedPolicy:output_type -> proto.BoolReply 1340 | 14, // 66: proto.Casbin.GetPolicy:output_type -> proto.Array2DReply 1341 | 14, // 67: proto.Casbin.GetNamedPolicy:output_type -> proto.Array2DReply 1342 | 14, // 68: proto.Casbin.GetFilteredPolicy:output_type -> proto.Array2DReply 1343 | 14, // 69: proto.Casbin.GetFilteredNamedPolicy:output_type -> proto.Array2DReply 1344 | 5, // 70: proto.Casbin.AddGroupingPolicy:output_type -> proto.BoolReply 1345 | 5, // 71: proto.Casbin.AddNamedGroupingPolicy:output_type -> proto.BoolReply 1346 | 5, // 72: proto.Casbin.RemoveGroupingPolicy:output_type -> proto.BoolReply 1347 | 5, // 73: proto.Casbin.RemoveNamedGroupingPolicy:output_type -> proto.BoolReply 1348 | 5, // 74: proto.Casbin.RemoveFilteredGroupingPolicy:output_type -> proto.BoolReply 1349 | 5, // 75: proto.Casbin.RemoveFilteredNamedGroupingPolicy:output_type -> proto.BoolReply 1350 | 14, // 76: proto.Casbin.GetGroupingPolicy:output_type -> proto.Array2DReply 1351 | 14, // 77: proto.Casbin.GetNamedGroupingPolicy:output_type -> proto.Array2DReply 1352 | 14, // 78: proto.Casbin.GetFilteredGroupingPolicy:output_type -> proto.Array2DReply 1353 | 14, // 79: proto.Casbin.GetFilteredNamedGroupingPolicy:output_type -> proto.Array2DReply 1354 | 10, // 80: proto.Casbin.GetAllSubjects:output_type -> proto.ArrayReply 1355 | 10, // 81: proto.Casbin.GetAllNamedSubjects:output_type -> proto.ArrayReply 1356 | 10, // 82: proto.Casbin.GetAllObjects:output_type -> proto.ArrayReply 1357 | 10, // 83: proto.Casbin.GetAllNamedObjects:output_type -> proto.ArrayReply 1358 | 10, // 84: proto.Casbin.GetAllActions:output_type -> proto.ArrayReply 1359 | 10, // 85: proto.Casbin.GetAllNamedActions:output_type -> proto.ArrayReply 1360 | 10, // 86: proto.Casbin.GetAllRoles:output_type -> proto.ArrayReply 1361 | 10, // 87: proto.Casbin.GetAllNamedRoles:output_type -> proto.ArrayReply 1362 | 5, // 88: proto.Casbin.HasPolicy:output_type -> proto.BoolReply 1363 | 5, // 89: proto.Casbin.HasNamedPolicy:output_type -> proto.BoolReply 1364 | 5, // 90: proto.Casbin.HasGroupingPolicy:output_type -> proto.BoolReply 1365 | 5, // 91: proto.Casbin.HasNamedGroupingPolicy:output_type -> proto.BoolReply 1366 | 10, // 92: proto.Casbin.GetDomains:output_type -> proto.ArrayReply 1367 | 10, // 93: proto.Casbin.GetRolesForUser:output_type -> proto.ArrayReply 1368 | 10, // 94: proto.Casbin.GetImplicitRolesForUser:output_type -> proto.ArrayReply 1369 | 10, // 95: proto.Casbin.GetUsersForRole:output_type -> proto.ArrayReply 1370 | 5, // 96: proto.Casbin.HasRoleForUser:output_type -> proto.BoolReply 1371 | 5, // 97: proto.Casbin.AddRoleForUser:output_type -> proto.BoolReply 1372 | 5, // 98: proto.Casbin.DeleteRoleForUser:output_type -> proto.BoolReply 1373 | 5, // 99: proto.Casbin.DeleteRolesForUser:output_type -> proto.BoolReply 1374 | 5, // 100: proto.Casbin.DeleteUser:output_type -> proto.BoolReply 1375 | 7, // 101: proto.Casbin.DeleteRole:output_type -> proto.EmptyReply 1376 | 14, // 102: proto.Casbin.GetPermissionsForUser:output_type -> proto.Array2DReply 1377 | 14, // 103: proto.Casbin.GetImplicitPermissionsForUser:output_type -> proto.Array2DReply 1378 | 5, // 104: proto.Casbin.DeletePermission:output_type -> proto.BoolReply 1379 | 5, // 105: proto.Casbin.AddPermissionForUser:output_type -> proto.BoolReply 1380 | 5, // 106: proto.Casbin.DeletePermissionForUser:output_type -> proto.BoolReply 1381 | 5, // 107: proto.Casbin.DeletePermissionsForUser:output_type -> proto.BoolReply 1382 | 5, // 108: proto.Casbin.HasPermissionForUser:output_type -> proto.BoolReply 1383 | 55, // [55:109] is the sub-list for method output_type 1384 | 1, // [1:55] is the sub-list for method input_type 1385 | 1, // [1:1] is the sub-list for extension type_name 1386 | 1, // [1:1] is the sub-list for extension extendee 1387 | 0, // [0:1] is the sub-list for field type_name 1388 | } 1389 | 1390 | func init() { file_proto_casbin_proto_init() } 1391 | func file_proto_casbin_proto_init() { 1392 | if File_proto_casbin_proto != nil { 1393 | return 1394 | } 1395 | if !protoimpl.UnsafeEnabled { 1396 | file_proto_casbin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { 1397 | switch v := v.(*NewEnforcerRequest); i { 1398 | case 0: 1399 | return &v.state 1400 | case 1: 1401 | return &v.sizeCache 1402 | case 2: 1403 | return &v.unknownFields 1404 | default: 1405 | return nil 1406 | } 1407 | } 1408 | file_proto_casbin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { 1409 | switch v := v.(*NewEnforcerReply); i { 1410 | case 0: 1411 | return &v.state 1412 | case 1: 1413 | return &v.sizeCache 1414 | case 2: 1415 | return &v.unknownFields 1416 | default: 1417 | return nil 1418 | } 1419 | } 1420 | file_proto_casbin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { 1421 | switch v := v.(*NewAdapterRequest); i { 1422 | case 0: 1423 | return &v.state 1424 | case 1: 1425 | return &v.sizeCache 1426 | case 2: 1427 | return &v.unknownFields 1428 | default: 1429 | return nil 1430 | } 1431 | } 1432 | file_proto_casbin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { 1433 | switch v := v.(*NewAdapterReply); i { 1434 | case 0: 1435 | return &v.state 1436 | case 1: 1437 | return &v.sizeCache 1438 | case 2: 1439 | return &v.unknownFields 1440 | default: 1441 | return nil 1442 | } 1443 | } 1444 | file_proto_casbin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { 1445 | switch v := v.(*EnforceRequest); i { 1446 | case 0: 1447 | return &v.state 1448 | case 1: 1449 | return &v.sizeCache 1450 | case 2: 1451 | return &v.unknownFields 1452 | default: 1453 | return nil 1454 | } 1455 | } 1456 | file_proto_casbin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { 1457 | switch v := v.(*BoolReply); i { 1458 | case 0: 1459 | return &v.state 1460 | case 1: 1461 | return &v.sizeCache 1462 | case 2: 1463 | return &v.unknownFields 1464 | default: 1465 | return nil 1466 | } 1467 | } 1468 | file_proto_casbin_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { 1469 | switch v := v.(*EmptyRequest); i { 1470 | case 0: 1471 | return &v.state 1472 | case 1: 1473 | return &v.sizeCache 1474 | case 2: 1475 | return &v.unknownFields 1476 | default: 1477 | return nil 1478 | } 1479 | } 1480 | file_proto_casbin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { 1481 | switch v := v.(*EmptyReply); i { 1482 | case 0: 1483 | return &v.state 1484 | case 1: 1485 | return &v.sizeCache 1486 | case 2: 1487 | return &v.unknownFields 1488 | default: 1489 | return nil 1490 | } 1491 | } 1492 | file_proto_casbin_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { 1493 | switch v := v.(*PolicyRequest); i { 1494 | case 0: 1495 | return &v.state 1496 | case 1: 1497 | return &v.sizeCache 1498 | case 2: 1499 | return &v.unknownFields 1500 | default: 1501 | return nil 1502 | } 1503 | } 1504 | file_proto_casbin_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { 1505 | switch v := v.(*SimpleGetRequest); i { 1506 | case 0: 1507 | return &v.state 1508 | case 1: 1509 | return &v.sizeCache 1510 | case 2: 1511 | return &v.unknownFields 1512 | default: 1513 | return nil 1514 | } 1515 | } 1516 | file_proto_casbin_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { 1517 | switch v := v.(*ArrayReply); i { 1518 | case 0: 1519 | return &v.state 1520 | case 1: 1521 | return &v.sizeCache 1522 | case 2: 1523 | return &v.unknownFields 1524 | default: 1525 | return nil 1526 | } 1527 | } 1528 | file_proto_casbin_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { 1529 | switch v := v.(*FilteredPolicyRequest); i { 1530 | case 0: 1531 | return &v.state 1532 | case 1: 1533 | return &v.sizeCache 1534 | case 2: 1535 | return &v.unknownFields 1536 | default: 1537 | return nil 1538 | } 1539 | } 1540 | file_proto_casbin_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { 1541 | switch v := v.(*UserRoleRequest); i { 1542 | case 0: 1543 | return &v.state 1544 | case 1: 1545 | return &v.sizeCache 1546 | case 2: 1547 | return &v.unknownFields 1548 | default: 1549 | return nil 1550 | } 1551 | } 1552 | file_proto_casbin_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { 1553 | switch v := v.(*PermissionRequest); i { 1554 | case 0: 1555 | return &v.state 1556 | case 1: 1557 | return &v.sizeCache 1558 | case 2: 1559 | return &v.unknownFields 1560 | default: 1561 | return nil 1562 | } 1563 | } 1564 | file_proto_casbin_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { 1565 | switch v := v.(*Array2DReply); i { 1566 | case 0: 1567 | return &v.state 1568 | case 1: 1569 | return &v.sizeCache 1570 | case 2: 1571 | return &v.unknownFields 1572 | default: 1573 | return nil 1574 | } 1575 | } 1576 | file_proto_casbin_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { 1577 | switch v := v.(*Array2DReplyD); i { 1578 | case 0: 1579 | return &v.state 1580 | case 1: 1581 | return &v.sizeCache 1582 | case 2: 1583 | return &v.unknownFields 1584 | default: 1585 | return nil 1586 | } 1587 | } 1588 | } 1589 | type x struct{} 1590 | out := protoimpl.TypeBuilder{ 1591 | File: protoimpl.DescBuilder{ 1592 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 1593 | RawDescriptor: file_proto_casbin_proto_rawDesc, 1594 | NumEnums: 0, 1595 | NumMessages: 16, 1596 | NumExtensions: 0, 1597 | NumServices: 1, 1598 | }, 1599 | GoTypes: file_proto_casbin_proto_goTypes, 1600 | DependencyIndexes: file_proto_casbin_proto_depIdxs, 1601 | MessageInfos: file_proto_casbin_proto_msgTypes, 1602 | }.Build() 1603 | File_proto_casbin_proto = out.File 1604 | file_proto_casbin_proto_rawDesc = nil 1605 | file_proto_casbin_proto_goTypes = nil 1606 | file_proto_casbin_proto_depIdxs = nil 1607 | } 1608 | --------------------------------------------------------------------------------