diff --git a/components/adminsrv/main.go b/components/adminsrv/main.go index e47485f..c84684f 100644 --- a/components/adminsrv/main.go +++ b/components/adminsrv/main.go @@ -65,7 +65,7 @@ func setup() { viper.SetDefault(rpcPortEnv, 10000) viper.SetDefault(apiPortEnv, 11000) viper.SetDefault(debugPortEnv, 12000) - viper.SetDefault(dbAddr, "localhost:5432") + viper.SetDefault(dbAddrEnv, "localhost:5432") viper.SetDefault(dbNameEnv, "admindb") viper.SetDefault(dbUserEnv, "admindbuser") viper.SetDefault(dbPasswordEnv, "admindbpassword") diff --git a/components/authz/go.mod b/components/authz/go.mod index f52295e..ac6bcee 100644 --- a/components/authz/go.mod +++ b/components/authz/go.mod @@ -3,7 +3,7 @@ module github.com/RafaySystems/rcloud-base/components/authz go 1.17 require ( - github.com/RafaySystems/rcloud-base/components/common v0.0.0-20220110062450-4091fe0a0c20 + github.com/RafaySystems/rcloud-base/components/common v0.0.0-unpublished google.golang.org/grpc v1.43.0 ) @@ -48,7 +48,7 @@ require ( go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.19.1 // indirect golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8 // indirect - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect + golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect diff --git a/components/authz/go.sum b/components/authz/go.sum index 86b1017..f66be15 100644 --- a/components/authz/go.sum +++ b/components/authz/go.sum @@ -6,8 +6,6 @@ github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/RafaySystems/rcloud-base/components/common v0.0.0-20220110062450-4091fe0a0c20 h1:Ad3YKq3gV1yzfvB1YpDlNZg6iyrFfsZTJG2vxw37I9Y= -github.com/RafaySystems/rcloud-base/components/common v0.0.0-20220110062450-4091fe0a0c20/go.mod h1:9m4vhglw6qpW1EqbZ3t0U8LldwA3FhKwVJSTL98Gm54= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -168,8 +166,8 @@ github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGg github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -267,8 +265,8 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211209124913-491a49abca63 h1:iocB37TsdFuN6IBRZ+ry36wrkoV51/tl5vOWqkcPGvY= +golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/components/authz/main.go b/components/authz/main.go index 5e6dc79..6719c73 100644 --- a/components/authz/main.go +++ b/components/authz/main.go @@ -8,7 +8,7 @@ import ( "github.com/RafaySystems/rcloud-base/components/authz/pkg/server" "github.com/RafaySystems/rcloud-base/components/authz/pkg/service" pb "github.com/RafaySystems/rcloud-base/components/authz/proto/rpc/v1" - log "github.com/RafaySystems/rcloud-base/components/common/pkg/log/v2" + log "github.com/RafaySystems/rcloud-base/components/common/pkg/log" "github.com/spf13/viper" "google.golang.org/grpc" "gorm.io/driver/postgres" diff --git a/components/usermgmt/README.md b/components/usermgmt/README.md index a9ac69e..9d6f643 100644 --- a/components/usermgmt/README.md +++ b/components/usermgmt/README.md @@ -8,7 +8,7 @@ All user/auth related requests go through here. ### Run kratos migrations -``` shele +``` shell export DSN='postgres://postgres@localhost:5432/admindb?sslmode=disable' kratos -c kratos.yaml migrate sql -e --yes ``` diff --git a/components/usermgmt/go.mod b/components/usermgmt/go.mod index 75518d3..1830140 100644 --- a/components/usermgmt/go.mod +++ b/components/usermgmt/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/DATA-DOG/go-sqlmock v1.5.0 - github.com/RafaySystems/rcloud-base/components/adminsrv v0.0.0-unpublished + github.com/RafaySystems/rcloud-base/components/authz v0.0.0-unpublished github.com/RafaySystems/rcloud-base/components/common v0.0.0-unpublished github.com/crewjam/saml v0.4.6 github.com/gogo/protobuf v1.3.2 @@ -64,10 +64,10 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.19.1 // indirect - golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect + golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8 // indirect golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect + golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/appengine v1.6.7 // indirect gopkg.in/inf.v0 v0.9.1 // indirect @@ -85,6 +85,6 @@ require ( ) replace ( - github.com/RafaySystems/rcloud-base/components/adminsrv v0.0.0-unpublished => ../adminsrv/ + github.com/RafaySystems/rcloud-base/components/authz v0.0.0-unpublished => ../authz/ github.com/RafaySystems/rcloud-base/components/common v0.0.0-unpublished => ../common/ ) diff --git a/components/usermgmt/go.sum b/components/usermgmt/go.sum index 61d7dd2..87426a4 100644 --- a/components/usermgmt/go.sum +++ b/components/usermgmt/go.sum @@ -71,6 +71,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -103,6 +105,9 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/casbin/casbin/v2 v2.37.4/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= +github.com/casbin/casbin/v2 v2.40.6/go.mod h1:sEL80qBYTbd+BPeL4iyvwYzFT3qwLaESq5aFKVLbLfA= +github.com/casbin/gorm-adapter/v3 v3.4.6/go.mod h1:6mIYgpByH/uSkfCv4G/vr/12cVZc3rXBQ9KrqS9oTUU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= @@ -126,6 +131,7 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= @@ -134,9 +140,11 @@ github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/crewjam/httperr v0.2.0 h1:b2BfXR8U3AlIHwNeFFvZ+BV1LFvKLlzMjzaTnZMybNo= @@ -148,6 +156,7 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5/go.mod h1:GgB8SF9nRG+GqaDtLcwJZsQFhcogVCJ79j4EdT0c2V4= +github.com/denisenkom/go-mssqldb v0.11.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= @@ -211,9 +220,12 @@ github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nA github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= @@ -221,6 +233,7 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.1.0 h1:XUgk2Ex5veyVFVeLm0xhusUTQybEbexJXrvPNOKkSY0= github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= @@ -368,9 +381,48 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1: github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= +github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= +github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= +github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= +github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= +github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= +github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.10.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= +github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= +github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= +github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= +github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= +github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= +github.com/jackc/pgtype v1.8.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= +github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= +github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= +github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= +github.com/jackc/pgx/v4 v4.13.0/go.mod h1:9P4X524sErlaxj0XSGZk7s+LD0eOyu1ZDUrrpznYDF0= +github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= @@ -397,6 +449,7 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/cpuid/v2 v2.0.6 h1:dQ5ueTiftKxp0gyjKSx5+8BtPWkyQbd95m8Gys/RarI= github.com/klauspost/cpuid/v2 v2.0.6/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -406,9 +459,14 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= @@ -420,12 +478,15 @@ github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ github.com/mattermost/xml-roundtrip-validator v0.1.0 h1:RXbVD2UAl7A7nOTR4u7E3ILa4IbtvKBHw64LDsmu9hU= github.com/mattermost/xml-roundtrip-validator v0.1.0/go.mod h1:qccnGMcpgwcNaBnxqpJpWWUiPNr5H3O8eDgGV9gT5To= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= @@ -536,18 +597,25 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= +github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/russellhaering/goxmldsig v1.1.1 h1:vI0r2osGF1A9PLvsGdPUAGwEIrKa4Pj5sesSBsebIxM= github.com/russellhaering/goxmldsig v1.1.1/go.mod h1:gM4MDENBQf7M+V824SGfyIUVFWydB7n0KkEubVJl+Tw= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/segmentio/asm v1.1.0 h1:fkVr8k5J4sKoFjTGVD6r1yKvDKqmvrEh3K7iyVxgBs8= github.com/segmentio/asm v1.1.0/go.mod h1:4EUJGaKsB8ImLUwOGORVsNd9vTRDeh44JGsY4aKp5I4= github.com/segmentio/encoding v0.3.2 h1:gkXXteOfNaPPlrXTEf/e5tWvaQGVJWnvT3LqMzUeH7U= github.com/segmentio/encoding v0.3.2/go.mod h1:waft2p6XI4z2pk07M0YzZV4wEiqaRvsBSyWNHxVx4gU= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= @@ -584,6 +652,7 @@ github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8q github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -618,6 +687,7 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= github.com/zenazn/goji v1.0.1/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= @@ -650,7 +720,10 @@ go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE= go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= @@ -658,9 +731,14 @@ go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpK go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI= @@ -669,6 +747,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -676,10 +756,15 @@ golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8 h1:kACShD3qhmr/3rLmg1yXyt+N4HcwutKyPRB93s54TIU= +golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -735,6 +820,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -813,6 +899,7 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -820,6 +907,7 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -886,8 +974,10 @@ golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211123173158-ef496fb156ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -917,6 +1007,7 @@ golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -924,9 +1015,12 @@ golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -936,6 +1030,7 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -970,6 +1065,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210820212750-d4cc65f0b2ff/go.mod h1:YD9qOF0M9xpSpdWTBbzEl5e/RnCefISl8E5Noe10jFM= +golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1134,6 +1231,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -1159,6 +1257,17 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.0.3/go.mod h1:twGxftLBlFgNVNakL7F+P/x9oYqoymG3YYT8cAfI9oI= +gorm.io/driver/mysql v1.1.2/go.mod h1:4P/X9vSc3WTrhTLZ259cpFd6xKNYiSSdSZngkSBGIMM= +gorm.io/driver/postgres v1.2.2/go.mod h1:Ik3tK+a3FMp8ORZl29v4b3M0RsgXsaeMXh9s9eVMXco= +gorm.io/driver/sqlserver v1.2.1/go.mod h1:nixq0OB3iLXZDiPv6JSOjWuPgpyaRpOIIevYtA4Ulb4= +gorm.io/gorm v1.20.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gorm.io/gorm v1.20.11/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gorm.io/gorm v1.21.12/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= +gorm.io/gorm v1.22.2/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= +gorm.io/gorm v1.22.3/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= +gorm.io/gorm v1.22.5/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/plugin/dbresolver v1.1.0/go.mod h1:tpImigFAEejCALOttyhWqsy4vfa2Uh/vAUVnL5IRF7Y= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= diff --git a/components/usermgmt/internal/models/projectaccountnamespacerole.go b/components/usermgmt/internal/models/projectaccountnamespacerole.go index 08bf67f..74cc93f 100644 --- a/components/usermgmt/internal/models/projectaccountnamespacerole.go +++ b/components/usermgmt/internal/models/projectaccountnamespacerole.go @@ -21,6 +21,6 @@ type ProjectAccountNamespaceRole struct { RoleId uuid.UUID `bun:"role_id,type:uuid"` AccountId uuid.UUID `bun:"account_id,type:uuid"` ProjectId uuid.UUID `bun:"project_id,type:uuid"` - NamesapceId int64 `bun:"namespace_id,type:uuid"` + NamespaceId int64 `bun:"namespace_id,type:uuid"` Active bool `bun:"active,notnull"` } diff --git a/components/usermgmt/internal/models/projectgroupnamespacerole.go b/components/usermgmt/internal/models/projectgroupnamespacerole.go index 810161f..5a10f07 100644 --- a/components/usermgmt/internal/models/projectgroupnamespacerole.go +++ b/components/usermgmt/internal/models/projectgroupnamespacerole.go @@ -21,6 +21,6 @@ type ProjectGroupNamespaceRole struct { RoleId uuid.UUID `bun:"role_id,type:uuid"` GroupId uuid.UUID `bun:"group_id,type:uuid"` ProjectId uuid.UUID `bun:"project_id,type:uuid"` - NamesapceId int64 `bun:"namespace_id,type:uuid"` + NamespaceId int64 `bun:"namespace_id,type:uuid"` Active bool `bun:"active,notnull"` } diff --git a/components/usermgmt/main.go b/components/usermgmt/main.go index 5421e21..57372e9 100644 --- a/components/usermgmt/main.go +++ b/components/usermgmt/main.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "fmt" + "log" "net" "net/http" "sync" @@ -18,6 +19,7 @@ import ( "github.com/uptrace/bun/extra/bundebug" "sigs.k8s.io/controller-runtime/pkg/manager/signals" + authzrpcv1 "github.com/RafaySystems/rcloud-base/components/authz/proto/rpc/v1" "github.com/RafaySystems/rcloud-base/components/common/pkg/auth/interceptors" authv3 "github.com/RafaySystems/rcloud-base/components/common/pkg/auth/v3" "github.com/RafaySystems/rcloud-base/components/common/pkg/gateway" @@ -35,6 +37,7 @@ import ( const ( rpcPortEnv = "RPC_PORT" apiPortEnv = "API_PORT" + authzPortEnv = "AUTHZ_SERVER_PORT" debugPortEnv = "DEBUG_PORT" kratosSchemeEnv = "KRATOS_SCHEME" kratosAddrEnv = "KRATOS_ADDR" @@ -54,7 +57,9 @@ var ( rpcRelayPeeringPort int kratosScheme string kratosAddr string + authzPort int kc *kclient.APIClient + azc authzrpcv1.AuthzClient dbAddr string dbName string dbUser string @@ -80,7 +85,8 @@ func setup() { viper.SetDefault(debugPortEnv, 12000) viper.SetDefault(kratosSchemeEnv, "http") viper.SetDefault(kratosAddrEnv, "localhost:4433") - viper.SetDefault(dbAddr, ":5432") + viper.SetDefault(authzPortEnv, 50011) + viper.SetDefault(dbAddrEnv, "localhost:5432") viper.SetDefault(dbNameEnv, "admindb") viper.SetDefault(dbUserEnv, "admindbuser") viper.SetDefault(dbPasswordEnv, "admindbpassword") @@ -93,6 +99,7 @@ func setup() { viper.BindEnv(debugPortEnv) viper.BindEnv(kratosSchemeEnv) viper.BindEnv(kratosAddrEnv) + viper.BindEnv(authzPortEnv) viper.BindEnv(dbAddrEnv) viper.BindEnv(dbNameEnv) viper.BindEnv(dbPasswordEnv) @@ -106,6 +113,7 @@ func setup() { debugPort = viper.GetInt(debugPortEnv) kratosScheme = viper.GetString(kratosSchemeEnv) kratosAddr = viper.GetString(kratosAddrEnv) + authzPort = viper.GetInt(authzPortEnv) dbAddr = viper.GetString(dbAddrEnv) dbName = viper.GetString(dbNameEnv) dbUser = viper.GetString(dbUserEnv) @@ -120,7 +128,7 @@ func setup() { kratosConfig.Servers[0].URL = kratosUrl kc = kclient.NewAPIClient(kratosConfig) - dsn := "postgres://admindbuser:admindbpassword@localhost:5432/admindb?sslmode=disable" + dsn := "postgres://" + dbUser + ":" + dbPassword + "@" + dbAddr + "/" + dbName + "?sslmode=disable" sqldb := sql.OpenDB(pgdriver.NewConnector(pgdriver.WithDSN(dsn))) db := bun.NewDB(sqldb, pgdialect.New()) @@ -131,9 +139,15 @@ func setup() { )) } - us = service.NewUserService(providers.NewKratosAuthProvider(kc), db) - gs = service.NewGroupService(db) - rs = service.NewRoleService(db) + conn, err := grpc.Dial(":"+fmt.Sprint(authzPort), grpc.WithInsecure()) + if err != nil { + log.Fatal("unable to connect to authz") + } + azc = authzrpcv1.NewAuthzClient(conn) + + us = service.NewUserService(providers.NewKratosAuthProvider(kc), db, azc) + gs = service.NewGroupService(db, azc) + rs = service.NewRoleService(db, azc) rrs = service.NewRolepermissionService(db) is = service.NewIdpService(db, appHostHTTP) ps = service.NewOIDCProviderService(db, kratosUrl) diff --git a/components/usermgmt/master.rest b/components/usermgmt/master.rest index 2ba4753..58ddf6e 100644 --- a/components/usermgmt/master.rest +++ b/components/usermgmt/master.rest @@ -56,6 +56,8 @@ metadata: spec: firstName: John lastName: Cena + projectNamespaceRoles: + - role: ADMIN # Delete single user DELETE :host/auth/v3/user/:user @@ -111,8 +113,7 @@ spec: users: - :user projectNamespaceRoles: - - role: NAMESPACE_ADMIN - project: :project + - role: ADMIN # Get all groups @@ -127,14 +128,41 @@ Content-Type: application/yaml DELETE :host/auth/v3/partner/:partner/organization/:org/group/:group Content-Type: application/yaml - ## Roles -# Create role - +# Create empty role POST :host/auth/v3/partner/:partner/organization/:org/roles Content-Type: application/yaml +metadata: + name: :role + description: My first role + partner: :partner + organization: :org +spec: + isGlobal: true + scope: cluster + +# Create role +POST :host/auth/v3/partner/:partner/organization/:org/roles +Content-Type: application/yaml + +metadata: + name: :role + description: My first role + partner: :partner + organization: :org +spec: + isGlobal: true + scope: cluster + rolepermissions: + - account.read + - ops_star.all + +# Update role +PUT :host/auth/v3/partner/:partner/organization/:org/role/:role +Content-Type: application/yaml + metadata: name: :role description: My first role diff --git a/components/usermgmt/pkg/server/group.go b/components/usermgmt/pkg/server/group.go index fbde71e..5a839a2 100644 --- a/components/usermgmt/pkg/server/group.go +++ b/components/usermgmt/pkg/server/group.go @@ -3,9 +3,11 @@ package server import ( "context" + v3 "github.com/RafaySystems/rcloud-base/components/common/proto/types/commonpb/v3" "github.com/RafaySystems/rcloud-base/components/usermgmt/pkg/service" rpcv3 "github.com/RafaySystems/rcloud-base/components/usermgmt/proto/rpc/v3" userpbv3 "github.com/RafaySystems/rcloud-base/components/usermgmt/proto/types/userpb/v3" + "google.golang.org/protobuf/types/known/timestamppb" ) type groupServer struct { @@ -17,22 +19,39 @@ func NewGroupServer(ps service.GroupService) rpcv3.GroupServer { return &groupServer{ps} } -func (s *groupServer) CreateGroup(ctx context.Context, p *userpbv3.Group) (*userpbv3.Group, error) { - return s.Create(ctx, p) +func updateGroupStatus(req *userpbv3.Group, resp *userpbv3.Group, err error) *userpbv3.Group { + if err != nil { + req.Status = &v3.Status{ + ConditionStatus: v3.ConditionStatus_StatusFailed, + LastUpdated: timestamppb.Now(), + Reason: err.Error(), + } + return req + } + resp.Status = &v3.Status{ConditionStatus: v3.ConditionStatus_StatusOK} + return resp } -func (s *groupServer) GetGroups(ctx context.Context, p *userpbv3.Group) (*userpbv3.GroupList, error) { - return s.List(ctx, p) +func (s *groupServer) CreateGroup(ctx context.Context, req *userpbv3.Group) (*userpbv3.Group, error) { + resp, err := s.Create(ctx, req) + return updateGroupStatus(req, resp, err), err } -func (s *groupServer) GetGroup(ctx context.Context, p *userpbv3.Group) (*userpbv3.Group, error) { - return s.GetByName(ctx, p) +func (s *groupServer) GetGroups(ctx context.Context, req *userpbv3.Group) (*userpbv3.GroupList, error) { + return s.List(ctx, req) } -func (s *groupServer) DeleteGroup(ctx context.Context, p *userpbv3.Group) (*userpbv3.Group, error) { - return s.Delete(ctx, p) +func (s *groupServer) GetGroup(ctx context.Context, req *userpbv3.Group) (*userpbv3.Group, error) { + resp, err := s.GetByName(ctx, req) + return updateGroupStatus(req, resp, err), err } -func (s *groupServer) UpdateGroup(ctx context.Context, p *userpbv3.Group) (*userpbv3.Group, error) { - return s.Update(ctx, p) +func (s *groupServer) DeleteGroup(ctx context.Context, req *userpbv3.Group) (*userpbv3.Group, error) { + resp, err := s.Delete(ctx, req) + return updateGroupStatus(req, resp, err), err +} + +func (s *groupServer) UpdateGroup(ctx context.Context, req *userpbv3.Group) (*userpbv3.Group, error) { + resp, err := s.Update(ctx, req) + return updateGroupStatus(req, resp, err), err } diff --git a/components/usermgmt/pkg/server/role.go b/components/usermgmt/pkg/server/role.go index 192ee69..98b6380 100644 --- a/components/usermgmt/pkg/server/role.go +++ b/components/usermgmt/pkg/server/role.go @@ -3,9 +3,11 @@ package server import ( "context" + v3 "github.com/RafaySystems/rcloud-base/components/common/proto/types/commonpb/v3" "github.com/RafaySystems/rcloud-base/components/usermgmt/pkg/service" rpcv3 "github.com/RafaySystems/rcloud-base/components/usermgmt/proto/rpc/v3" userpbv3 "github.com/RafaySystems/rcloud-base/components/usermgmt/proto/types/userpb/v3" + "google.golang.org/protobuf/types/known/timestamppb" ) type roleServer struct { @@ -17,22 +19,39 @@ func NewRoleServer(ps service.RoleService) rpcv3.RoleServer { return &roleServer{ps} } -func (s *roleServer) CreateRole(ctx context.Context, p *userpbv3.Role) (*userpbv3.Role, error) { - return s.Create(ctx, p) +func updateRoleStatus(req *userpbv3.Role, resp *userpbv3.Role, err error) *userpbv3.Role { + if err != nil { + req.Status = &v3.Status{ + ConditionStatus: v3.ConditionStatus_StatusFailed, + LastUpdated: timestamppb.Now(), + Reason: err.Error(), + } + return req + } + resp.Status = &v3.Status{ConditionStatus: v3.ConditionStatus_StatusOK} + return resp } -func (s *roleServer) GetRoles(ctx context.Context, p *userpbv3.Role) (*userpbv3.RoleList, error) { - return s.List(ctx, p) +func (s *roleServer) CreateRole(ctx context.Context, req *userpbv3.Role) (*userpbv3.Role, error) { + resp, err := s.Create(ctx, req) + return updateRoleStatus(req, resp, err), err } -func (s *roleServer) GetRole(ctx context.Context, p *userpbv3.Role) (*userpbv3.Role, error) { - return s.GetByName(ctx, p) +func (s *roleServer) GetRoles(ctx context.Context, req *userpbv3.Role) (*userpbv3.RoleList, error) { + return s.List(ctx, req) } -func (s *roleServer) DeleteRole(ctx context.Context, p *userpbv3.Role) (*userpbv3.Role, error) { - return s.Delete(ctx, p) +func (s *roleServer) GetRole(ctx context.Context, req *userpbv3.Role) (*userpbv3.Role, error) { + resp, err := s.GetByName(ctx, req) + return updateRoleStatus(req, resp, err), err } -func (s *roleServer) UpdateRole(ctx context.Context, p *userpbv3.Role) (*userpbv3.Role, error) { - return s.Update(ctx, p) +func (s *roleServer) DeleteRole(ctx context.Context, req *userpbv3.Role) (*userpbv3.Role, error) { + resp, err := s.Delete(ctx, req) + return updateRoleStatus(req, resp, err), err +} + +func (s *roleServer) UpdateRole(ctx context.Context, req *userpbv3.Role) (*userpbv3.Role, error) { + resp, err := s.Update(ctx, req) + return updateRoleStatus(req, resp, err), err } diff --git a/components/usermgmt/pkg/server/user.go b/components/usermgmt/pkg/server/user.go index 0b1e929..2b6e9f1 100644 --- a/components/usermgmt/pkg/server/user.go +++ b/components/usermgmt/pkg/server/user.go @@ -3,9 +3,11 @@ package server import ( "context" + v3 "github.com/RafaySystems/rcloud-base/components/common/proto/types/commonpb/v3" "github.com/RafaySystems/rcloud-base/components/usermgmt/pkg/service" rpcv3 "github.com/RafaySystems/rcloud-base/components/usermgmt/proto/rpc/v3" userpbv3 "github.com/RafaySystems/rcloud-base/components/usermgmt/proto/types/userpb/v3" + "google.golang.org/protobuf/types/known/timestamppb" ) type userServer struct { @@ -16,23 +18,38 @@ type userServer struct { func NewUserServer(ps service.UserService) rpcv3.UserServer { return &userServer{ps} } - -func (s *userServer) CreateUser(ctx context.Context, p *userpbv3.User) (*userpbv3.User, error) { - return s.Create(ctx, p) +func updateUserStatus(req *userpbv3.User, resp *userpbv3.User, err error) *userpbv3.User { + if err != nil { + req.Status = &v3.Status{ + ConditionStatus: v3.ConditionStatus_StatusFailed, + LastUpdated: timestamppb.Now(), + Reason: err.Error(), + } + return req + } + resp.Status = &v3.Status{ConditionStatus: v3.ConditionStatus_StatusOK} + return resp } -func (s *userServer) GetUsers(ctx context.Context, p *userpbv3.User) (*userpbv3.UserList, error) { - return s.List(ctx, p) +func (s *userServer) CreateUser(ctx context.Context, req *userpbv3.User) (*userpbv3.User, error) { + resp, err := s.Create(ctx, req) + return updateUserStatus(req, resp, err), err } -func (s *userServer) GetUser(ctx context.Context, p *userpbv3.User) (*userpbv3.User, error) { - return s.GetByName(ctx, p) +func (s *userServer) GetUsers(ctx context.Context, req *userpbv3.User) (*userpbv3.UserList, error) { + return s.List(ctx, req) } -func (s *userServer) DeleteUser(ctx context.Context, p *userpbv3.User) (*rpcv3.DeleteUserResponse, error) { - return s.Delete(ctx, p) +func (s *userServer) GetUser(ctx context.Context, req *userpbv3.User) (*userpbv3.User, error) { + resp, err := s.GetByName(ctx, req) + return updateUserStatus(req, resp, err), err } -func (s *userServer) UpdateUser(ctx context.Context, p *userpbv3.User) (*userpbv3.User, error) { - return s.Update(ctx, p) +func (s *userServer) DeleteUser(ctx context.Context, req *userpbv3.User) (*rpcv3.DeleteUserResponse, error) { + return s.Delete(ctx, req) +} + +func (s *userServer) UpdateUser(ctx context.Context, req *userpbv3.User) (*userpbv3.User, error) { + resp, err := s.Update(ctx, req) + return updateUserStatus(req, resp, err), err } diff --git a/components/usermgmt/pkg/server/utils.go b/components/usermgmt/pkg/server/utils.go new file mode 100644 index 0000000..e631d50 --- /dev/null +++ b/components/usermgmt/pkg/server/utils.go @@ -0,0 +1,20 @@ +package server + +import ( + v3 "github.com/RafaySystems/rcloud-base/components/common/proto/types/commonpb/v3" + + "google.golang.org/protobuf/types/known/timestamppb" +) + +func getStatus(err error) *v3.Status { + if err != nil { + return &v3.Status{ + ConditionStatus: v3.ConditionStatus_StatusFailed, + LastUpdated: timestamppb.Now(), + Reason: err.Error(), + } + } + return &v3.Status{ + ConditionStatus: v3.ConditionStatus_StatusOK, + } +} diff --git a/components/usermgmt/pkg/service/group.go b/components/usermgmt/pkg/service/group.go index 0822bbf..70184ce 100644 --- a/components/usermgmt/pkg/service/group.go +++ b/components/usermgmt/pkg/service/group.go @@ -3,8 +3,11 @@ package service import ( "context" "fmt" + "strconv" "time" + authzrpcv1 "github.com/RafaySystems/rcloud-base/components/authz/proto/rpc/v1" + authzv1 "github.com/RafaySystems/rcloud-base/components/authz/proto/types" "github.com/RafaySystems/rcloud-base/components/common/pkg/persistence/provider/pg" "github.com/RafaySystems/rcloud-base/components/common/pkg/utils" v3 "github.com/RafaySystems/rcloud-base/components/common/proto/types/commonpb/v3" @@ -43,34 +46,38 @@ type groupService struct { dao pg.EntityDAO gdao dao.GroupDAO l utils.Lookup + azc authzrpcv1.AuthzClient } // NewGroupService return new group service -func NewGroupService(db *bun.DB) GroupService { +func NewGroupService(db *bun.DB, azc authzrpcv1.AuthzClient) GroupService { return &groupService{ dao: pg.NewEntityDAO(db), gdao: dao.NewGroupDAO(db), l: utils.NewLookup(db), + azc: azc, } } func (s *groupService) deleteGroupRoleRelaitons(ctx context.Context, groupId uuid.UUID, group *userv3.Group) (*userv3.Group, error) { // delete previous entries - // TODO: maybe do a diff and selectively delete? + // TODO: single delete command err := s.dao.DeleteX(ctx, "group_id", groupId, &models.GroupRole{}) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } err = s.dao.DeleteX(ctx, "group_id", groupId, &models.ProjectGroupRole{}) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } err = s.dao.DeleteX(ctx, "group_id", groupId, &models.ProjectGroupNamespaceRole{}) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err + } + + _, err = s.azc.DeletePolicies(ctx, &authzv1.Policy{Sub: "g:" + group.GetMetadata().GetName()}) + if err != nil { + return &userv3.Group{}, fmt.Errorf("unable to delete gorup-role relations from authz; %v", err) } return group, nil } @@ -83,54 +90,56 @@ func (s *groupService) createGroupRoleRelations(ctx context.Context, group *user var pgnrs []models.ProjectGroupNamespaceRole var pgrs []models.ProjectGroupRole var grs []models.GroupRole + var ps []*authzv1.Policy for _, pnr := range projectNamespaceRoles { role := pnr.GetRole() entity, err := s.dao.GetIdByName(ctx, role, &models.Role{}) if err != nil { - group.Status = statusFailed(fmt.Errorf("unable to find role '%v'", role)) - return group, err + return &userv3.Group{}, fmt.Errorf("unable to find role '%v'", role) } var roleId uuid.UUID if rle, ok := entity.(*models.Role); ok { roleId = rle.ID } else { - group.Status = statusFailed(fmt.Errorf("unable to find role '%v'", role)) - return group, err + return &userv3.Group{}, fmt.Errorf("unable to find role '%v'", role) } project := pnr.GetProject() + org := group.GetMetadata().GetOrganization() namespaceId := pnr.GetNamespace() // TODO: lookup id from name switch { case namespaceId != 0: projectId, err := s.l.GetProjectId(ctx, project) if err != nil { - group.Status = statusFailed(fmt.Errorf("unable to find project '%v'", project)) - return group, err + return &userv3.Group{}, fmt.Errorf("unable to find project '%v'", project) } pgnr := models.ProjectGroupNamespaceRole{ - CreatedAt: time.Now(), // TODO: could drop this as it is default - ModifiedAt: time.Now(), Trash: false, RoleId: roleId, PartnerId: ids.Partner, OrganizationId: ids.Organization, GroupId: ids.Id, ProjectId: projectId, - NamesapceId: namespaceId, + NamespaceId: namespaceId, Active: true, } pgnrs = append(pgnrs, pgnr) + + ps = append(ps, &authzv1.Policy{ + Sub: "g:" + group.GetMetadata().GetName(), + Ns: strconv.FormatInt(namespaceId, 10), + Proj: project, + Org: org, + Obj: role, + Act: "*", + }) case project != "": projectId, err := s.l.GetProjectId(ctx, project) if err != nil { - group.Status = statusFailed(fmt.Errorf("unable to find project '%v'", project)) - return group, err + return &userv3.Group{}, fmt.Errorf("unable to find project '%v'", project) } pgr := models.ProjectGroupRole{ - CreatedAt: time.Now(), - ModifiedAt: time.Now(), Trash: false, - Default: true, // TODO: what is this for? RoleId: roleId, PartnerId: ids.Partner, OrganizationId: ids.Organization, @@ -139,12 +148,18 @@ func (s *groupService) createGroupRoleRelations(ctx context.Context, group *user Active: true, } pgrs = append(pgrs, pgr) + + ps = append(ps, &authzv1.Policy{ + Sub: "g:" + group.GetMetadata().GetName(), + Ns: "*", + Proj: project, + Org: org, + Obj: role, + Act: "*", + }) default: gr := models.GroupRole{ - CreatedAt: time.Now(), - ModifiedAt: time.Now(), Trash: false, - Default: true, // TODO: what is this for? RoleId: roleId, PartnerId: ids.Partner, OrganizationId: ids.Organization, @@ -152,24 +167,39 @@ func (s *groupService) createGroupRoleRelations(ctx context.Context, group *user Active: true, } grs = append(grs, gr) + ps = append(ps, &authzv1.Policy{ + Sub: "g:" + group.GetMetadata().GetName(), + Ns: "*", + Proj: "*", + Org: org, + Obj: role, + Act: "*", + }) } } if len(pgnrs) > 0 { _, err := s.dao.Create(ctx, &pgnrs) if err != nil { - return group, err + return &userv3.Group{}, err } } if len(pgrs) > 0 { _, err := s.dao.Create(ctx, &pgrs) if err != nil { - return group, err + return &userv3.Group{}, err } } if len(grs) > 0 { _, err := s.dao.Create(ctx, &grs) if err != nil { - return group, err + return &userv3.Group{}, err + } + } + + if len(ps) > 0 { + success, err := s.azc.CreatePolicies(ctx, &authzv1.Policies{Policies: ps}) + if err != nil || !success.Res { + return &userv3.Group{}, fmt.Errorf("unable to create mapping in authz; %v", err) } } @@ -179,8 +209,12 @@ func (s *groupService) createGroupRoleRelations(ctx context.Context, group *user func (s *groupService) deleteGroupAccountRelations(ctx context.Context, groupId uuid.UUID, group *userv3.Group) (*userv3.Group, error) { err := s.dao.DeleteX(ctx, "group_id", groupId, &models.GroupAccount{}) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, fmt.Errorf("unable to delete user; %v", err) + } + + _, err = s.azc.DeleteUserGroups(ctx, &authzv1.UserGroup{Grp: group.GetMetadata().GetName()}) + if err != nil { + return &userv3.Group{}, fmt.Errorf("unable to delete gorup-user relations from authz; %v", err) } return group, nil } @@ -189,11 +223,12 @@ func (s *groupService) deleteGroupAccountRelations(ctx context.Context, groupId func (s *groupService) createGroupAccountRelations(ctx context.Context, groupId uuid.UUID, group *userv3.Group) (*userv3.Group, error) { // TODO: add transactions var grpaccs []models.GroupAccount + var ugs []*authzv1.UserGroup for _, account := range group.GetSpec().GetUsers() { // FIXME: do combined lookup entity, err := s.dao.GetIdByTraits(ctx, account, &models.KratosIdentities{}) if err != nil { - return group, fmt.Errorf("unable to find user '%v'", account) + return &userv3.Group{}, fmt.Errorf("unable to find user '%v'", account) } if acc, ok := entity.(*models.KratosIdentities); ok { grp := models.GroupAccount{ @@ -205,6 +240,10 @@ func (s *groupService) createGroupAccountRelations(ctx context.Context, groupId Active: true, } grpaccs = append(grpaccs, grp) + ugs = append(ugs, &authzv1.UserGroup{ + Grp: "g:" + group.GetMetadata().GetName(), + User: "u:" + account, + }) } } if len(grpaccs) == 0 { @@ -212,9 +251,16 @@ func (s *groupService) createGroupAccountRelations(ctx context.Context, groupId } _, err := s.dao.Create(ctx, &grpaccs) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } + + // TODO: revert our db inserts if this fails + // Just FYI, the succcess can be false if we delete the db directly but casbin has it available internally + success, err := s.azc.CreateUserGroups(ctx, &authzv1.UserGroups{UserGroups: ugs}) + if err != nil || !success.Res { + return &userv3.Group{}, fmt.Errorf("unable to create mapping in authz; %v", err) + } + return group, nil } @@ -255,30 +301,24 @@ func (s *groupService) Create(ctx context.Context, group *userv3.Group) (*userv3 } entity, err := s.dao.Create(ctx, &grp) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } //update v3 spec if grp, ok := entity.(*models.Group); ok { - // TODO: optimize deletes // we can get previous group using the id, find users/roles from that and delete those group, err = s.createGroupAccountRelations(ctx, grp.ID, group) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } group, err = s.createGroupRoleRelations(ctx, group, parsedIds{Id: grp.ID, Partner: partnerId, Organization: organizationId}) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } - group.Status = statusOK() return group, nil } - group.Status = statusFailed(fmt.Errorf("unable to create group")) - return group, fmt.Errorf("unable to create group") + return &userv3.Group{}, fmt.Errorf("unable to create group") } func (s *groupService) toV3Group(ctx context.Context, group *userv3.Group, grp *models.Group) (*userv3.Group, error) { @@ -298,7 +338,7 @@ func (s *groupService) toV3Group(ctx context.Context, group *userv3.Group, grp * } users, err := s.gdao.GetUsers(ctx, grp.ID) if err != nil { - return group, err + return &userv3.Group{}, err } userNames := []string{} for _, u := range users { @@ -307,15 +347,13 @@ func (s *groupService) toV3Group(ctx context.Context, group *userv3.Group, grp * roles, err := s.gdao.GetRoles(ctx, grp.ID) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } group.Spec = &userv3.GroupSpec{ Type: grp.Type, Users: userNames, ProjectNamespaceRoles: roles, } - group.Status = statusOK() return group, nil } @@ -323,13 +361,11 @@ func (s *groupService) GetByID(ctx context.Context, group *userv3.Group) (*userv id := group.GetMetadata().GetId() uid, err := uuid.Parse(id) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } entity, err := s.dao.GetByID(ctx, uid, &models.Group{}) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } if grp, ok := entity.(*models.Group); ok { @@ -347,8 +383,7 @@ func (s *groupService) GetByName(ctx context.Context, group *userv3.Group) (*use } entity, err := s.dao.GetByNamePartnerOrg(ctx, name, uuid.NullUUID{UUID: partnerId, Valid: true}, uuid.NullUUID{UUID: organizationId, Valid: true}, &models.Group{}) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } if grp, ok := entity.(*models.Group); ok { @@ -367,8 +402,7 @@ func (s *groupService) Update(ctx context.Context, group *userv3.Group) (*userv3 } entity, err := s.dao.GetByNamePartnerOrg(ctx, name, uuid.NullUUID{UUID: partnerId, Valid: true}, uuid.NullUUID{UUID: organizationId, Valid: true}, &models.Group{}) if err != nil { - group.Status = statusFailed(fmt.Errorf("no group found with name '%v'", name)) - return group, err + return &userv3.Group{}, fmt.Errorf("no group found with name '%v'", name) } if grp, ok := entity.(*models.Group); ok { @@ -381,29 +415,24 @@ func (s *groupService) Update(ctx context.Context, group *userv3.Group) (*userv3 // update account/role links group, err = s.deleteGroupAccountRelations(ctx, grp.ID, group) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } group, err = s.createGroupAccountRelations(ctx, grp.ID, group) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } group, err = s.deleteGroupRoleRelaitons(ctx, grp.ID, group) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } group, err = s.createGroupRoleRelations(ctx, group, parsedIds{Id: grp.ID, Partner: partnerId, Organization: organizationId}) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } _, err = s.dao.Update(ctx, grp.ID, grp) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } // update spec and status @@ -412,7 +441,6 @@ func (s *groupService) Update(ctx context.Context, group *userv3.Group) (*userv3 Users: group.Spec.Users, // TODO: update from db resp or no update? ProjectNamespaceRoles: group.Spec.ProjectNamespaceRoles, } - group.Status = statusOK() } return group, nil @@ -422,34 +450,25 @@ func (s *groupService) Delete(ctx context.Context, group *userv3.Group) (*userv3 name := group.GetMetadata().GetName() partnerId, organizationId, err := s.getPartnerOrganization(ctx, group) if err != nil { - group.Status = statusFailed(fmt.Errorf("unable to get partner and org id")) - return group, fmt.Errorf("unable to get partner and org id") + return &userv3.Group{}, fmt.Errorf("unable to get partner and org id") } entity, err := s.dao.GetByNamePartnerOrg(ctx, name, uuid.NullUUID{UUID: partnerId, Valid: true}, uuid.NullUUID{UUID: organizationId, Valid: true}, &models.Group{}) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } if grp, ok := entity.(*models.Group); ok { group, err = s.deleteGroupRoleRelaitons(ctx, grp.ID, group) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } group, err = s.deleteGroupAccountRelations(ctx, grp.ID, group) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } err = s.dao.Delete(ctx, grp.ID, grp) if err != nil { - group.Status = statusFailed(err) - return group, err + return &userv3.Group{}, err } - //update v3 spec - group.Metadata.Id = grp.ID.String() - group.Metadata.Name = grp.Name - group.Status = statusOK() } return group, nil diff --git a/components/usermgmt/pkg/service/group_test.go b/components/usermgmt/pkg/service/group_test.go index 5d5f654..942c887 100644 --- a/components/usermgmt/pkg/service/group_test.go +++ b/components/usermgmt/pkg/service/group_test.go @@ -39,8 +39,46 @@ func performGroupBasicChecks(t *testing.T, group *userv3.Group, guuid string) { if group.GetMetadata().GetName() != "group-"+guuid { t.Error("invalid name returned") } - if group.Status.ConditionStatus != v3.ConditionStatus_StatusOK { - t.Error("group status is not OK") +} + +func performGroupBasicAuthzChecks(t *testing.T, mazc mockAuthzClient, guuid string, users []string, roles []*userv3.ProjectNamespaceRole) { + if len(mazc.cug) > 0 { + for i, u := range mazc.cug[len(mazc.cug)-1].UserGroups { + if u.User != "u:"+users[i] { + t.Errorf("invalid user sent to authz; expected 'u:%v', got '%v'", users[i], u.User) + } + if u.Grp != "g:group-"+guuid { + t.Errorf("invalid group sent to authz; expected 'g:group-%v', got '%v'", guuid, u.Grp) + } + } + } + if len(mazc.cp) > 0 { + for i, u := range mazc.cp[len(mazc.cp)-1].Policies { + if u.Sub != "g:group-"+guuid { + t.Errorf("invalid sub in policy sent to authz; expected '%v', got '%v'", "g:group-"+guuid, u.Sub) + } + if u.Obj != roles[i].Role { + t.Errorf("invalid obj in policy sent to authz; expected '%v', got '%v'", roles[i].Role, u.Obj) + } + if roles[i].Namespace != nil { + if u.Ns != fmt.Sprint(*roles[i].Namespace) { + t.Errorf("invalid ns in policy sent to authz; expected '%v', got '%v'", fmt.Sprint(roles[i].Namespace), u.Ns) + } + } else { + if u.Ns != "*" { + t.Errorf("invalid ns in policy sent to authz; expected '%v', got '%v'", "*", u.Ns) + } + } + if roles[i].Project != nil { + if u.Proj != *roles[i].Project { + t.Errorf("invalid proj in policy sent to authz; expected '%v', got '%v'", roles[i].Project, u.Proj) + } + } else { + if u.Proj != "*" { + t.Errorf("invalid proj in policy sent to authz; expected '%v', got '%v'", "*", u.Proj) + } + } + } } } @@ -48,20 +86,20 @@ func TestCreateGroupNoUsersNoRoles(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid := uuid.New().String() puuid := uuid.New().String() - fmt.Println("puuid:", puuid) ouuid := uuid.New().String() - fmt.Println("ouuid:", ouuid) mock.ExpectQuery(`SELECT "partner"."id" FROM "authsrv_partner" AS "partner"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(puuid)) mock.ExpectQuery(`SELECT "organization"."id" FROM "authsrv_organization" AS "organization"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ouuid)) - mock.ExpectQuery(`SELECT "group"."id" FROM "authsrv_group" AS "group" WHERE .organization_id = '` + ouuid + `'. AND .partner_id = '` + puuid + `'. AND .name = 'group-` + guuid + `'.`).WithArgs() + mock.ExpectQuery(`SELECT "group"."id" FROM "authsrv_group" AS "group" WHERE .organization_id = '` + ouuid + `'. AND .partner_id = '` + puuid + `'. AND .name = 'group-` + guuid + `'.`). + WillReturnError(fmt.Errorf("no data available")) mock.ExpectQuery(`INSERT INTO "authsrv_group"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(guuid)) @@ -74,13 +112,16 @@ func TestCreateGroupNoUsersNoRoles(t *testing.T) { t.Fatal("could not create group:", err) } performGroupBasicChecks(t, group, guuid) + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 0, 0) + performGroupBasicAuthzChecks(t, mazc, guuid, []string{}, []*userv3.ProjectNamespaceRole{}) } func TestCreateGroupDuplicate(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid := uuid.New().String() @@ -106,6 +147,8 @@ func TestCreateGroupDuplicate(t *testing.T) { if err == nil { t.Fatal("should not be able to recreate group with same name") } + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 0, 0) + performGroupBasicAuthzChecks(t, mazc, guuid, []string{}, []*userv3.ProjectNamespaceRole{}) } func TestCreateGroupWithUsersNoRoles(t *testing.T) { @@ -121,7 +164,8 @@ func TestCreateGroupWithUsersNoRoles(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid := uuid.New().String() @@ -133,7 +177,8 @@ func TestCreateGroupWithUsersNoRoles(t *testing.T) { WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(puuid)) mock.ExpectQuery(`SELECT "organization"."id" FROM "authsrv_organization" AS "organization"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ouuid)) - mock.ExpectQuery(`SELECT "group"."id" FROM "authsrv_group" AS "group" WHERE .organization_id = '` + ouuid + `'. AND .partner_id = '` + puuid + `'. AND .name = 'group-` + guuid + `'.`).WithArgs() + mock.ExpectQuery(`SELECT "group"."id" FROM "authsrv_group" AS "group" WHERE .organization_id = '` + ouuid + `'. AND .partner_id = '` + puuid + `'. AND .name = 'group-` + guuid + `'.`). + WillReturnError(fmt.Errorf("no data available")) mock.ExpectQuery(`INSERT INTO "authsrv_group"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(guuid)) for _, u := range tc.users { @@ -157,6 +202,8 @@ func TestCreateGroupWithUsersNoRoles(t *testing.T) { t.Errorf("user id '%v' not found in resource response", tc.users[i]) } } + performBasicAuthzChecks(t, mazc, 0, 0, 1, 0, 0, 0) + performGroupBasicAuthzChecks(t, mazc, guuid, tc.users, []*userv3.ProjectNamespaceRole{}) }) } } @@ -182,7 +229,8 @@ func TestCreateGroupNoUsersWithRoles(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid := uuid.New().String() @@ -195,7 +243,8 @@ func TestCreateGroupNoUsersWithRoles(t *testing.T) { WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(puuid)) mock.ExpectQuery(`SELECT "organization"."id" FROM "authsrv_organization" AS "organization"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ouuid)) - mock.ExpectQuery(`SELECT "group"."id" FROM "authsrv_group" AS "group" WHERE .organization_id = '` + ouuid + `'. AND .partner_id = '` + puuid + `'. AND .name = 'group-` + guuid + `'.`).WithArgs() + mock.ExpectQuery(`SELECT "group"."id" FROM "authsrv_group" AS "group" WHERE .organization_id = '` + ouuid + `'. AND .partner_id = '` + puuid + `'. AND .name = 'group-` + guuid + `'.`). + WillReturnError(fmt.Errorf("no data available")) mock.ExpectQuery(`INSERT INTO "authsrv_group"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(guuid)) mock.ExpectQuery(`SELECT "resourcerole"."id" FROM "authsrv_resourcerole" AS "resourcerole"`). @@ -229,6 +278,8 @@ func TestCreateGroupNoUsersWithRoles(t *testing.T) { t.Errorf("role '%v' not found in resource response", tc.roles[i]) } } + performBasicAuthzChecks(t, mazc, 1, 0, 0, 0, 0, 0) + performGroupBasicAuthzChecks(t, mazc, guuid, []string{}, tc.roles) }) } } @@ -255,7 +306,8 @@ func TestCreateGroupWithUsersWithRoles(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid := uuid.New().String() @@ -315,6 +367,8 @@ func TestCreateGroupWithUsersWithRoles(t *testing.T) { t.Errorf("role '%v' not found in resource response", tc.roles[i]) } } + performBasicAuthzChecks(t, mazc, 1, 0, 1, 0, 0, 0) + performGroupBasicAuthzChecks(t, mazc, guuid, tc.users, tc.roles) }) } } @@ -333,7 +387,8 @@ func TestUpdateGroupWithUsersWithRoles(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid := uuid.New().String() @@ -395,6 +450,8 @@ func TestUpdateGroupWithUsersWithRoles(t *testing.T) { t.Errorf("role '%v' not found in resource response", tc.roles[i]) } } + performBasicAuthzChecks(t, mazc, 1, 1, 1, 1, 0, 0) + performGroupBasicAuthzChecks(t, mazc, guuid, tc.users, tc.roles) }) } } @@ -403,7 +460,8 @@ func TestGroupDelete(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid := uuid.New().String() @@ -441,7 +499,8 @@ func TestGroupDeleteNonExist(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid := uuid.New().String() @@ -464,7 +523,8 @@ func TestGroupGetByName(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid := uuid.New().String() @@ -514,7 +574,8 @@ func TestGroupGetById(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid := uuid.New().String() @@ -560,7 +621,8 @@ func TestGroupList(t *testing.T) { db, mock := getDB(t) defer db.Close() - gs := NewGroupService(db) + mazc := mockAuthzClient{} + gs := NewGroupService(db, &mazc) defer gs.Close() guuid1 := uuid.New().String() diff --git a/components/usermgmt/pkg/service/mocks.go b/components/usermgmt/pkg/service/mocks.go new file mode 100644 index 0000000..b6ac322 --- /dev/null +++ b/components/usermgmt/pkg/service/mocks.go @@ -0,0 +1,83 @@ +package service + +import ( + "context" + "strings" + + types "github.com/RafaySystems/rcloud-base/components/authz/proto/types" + "google.golang.org/grpc" +) + +type ApUpdate struct { + id string + traits map[string]interface{} +} +type mockAuthProvider struct { + c []map[string]interface{} + u []ApUpdate + r []string + d []string +} + +func (m *mockAuthProvider) Create(ctx context.Context, traits map[string]interface{}) (string, error) { + m.c = append(m.c, traits) + return strings.Split(traits["email"].(string), "user-")[1], nil +} +func (m *mockAuthProvider) Update(ctx context.Context, id string, traits map[string]interface{}) error { + m.u = append(m.u, ApUpdate{id: id, traits: traits}) + return nil +} +func (m *mockAuthProvider) GetRecoveryLink(ctx context.Context, id string) (string, error) { + m.r = append(m.r, id) + return "https://recoverme.testing/" + id, nil +} +func (m *mockAuthProvider) Delete(ctx context.Context, id string) error { + m.d = append(m.d, id) + return nil +} + +type mockAuthzClient struct { + cp []*types.Policies + dp []*types.Policy + cug []*types.UserGroups + dug []*types.UserGroup + crpm []*types.RolePermissionMappingList + drpm []*types.FilteredRolePermissionMapping +} + +func (c *mockAuthzClient) Enforce(ctx context.Context, in *types.EnforceRequest, opts ...grpc.CallOption) (*types.BoolReply, error) { + return &types.BoolReply{Res: true}, nil +} +func (c *mockAuthzClient) ListPolicies(ctx context.Context, in *types.Policy, opts ...grpc.CallOption) (*types.Policies, error) { + return &types.Policies{}, nil +} +func (c *mockAuthzClient) CreatePolicies(ctx context.Context, in *types.Policies, opts ...grpc.CallOption) (*types.BoolReply, error) { + c.cp = append(c.cp, in) + return &types.BoolReply{Res: true}, nil +} +func (c *mockAuthzClient) DeletePolicies(ctx context.Context, in *types.Policy, opts ...grpc.CallOption) (*types.BoolReply, error) { + c.dp = append(c.dp, in) + return &types.BoolReply{Res: true}, nil +} +func (c *mockAuthzClient) ListUserGroups(ctx context.Context, in *types.UserGroup, opts ...grpc.CallOption) (*types.UserGroups, error) { + return &types.UserGroups{}, nil +} +func (c *mockAuthzClient) CreateUserGroups(ctx context.Context, in *types.UserGroups, opts ...grpc.CallOption) (*types.BoolReply, error) { + c.cug = append(c.cug, in) + return &types.BoolReply{Res: true}, nil +} +func (c *mockAuthzClient) DeleteUserGroups(ctx context.Context, in *types.UserGroup, opts ...grpc.CallOption) (*types.BoolReply, error) { + c.dug = append(c.dug, in) + return &types.BoolReply{Res: true}, nil +} +func (c *mockAuthzClient) ListRolePermissionMappings(ctx context.Context, in *types.FilteredRolePermissionMapping, opts ...grpc.CallOption) (*types.RolePermissionMappingList, error) { + return &types.RolePermissionMappingList{}, nil +} +func (c *mockAuthzClient) CreateRolePermissionMappings(ctx context.Context, in *types.RolePermissionMappingList, opts ...grpc.CallOption) (*types.BoolReply, error) { + c.crpm = append(c.crpm, in) + return &types.BoolReply{Res: true}, nil +} +func (c *mockAuthzClient) DeleteRolePermissionMappings(ctx context.Context, in *types.FilteredRolePermissionMapping, opts ...grpc.CallOption) (*types.BoolReply, error) { + c.drpm = append(c.drpm, in) + return &types.BoolReply{Res: true}, nil +} diff --git a/components/usermgmt/pkg/service/role.go b/components/usermgmt/pkg/service/role.go index 3fb644a..8dc61c8 100644 --- a/components/usermgmt/pkg/service/role.go +++ b/components/usermgmt/pkg/service/role.go @@ -5,6 +5,8 @@ import ( "fmt" "time" + authzrpcv1 "github.com/RafaySystems/rcloud-base/components/authz/proto/rpc/v1" + authzv1 "github.com/RafaySystems/rcloud-base/components/authz/proto/types" "github.com/RafaySystems/rcloud-base/components/common/pkg/persistence/provider/pg" "github.com/RafaySystems/rcloud-base/components/common/pkg/utils" v3 "github.com/RafaySystems/rcloud-base/components/common/proto/types/commonpb/v3" @@ -43,14 +45,16 @@ type roleService struct { dao pg.EntityDAO rdao dao.RoleDAO l utils.Lookup + azc authzrpcv1.AuthzClient } // NewRoleService return new role service -func NewRoleService(db *bun.DB) RoleService { +func NewRoleService(db *bun.DB, azc authzrpcv1.AuthzClient) RoleService { return &roleService{ dao: pg.NewEntityDAO(db), rdao: dao.NewRoleDAO(db), l: utils.NewLookup(db), + azc: azc, } } @@ -72,8 +76,16 @@ func (s *roleService) getPartnerOrganization(ctx context.Context, role *userv3.R func (s *roleService) deleteRolePermissionMapping(ctx context.Context, rleId uuid.UUID, role *userv3.Role) (*userv3.Role, error) { err := s.dao.DeleteX(ctx, "resource_role_id", rleId, &models.ResourceRolePermission{}) if err != nil { - role.Status = statusFailed(err) - return role, err + return &userv3.Role{}, err + } + + drpm := authzv1.FilteredRolePermissionMapping{Role: role.GetMetadata().GetName()} + success, err := s.azc.DeleteRolePermissionMappings(ctx, &drpm) + if err != nil { + return &userv3.Role{}, fmt.Errorf("unable to delete mapping from authz; %v", err) + } + if !success.Res { + fmt.Println("No roles deleted") // TODO: maybe it should not return false? } return role, nil @@ -86,7 +98,6 @@ func (s *roleService) createRolePermissionMapping(ctx context.Context, role *use for _, p := range perms { entity, err := s.dao.GetIdByName(ctx, p, &models.ResourcePermission{}) if err != nil { - role.Status = statusFailed(fmt.Errorf("unable to find role permission '%v'", p)) return role, fmt.Errorf("unable to find role permission '%v'", p) } if prm, ok := entity.(*models.ResourcePermission); ok { @@ -95,7 +106,6 @@ func (s *roleService) createRolePermissionMapping(ctx context.Context, role *use ResourcePermissionId: prm.ID, }) } else { - role.Status = statusFailed(fmt.Errorf("unable to find role permission '%v'", p)) return role, fmt.Errorf("unable to find role permission '%v'", p) } } @@ -104,6 +114,17 @@ func (s *roleService) createRolePermissionMapping(ctx context.Context, role *use if err != nil { return role, err } + + crpm := authzv1.RolePermissionMappingList{ + RolePermissionMappingList: []*authzv1.RolePermissionMapping{{ + Role: role.GetMetadata().GetName(), + Permission: role.Spec.Rolepermissions, + }}, + } + success, err := s.azc.CreateRolePermissionMappings(ctx, &crpm) + if err != nil || !success.Res { + return role, fmt.Errorf("unable to create mapping in authz; %v", err) + } } return role, nil } @@ -132,23 +153,17 @@ func (s *roleService) Create(ctx context.Context, role *userv3.Role) (*userv3.Ro } entity, err := s.dao.Create(ctx, &rle) if err != nil { - role.Status = statusFailed(err) - return role, err + return &userv3.Role{}, err } //update v3 spec if createdRole, ok := entity.(*models.Role); ok { role, err = s.createRolePermissionMapping(ctx, role, parsedIds{Id: createdRole.ID, Partner: partnerId, Organization: organizationId}) if err != nil { - role.Status = statusFailed(err) - return role, err - } - - if role.Status == nil { - role.Status = statusOK() + return &userv3.Role{}, err } } else { - role.Status = statusFailed(fmt.Errorf("unable to create role")) + return &userv3.Role{}, fmt.Errorf("unable to create role '%v'", role.GetMetadata().GetName()) } return role, nil @@ -159,20 +174,17 @@ func (s *roleService) GetByID(ctx context.Context, role *userv3.Role) (*userv3.R id := role.GetMetadata().GetId() uid, err := uuid.Parse(id) if err != nil { - role.Status = statusFailed(err) - return role, err + return &userv3.Role{}, err } entity, err := s.dao.GetByID(ctx, uid, &models.Role{}) if err != nil { - role.Status = statusFailed(err) - return role, err + return &userv3.Role{}, err } if rle, ok := entity.(*models.Role); ok { role, err = s.toV3Role(ctx, role, rle) if err != nil { - role.Status = statusFailed(err) - return role, err + return &userv3.Role{}, err } return role, nil } @@ -188,18 +200,16 @@ func (s *roleService) GetByName(ctx context.Context, role *userv3.Role) (*userv3 } entity, err := s.dao.GetByNamePartnerOrg(ctx, name, uuid.NullUUID{UUID: partnerId, Valid: true}, uuid.NullUUID{UUID: organizationId, Valid: true}, &models.Role{}) if err != nil { - role.Status = statusFailed(err) - return role, err + return &userv3.Role{}, err } if rle, ok := entity.(*models.Role); ok { role, err = s.toV3Role(ctx, role, rle) if err != nil { - role.Status = statusFailed(err) - return role, nil + return &userv3.Role{}, err } - role.Status = statusOK() - return role, nil + } else { + } return role, nil @@ -211,11 +221,10 @@ func (s *roleService) Update(ctx context.Context, role *userv3.Role) (*userv3.Ro return nil, fmt.Errorf("unable to get partner and org id") } - id, _ := uuid.Parse(role.Metadata.Id) - entity, err := s.dao.GetByID(ctx, id, &models.Role{}) + name := role.GetMetadata().GetName() + entity, err := s.dao.GetByNamePartnerOrg(ctx, name, uuid.NullUUID{UUID: partnerId, Valid: true}, uuid.NullUUID{UUID: organizationId, Valid: true}, &models.Role{}) if err != nil { - role.Status = statusFailed(err) - return role, err + return role, fmt.Errorf("unable to find role '%v'", name) } if rle, ok := entity.(*models.Role); ok { @@ -226,29 +235,22 @@ func (s *roleService) Update(ctx context.Context, role *userv3.Role) (*userv3.Ro rle.Scope = role.Spec.Scope rle.ModifiedAt = time.Now() - _, err = s.dao.Update(ctx, id, rle) - if err != nil { - role.Status = statusFailed(err) - return role, err - } + _, err = s.dao.Update(ctx, rle.ID, rle) + if err != nil { return &userv3.Role{}, err } role, err = s.deleteRolePermissionMapping(ctx, rle.ID, role) - if err != nil { - role.Status = statusFailed(err) - return role, err - } - role, err = s.createRolePermissionMapping(ctx, role, parsedIds{Id: id, Partner: partnerId, Organization: organizationId}) - if err != nil { - role.Status = statusFailed(err) - return role, err - } + if err != nil { return &userv3.Role{}, err } + + role, err = s.createRolePermissionMapping(ctx, role, parsedIds{Id: rle.ID, Partner: partnerId, Organization: organizationId}) + if err != nil { return &userv3.Role{}, err } //update spec and status role.Spec = &userv3.RoleSpec{ IsGlobal: rle.IsGlobal, Scope: rle.Scope, } - role.Status = statusOK() + } else { + return &userv3.Role{}, fmt.Errorf("unable to update role '%v'", role.GetMetadata().GetName()) } return role, nil @@ -258,30 +260,24 @@ func (s *roleService) Delete(ctx context.Context, role *userv3.Role) (*userv3.Ro name := role.GetMetadata().GetName() partnerId, organizationId, err := s.getPartnerOrganization(ctx, role) if err != nil { - return role, fmt.Errorf("unable to get partner and org id") + return &userv3.Role{}, fmt.Errorf("unable to get partner and org id; %v", err) } entity, err := s.dao.GetByNamePartnerOrg(ctx, name, uuid.NullUUID{UUID: partnerId, Valid: true}, uuid.NullUUID{UUID: organizationId, Valid: true}, &models.Role{}) if err != nil { - role.Status = statusFailed(err) - return role, err + return &userv3.Role{}, err } + if rle, ok := entity.(*models.Role); ok { role, err = s.deleteRolePermissionMapping(ctx, rle.ID, role) if err != nil { - role.Status = statusFailed(err) - return role, err + return &userv3.Role{}, err } err = s.dao.Delete(ctx, rle.ID, rle) if err != nil { - role.Status = statusFailed(err) - return role, err + return &userv3.Role{}, err } - - //update v3 spec - role.Metadata.Name = rle.Name - role.Status = statusOK() } return role, nil @@ -316,7 +312,6 @@ func (s *roleService) toV3Role(ctx context.Context, role *userv3.Role, rle *mode Scope: rle.Scope, Rolepermissions: permissions, } - role.Status = statusOK() return role, nil } @@ -347,6 +342,9 @@ func (s *roleService) List(ctx context.Context, role *userv3.Role) (*userv3.Role for _, rle := range *rles { entry := &userv3.Role{Metadata: role.GetMetadata()} entry, err = s.toV3Role(ctx, entry, &rle) + if err != nil { + return roleList, err + } roles = append(roles, entry) } diff --git a/components/usermgmt/pkg/service/role_test.go b/components/usermgmt/pkg/service/role_test.go index 8dad945..aa27b74 100644 --- a/components/usermgmt/pkg/service/role_test.go +++ b/components/usermgmt/pkg/service/role_test.go @@ -23,8 +23,27 @@ func performRoleBasicChecks(t *testing.T, role *userv3.Role, ruuid string) { if role.GetMetadata().GetName() != "role-"+ruuid { t.Error("invalid name returned") } - if role.Status.ConditionStatus != v3.ConditionStatus_StatusOK { - t.Error("group status is not OK") +} + +func performRoleBasicAuthzChecks(t *testing.T, mazc mockAuthzClient, ruuid string) { + if len(mazc.drpm) > 0 { + if mazc.drpm[len(mazc.drpm)-1].Role != "role-"+ruuid { + t.Errorf("incorrect role sent to authz; expected '%v' got '%v'", "role-"+ruuid, mazc.drpm[len(mazc.drpm)-1].Role) + } + } + if len(mazc.crpm) > 0 { + if len(mazc.crpm[len(mazc.crpm)-1].RolePermissionMappingList) != 1 { + t.Errorf("invalid number of roles sent to authz; expected 1, got '%v'", len(mazc.crpm[len(mazc.crpm)-1].RolePermissionMappingList)) + } + if mazc.crpm[len(mazc.crpm)-1].RolePermissionMappingList[0].Role != "role-"+ruuid { + t.Errorf("incorrect role sent to authz; expected '%v' got '%v'", "role-"+ruuid, mazc.crpm[len(mazc.crpm)-1].RolePermissionMappingList[0].Role) + } + if len(mazc.crpm[len(mazc.crpm)-1].RolePermissionMappingList[0].Permission) != 1 { + t.Errorf("incorrect number of permissions sent to authz; expected '1', got '%v'", len(mazc.crpm[len(mazc.crpm)-1].RolePermissionMappingList[0].Permission)) + } + if mazc.crpm[len(mazc.crpm)-1].RolePermissionMappingList[0].Permission[0] != "ops_star.all" { + t.Errorf("incorrect permissions sent to authz; expected 'ops_star.all', got '%v'", mazc.crpm[len(mazc.crpm)-1].RolePermissionMappingList[0].Permission[0]) + } } } @@ -32,7 +51,8 @@ func TestCreateRole(t *testing.T) { db, mock := getDB(t) defer db.Close() - rs := NewRoleService(db) + mazc := mockAuthzClient{} + rs := NewRoleService(db, &mazc) defer rs.Close() ruuid := uuid.New().String() @@ -43,7 +63,8 @@ func TestCreateRole(t *testing.T) { WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(puuid)) mock.ExpectQuery(`SELECT "organization"."id" FROM "authsrv_organization" AS "organization"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ouuid)) - mock.ExpectQuery(`SELECT "resourcerole"."id" FROM "authsrv_resourcerole" AS "resourcerole"`).WithArgs() + mock.ExpectQuery(`SELECT "resourcerole"."id" FROM "authsrv_resourcerole" AS "resourcerole" WHERE .organization_id = '` + ouuid + `'. AND .partner_id = '` + puuid + `'. AND .name = 'role-` + ruuid + `'.`). + WillReturnError(fmt.Errorf("no data available")) // TODO: more precise checks mock.ExpectQuery(`INSERT INTO "authsrv_resourcerole"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ruuid)) @@ -57,13 +78,55 @@ func TestCreateRole(t *testing.T) { t.Fatal("could not create group:", err) } performRoleBasicChecks(t, role, ruuid) + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 0, 0) + performRoleBasicAuthzChecks(t, mazc, ruuid) +} + +func TestCreateRoleWithPermissions(t *testing.T) { + db, mock := getDB(t) + defer db.Close() + + mazc := mockAuthzClient{} + rs := NewRoleService(db, &mazc) + defer rs.Close() + + ruuid := uuid.New().String() + puuid := uuid.New().String() + ouuid := uuid.New().String() + + mock.ExpectQuery(`SELECT "partner"."id" FROM "authsrv_partner" AS "partner"`). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(puuid)) + mock.ExpectQuery(`SELECT "organization"."id" FROM "authsrv_organization" AS "organization"`). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ouuid)) + mock.ExpectQuery(`SELECT "resourcerole"."id" FROM "authsrv_resourcerole" AS "resourcerole" WHERE .organization_id = '` + ouuid + `'. AND .partner_id = '` + puuid + `'. AND .name = 'role-` + ruuid + `'.`). + WillReturnError(fmt.Errorf("no data available")) + mock.ExpectQuery(`INSERT INTO "authsrv_resourcerole"`). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ruuid)) + mock.ExpectQuery(`SELECT "resourcepermission"."id" FROM "authsrv_resourcepermission" AS "resourcepermission" WHERE .name = 'ops_star.all'.`). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(uuid.New().String())) + mock.ExpectQuery(`INSERT INTO "authsrv_resourcerolepermission"`). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(uuid.New().String())) + + role := &userv3.Role{ + Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "role-" + ruuid}, + Spec: &userv3.RoleSpec{IsGlobal: true, Scope: "cluster", Rolepermissions: []string{"ops_star.all"}}, + } + role, err := rs.Create(context.Background(), role) + if err != nil { + t.Fatal("could not create group:", err) + } + performRoleBasicChecks(t, role, ruuid) + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 1, 0) + performRoleBasicAuthzChecks(t, mazc, ruuid) + } func TestCreateRoleDuplicate(t *testing.T) { db, mock := getDB(t) defer db.Close() - rs := NewRoleService(db) + mazc := mockAuthzClient{} + rs := NewRoleService(db, &mazc) defer rs.Close() ruuid := uuid.New().String() @@ -74,7 +137,8 @@ func TestCreateRoleDuplicate(t *testing.T) { WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(puuid)) mock.ExpectQuery(`SELECT "organization"."id" FROM "authsrv_organization" AS "organization"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ouuid)) - mock.ExpectQuery(`SELECT "resourcerole"."id" FROM "authsrv_resourcerole" AS "resourcerole"`).WithArgs() + mock.ExpectQuery(` SELECT "resourcerole"."id" FROM "authsrv_resourcerole" AS "resourcerole" WHERE .organization_id = '` + ouuid + `'. AND .partner_id = '` + puuid + `'. AND .name = 'role-` + ruuid + `'.`). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ruuid)) // TODO: more precise checks mock.ExpectQuery(`INSERT INTO "authsrv_resourcerole"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ruuid)) @@ -83,33 +147,62 @@ func TestCreateRoleDuplicate(t *testing.T) { Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "role-" + ruuid}, Spec: &userv3.RoleSpec{IsGlobal: true, Scope: "cluster"}, } - role, err := rs.Create(context.Background(), role) - if err != nil { - t.Fatal("could not create group:", err) + _, err := rs.Create(context.Background(), role) + if err == nil { + t.Error("should not be able to recreate group with same name") } - performRoleBasicChecks(t, role, ruuid) + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 0, 0) + performRoleBasicAuthzChecks(t, mazc,ruuid) +} + +func TestUpdateRole(t *testing.T) { + db, mock := getDB(t) + defer db.Close() + + mazc := mockAuthzClient{} + rs := NewRoleService(db, &mazc) + defer rs.Close() + + ruuid := uuid.New().String() + puuid := uuid.New().String() + ouuid := uuid.New().String() - mock.ExpectQuery(`SELECT "resourcerole"."id" FROM "authsrv_resourcerole" AS "resourcerole"`). - WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ruuid)) mock.ExpectQuery(`SELECT "partner"."id" FROM "authsrv_partner" AS "partner"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(puuid)) mock.ExpectQuery(`SELECT "organization"."id" FROM "authsrv_organization" AS "organization"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ouuid)) - // TODO: more precise checks - mock.ExpectQuery(`INSERT INTO "authsrv_resourcerole"`). + mock.ExpectQuery(`SELECT "resourcerole"."id", "resourcerole"."name", .*FROM "authsrv_resourcerole" AS "resourcerole" WHERE .organization_id = '` + ouuid + `'. AND .partner_id = '` + puuid + `'. AND .name = 'role-` + ruuid + `'.`). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id", "name", "organization_id", "partner_id"}).AddRow(ruuid, "role-"+ruuid, ouuid, puuid)) + + mock.ExpectExec(`UPDATE "authsrv_resourcerole" AS "resourcerole" SET "name" = 'role-` + ruuid + `', .*"organization_id" = '` + ouuid + `', "partner_id" = '` + puuid + `', "is_global" = TRUE, "scope" = 'cluster' WHERE .id = '` + ruuid + `'.`). + WillReturnResult(sqlmock.NewResult(1, 1)) + mock.ExpectExec(`DELETE FROM "authsrv_resourcerolepermission" AS "resourcerolepermission" WHERE ."resource_role_id" = '` + ruuid + `'.`). + WillReturnResult(sqlmock.NewResult(1, 1)) + + mock.ExpectQuery(`SELECT "resourcepermission"."id" FROM "authsrv_resourcepermission" AS "resourcepermission" WHERE .name = 'ops_star.all'.`). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"name"}).AddRow("ops_star.all")) + mock.ExpectQuery(`INSERT INTO "authsrv_resourcerolepermission"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ruuid)) - _, err = rs.Create(context.Background(), role) - if err == nil { - t.Fatal("should not be able to recreate group with same name") + role := &userv3.Role{ + Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "role-" + ruuid}, + Spec: &userv3.RoleSpec{IsGlobal: true, Scope: "cluster", Rolepermissions: []string{"ops_star.all"}}, } + role, err := rs.Update(context.Background(), role) + if err != nil { + t.Fatal("could not update role:", err) + } + performRoleBasicChecks(t, role, ruuid) + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 1, 1) + performRoleBasicAuthzChecks(t, mazc, ruuid) } func TestRoleDelete(t *testing.T) { db, mock := getDB(t) defer db.Close() - rs := NewRoleService(db) + mazc := mockAuthzClient{} + rs := NewRoleService(db, &mazc) defer rs.Close() ruuid := uuid.New().String() @@ -132,15 +225,18 @@ func TestRoleDelete(t *testing.T) { } _, err := rs.Delete(context.Background(), role) if err != nil { - t.Fatal("could not delete role:", err) + t.Error("could not delete role:", err) } + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 0, 1) + performRoleBasicAuthzChecks(t, mazc, ruuid) } func TestRoleDeleteNonExist(t *testing.T) { db, mock := getDB(t) defer db.Close() - rs := NewRoleService(db) + mazc := mockAuthzClient{} + rs := NewRoleService(db, &mazc) defer rs.Close() ruuid := uuid.New().String() @@ -155,15 +251,19 @@ func TestRoleDeleteNonExist(t *testing.T) { } _, err := rs.Delete(context.Background(), role) if err == nil { - t.Fatal("deleted non existant role") + t.Error("deleted non existant role") } + + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 0, 0) + performRoleBasicAuthzChecks(t, mazc, ruuid) } func TestRoleGetByName(t *testing.T) { db, mock := getDB(t) defer db.Close() - rs := NewRoleService(db) + mazc := mockAuthzClient{} + rs := NewRoleService(db, &mazc) defer rs.Close() ruuid := uuid.New().String() @@ -188,13 +288,16 @@ func TestRoleGetByName(t *testing.T) { t.Fatal("could not get role:", err) } performRoleBasicChecks(t, role, ruuid) + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 0, 0) + performRoleBasicAuthzChecks(t, mazc, ruuid) } func TestRoleGetById(t *testing.T) { db, mock := getDB(t) defer db.Close() - rs := NewRoleService(db) + mazc := mockAuthzClient{} + rs := NewRoleService(db, &mazc) defer rs.Close() ruuid := uuid.New().String() @@ -215,13 +318,16 @@ func TestRoleGetById(t *testing.T) { t.Fatal("could not get role:", err) } performRoleBasicChecks(t, role, ruuid) + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 0, 0) + performRoleBasicAuthzChecks(t, mazc, ruuid) } func TestRoleList(t *testing.T) { db, mock := getDB(t) defer db.Close() - rs := NewRoleService(db) + mazc := mockAuthzClient{} + rs := NewRoleService(db, &mazc) defer rs.Close() ruuid1 := uuid.New().String() @@ -233,9 +339,15 @@ func TestRoleList(t *testing.T) { WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ouuid)) mock.ExpectQuery(`SELECT "partner"."id" FROM "authsrv_partner" AS "partner"`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(puuid)) - mock.ExpectQuery(`SELECT "resourcerole"."id", "resourcerole"."name", .* FROM "authsrv_resourcerole" AS "resourcerole"`). + mock.ExpectQuery(`SELECT "resourcerole"."id", "resourcerole"."name", .*FROM "authsrv_resourcerole" AS "resourcerole" WHERE .partner_id = '` + puuid + `'. AND .organization_id = '` + ouuid + `'.`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id", "name"}). AddRow(ruuid1, "role-"+ruuid1).AddRow(ruuid2, "role-"+ruuid2)) + mock.ExpectQuery(`SELECT authsrv_resourcepermission.name as name FROM "authsrv_resourcepermission" JOIN authsrv_resourcerolepermission ON authsrv_resourcerolepermission.resource_permission_id=authsrv_resourcepermission.id WHERE .authsrv_resourcerolepermission.resource_role_id = '` + ruuid1 + `'.`). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"name"}). + AddRow("ops_star.all")) + mock.ExpectQuery(`SELECT authsrv_resourcepermission.name as name FROM "authsrv_resourcepermission" JOIN authsrv_resourcerolepermission ON authsrv_resourcerolepermission.resource_permission_id=authsrv_resourcepermission.id WHERE .authsrv_resourcerolepermission.resource_role_id = '` + ruuid2 + `'.`). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"name"}). + AddRow("ops_star.all")) role := &userv3.Role{ Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid}, @@ -250,4 +362,6 @@ func TestRoleList(t *testing.T) { if rolelist.Items[0].Metadata.Name != "role-"+ruuid1 || rolelist.Items[1].Metadata.Name != "role-"+ruuid2 { t.Errorf("incorrect role names returned when listing") } + performBasicAuthzChecks(t, mazc, 0, 0, 0, 0, 0, 0) + performRoleBasicAuthzChecks(t, mazc, ruuid1) } diff --git a/components/usermgmt/pkg/service/rolepermission.go b/components/usermgmt/pkg/service/rolepermission.go index ba3671e..fe51526 100644 --- a/components/usermgmt/pkg/service/rolepermission.go +++ b/components/usermgmt/pkg/service/rolepermission.go @@ -69,13 +69,11 @@ func (s *rolepermissionService) GetByName(ctx context.Context, rolepermission *u name := rolepermission.GetMetadata().GetName() entity, err := s.dao.GetByName(ctx, name, &models.ResourcePermission{}) if err != nil { - rolepermission.Status = statusFailed(err) return rolepermission, err } if rle, ok := entity.(*models.ResourcePermission); ok { rolepermission = s.toV3Rolepermission(rolepermission, rle) - rolepermission.Status = statusOK() return rolepermission, nil } diff --git a/components/usermgmt/pkg/service/rolepermission_test.go b/components/usermgmt/pkg/service/rolepermission_test.go index 258cf8d..4adcfc5 100644 --- a/components/usermgmt/pkg/service/rolepermission_test.go +++ b/components/usermgmt/pkg/service/rolepermission_test.go @@ -22,9 +22,6 @@ func performRolePermissionBasicChecks(t *testing.T, role *userv3.RolePermission, if role.GetMetadata().GetId() != ruuid { t.Error("invalid uuid returned") } - if role.Status.ConditionStatus != v3.ConditionStatus_StatusOK { - t.Error("group status is not OK") - } } func TestRolePermissionList(t *testing.T) { diff --git a/components/usermgmt/pkg/service/test_utils.go b/components/usermgmt/pkg/service/test_utils.go new file mode 100644 index 0000000..40e43e7 --- /dev/null +++ b/components/usermgmt/pkg/service/test_utils.go @@ -0,0 +1,40 @@ +package service + +import "testing" + +func performBasicAuthzChecks(t *testing.T, mazc mockAuthzClient, cpCount, dpCount, cugCount, dugCount, crpmCount, drpmCount int) { + if len(mazc.cp) != cpCount { + t.Errorf("unexpected number of calls to Authz CreatePolicies; expctex '%v', got '%v'", cpCount, len(mazc.cp)) + } + if len(mazc.dp) != dpCount { + t.Errorf("unexpected number of calls to Authz DeletePolicies; expctex '%v', got '%v'", dpCount, len(mazc.dp)) + } + if len(mazc.cug) != cugCount { + t.Errorf("unexpected number of calls to Authz CreateUserGroups; expctex '%v', got '%v'", cugCount, len(mazc.cug)) + } + if len(mazc.dug) != dugCount { + t.Errorf("unexpected number of calls to Authz DeleteUserGroups; expctex '%v', got '%v'", dugCount, len(mazc.dug)) + } + if len(mazc.crpm) != crpmCount { + t.Errorf("unexpected number of calls to Authz CreateRolePermissionMapping; expctex '%v', got '%v'", crpmCount, len(mazc.crpm)) + } + if len(mazc.drpm) != drpmCount { + t.Errorf("unexpected number of calls to Authz DeleteRolePermissionMapping; expctex '%v', got '%v'", drpmCount, len(mazc.drpm)) + } +} + + +func performBasicAuthProviderChecks(t *testing.T, ma mockAuthProvider, cCount, uCount, rCount, dCount int) { + if len(ma.c) != cCount { + t.Errorf("unexpected number of calls to Auth Provider Create; expctex '%v', got '%v'", cCount, len(ma.c)) + } + if len(ma.u) != uCount { + t.Errorf("unexpected number of calls to Auth Provider Update; expctex '%v', got '%v'", uCount, len(ma.u)) + } + if len(ma.r) != rCount { + t.Errorf("unexpected number of calls to Auth Provider GetRecoveryLink; expctex '%v', got '%v'", rCount, len(ma.r)) + } + if len(ma.d) != dCount { + t.Errorf("unexpected number of calls to Auth Provider Delete; expctex '%v', got '%v'", dCount, len(ma.d)) + } +} diff --git a/components/usermgmt/pkg/service/user.go b/components/usermgmt/pkg/service/user.go index fc127c1..a756d66 100644 --- a/components/usermgmt/pkg/service/user.go +++ b/components/usermgmt/pkg/service/user.go @@ -3,12 +3,15 @@ package service import ( "context" "fmt" + "strconv" "time" "github.com/google/uuid" bun "github.com/uptrace/bun" "google.golang.org/protobuf/types/known/timestamppb" + authzrpcv1 "github.com/RafaySystems/rcloud-base/components/authz/proto/rpc/v1" + authzv1 "github.com/RafaySystems/rcloud-base/components/authz/proto/types" "github.com/RafaySystems/rcloud-base/components/common/pkg/persistence/provider/pg" "github.com/RafaySystems/rcloud-base/components/common/pkg/utils" v3 "github.com/RafaySystems/rcloud-base/components/common/proto/types/commonpb/v3" @@ -46,6 +49,7 @@ type userService struct { dao pg.EntityDAO udao dao.UserDAO l utils.Lookup + azc authzrpcv1.AuthzClient } type userTraits struct { @@ -62,8 +66,8 @@ type parsedIds struct { Organization uuid.UUID } -func NewUserService(ap providers.AuthProvider, db *bun.DB) UserService { - return &userService{ap: ap, dao: pg.NewEntityDAO(db), udao: dao.NewUserDAO(db), l: utils.NewLookup(db)} +func NewUserService(ap providers.AuthProvider, db *bun.DB, azc authzrpcv1.AuthzClient) UserService { + return &userService{ap: ap, dao: pg.NewEntityDAO(db), udao: dao.NewUserDAO(db), l: utils.NewLookup(db), azc: azc} } func getUserTraits(traits map[string]interface{}) userTraits { @@ -94,37 +98,36 @@ func getUserTraits(traits map[string]interface{}) userTraits { } // Map roles to accounts -func (s *userService) updateUserRoleRelation(ctx context.Context, user *userv3.User, ids parsedIds) (*userv3.User, error) { +func (s *userService) createUserRoleRelations(ctx context.Context, user *userv3.User, ids parsedIds) (*userv3.User, error) { projectNamespaceRoles := user.GetSpec().GetProjectNamespaceRoles() // TODO: add transactions var panrs []models.ProjectAccountNamespaceRole var pars []models.ProjectAccountResourcerole var ars []models.AccountResourcerole + var ps []*authzv1.Policy for _, pnr := range projectNamespaceRoles { role := pnr.GetRole() entity, err := s.dao.GetIdByName(ctx, role, &models.Role{}) if err != nil { - user.Status = statusFailed(fmt.Errorf("unable to find role '%v'", role)) - return user, err + return user, fmt.Errorf("unable to find role '%v'", role) } var roleId uuid.UUID if rle, ok := entity.(*models.Role); ok { roleId = rle.ID } else { - user.Status = statusFailed(fmt.Errorf("unable to find role '%v'", role)) - return user, err + return user, fmt.Errorf("unable to find role '%v'", role) } project := pnr.GetProject() + org := user.GetMetadata().GetOrganization() namespaceId := pnr.GetNamespace() // TODO: lookup id from name switch { case pnr.Namespace != nil: projectId, err := s.l.GetProjectId(ctx, project) if err != nil { - user.Status = statusFailed(fmt.Errorf("unable to find project '%v'", project)) - return user, err + return user, fmt.Errorf("unable to find project '%v'", project) } panr := models.ProjectAccountNamespaceRole{ CreatedAt: time.Now(), @@ -135,15 +138,23 @@ func (s *userService) updateUserRoleRelation(ctx context.Context, user *userv3.U OrganizationId: ids.Organization, AccountId: ids.Id, ProjectId: projectId, - NamesapceId: namespaceId, + NamespaceId: namespaceId, Active: true, } panrs = append(panrs, panr) + + ps = append(ps, &authzv1.Policy{ + Sub: "u:" + user.GetMetadata().GetName(), + Ns: strconv.FormatInt(namespaceId, 10), + Proj: project, + Org: org, + Obj: role, + Act: "*", + }) case project != "": projectId, err := s.l.GetProjectId(ctx, project) if err != nil { - user.Status = statusFailed(fmt.Errorf("unable to find project '%v'", project)) - return user, err + return user, fmt.Errorf("unable to find project '%v'", project) } par := models.ProjectAccountResourcerole{ CreatedAt: time.Now(), @@ -158,6 +169,15 @@ func (s *userService) updateUserRoleRelation(ctx context.Context, user *userv3.U Active: true, } pars = append(pars, par) + + ps = append(ps, &authzv1.Policy{ + Sub: "u:" + user.GetMetadata().GetName(), + Ns: "*", + Proj: project, + Org: org, + Obj: role, + Act: "*", + }) default: ar := models.AccountResourcerole{ CreatedAt: time.Now(), @@ -171,24 +191,40 @@ func (s *userService) updateUserRoleRelation(ctx context.Context, user *userv3.U Active: true, } ars = append(ars, ar) + + ps = append(ps, &authzv1.Policy{ + Sub: "u:" + user.GetMetadata().GetName(), + Ns: "*", + Proj: "*", + Org: org, + Obj: role, + Act: "*", + }) } } if len(panrs) > 0 { _, err := s.dao.Create(ctx, &panrs) if err != nil { - return user, err + return &userv3.User{}, err } } if len(pars) > 0 { _, err := s.dao.Create(ctx, &pars) if err != nil { - return user, err + return &userv3.User{}, err } } if len(ars) > 0 { _, err := s.dao.Create(ctx, &ars) if err != nil { - return user, err + return &userv3.User{}, err + } + } + + if len(ps) > 0 { + success, err := s.azc.CreatePolicies(ctx, &authzv1.Policies{Policies: ps}) + if err != nil || !success.Res { + return &userv3.User{}, fmt.Errorf("unable to create mapping in authz; %v", err) } } @@ -226,25 +262,21 @@ func (s *userService) Create(ctx context.Context, user *userv3.User) (*userv3.Us "description": user.GetMetadata().GetDescription(), }) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } uid, _ := uuid.Parse(id) - user, err = s.updateUserRoleRelation(ctx, user, parsedIds{Id: uid, Partner: partnerId, Organization: organizationId}) + user, err = s.createUserRoleRelations(ctx, user, parsedIds{Id: uid, Partner: partnerId, Organization: organizationId}) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } rl, err := s.ap.GetRecoveryLink(ctx, id) fmt.Println("Recovery link:", rl) // TODO: email the recovery link to the user if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } - user.Status = statusOK() return user, nil } @@ -252,8 +284,7 @@ func (s *userService) identitiesModelToUser(ctx context.Context, user *userv3.Us traits := getUserTraits(usr.Traits) groups, err := s.udao.GetGroups(ctx, usr.ID) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } groupNames := []string{} for _, g := range groups { @@ -264,8 +295,7 @@ func (s *userService) identitiesModelToUser(ctx context.Context, user *userv3.Us roles, err := s.udao.GetRoles(ctx, usr.ID) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } user.ApiVersion = apiVersion @@ -290,27 +320,22 @@ func (s *userService) GetByID(ctx context.Context, user *userv3.User) (*userv3.U id := user.GetMetadata().GetId() uid, err := uuid.Parse(id) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } entity, err := s.dao.GetByID(ctx, uid, &models.KratosIdentities{}) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } if usr, ok := entity.(*models.KratosIdentities); ok { user, err := s.identitiesModelToUser(ctx, user, usr) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } - user.Status = statusOK() return user, nil } - user.Status = statusFailed(fmt.Errorf("unabele to fetch user '%v'", id)) - return user, nil + return user, fmt.Errorf("unabele to fetch user '%v'", id) } @@ -318,30 +343,48 @@ func (s *userService) GetByName(ctx context.Context, user *userv3.User) (*userv3 name := user.GetMetadata().GetName() entity, err := s.dao.GetByTraits(ctx, name, &models.KratosIdentities{}) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } if usr, ok := entity.(*models.KratosIdentities); ok { user, err := s.identitiesModelToUser(ctx, user, usr) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } - user.Status = statusOK() return user, nil } - fmt.Println("user:", user); + fmt.Println("user:", user) return user, nil } +func (s *userService) deleteUserRoleRelations(ctx context.Context, userId uuid.UUID, user *userv3.User) error { + err := s.dao.DeleteX(ctx, "account_id", userId, &models.AccountResourcerole{}) + if err != nil { + return err + } + err = s.dao.DeleteX(ctx, "account_id", userId, &models.ProjectAccountResourcerole{}) + if err != nil { + return err + } + err = s.dao.DeleteX(ctx, "account_id", userId, &models.ProjectAccountNamespaceRole{}) + if err != nil { + return err + } + + _, err = s.azc.DeletePolicies(ctx, &authzv1.Policy{Sub: "u:" + user.GetMetadata().GetName()}) + if err != nil { + return fmt.Errorf("unable to delete user-role relations from authz; %v", err) + } + + return nil +} + func (s *userService) Update(ctx context.Context, user *userv3.User) (*userv3.User, error) { name := user.GetMetadata().GetName() entity, err := s.dao.GetIdByTraits(ctx, name, &models.KratosIdentities{}) if err != nil { - user.Status = statusFailed(fmt.Errorf("no user found with name '%v'", name)) - return user, err + return &userv3.User{}, fmt.Errorf("no user found with name '%v'", name) } if usr, ok := entity.(*models.KratosIdentities); ok { @@ -356,37 +399,22 @@ func (s *userService) Update(ctx context.Context, user *userv3.User) (*userv3.Us "description": user.GetMetadata().GetDescription(), }) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } - err = s.dao.DeleteX(ctx, "account_id", usr.ID, &models.AccountResourcerole{}) + err = s.deleteUserRoleRelations(ctx, usr.ID, user) if err != nil { - user.Status = statusFailed(err) - return nil, err - } - err = s.dao.DeleteX(ctx, "account_id", usr.ID, &models.ProjectAccountResourcerole{}) - if err != nil { - user.Status = statusFailed(err) - return nil, err - } - err = s.dao.DeleteX(ctx, "account_id", usr.ID, &models.ProjectAccountNamespaceRole{}) - if err != nil { - user.Status = statusFailed(err) - return nil, err + return &userv3.User{}, err } - user, err = s.updateUserRoleRelation(ctx, user, parsedIds{Id: usr.ID, Partner: partnerId, Organization: organizationId}) + user, err = s.createUserRoleRelations(ctx, user, parsedIds{Id: usr.ID, Partner: partnerId, Organization: organizationId}) if err != nil { - user.Status = statusFailed(err) - return user, err + return &userv3.User{}, err } } else { - user.Status = statusFailed(fmt.Errorf("unable to update user '%v'", name)) - return user, err + return &userv3.User{}, fmt.Errorf("unable to update user '%v'", name) } - user.Status = statusOK() return user, nil } @@ -398,6 +426,11 @@ func (s *userService) Delete(ctx context.Context, user *userv3.User) (*userrpcv3 } if usr, ok := entity.(*models.KratosIdentities); ok { + err = s.deleteUserRoleRelations(ctx, usr.ID, user) + if err != nil { + return &userrpcv3.DeleteUserResponse{}, err + } + err := s.ap.Delete(ctx, usr.ID.String()) if err != nil { return &userrpcv3.DeleteUserResponse{}, err @@ -405,24 +438,12 @@ func (s *userService) Delete(ctx context.Context, user *userv3.User) (*userrpcv3 err = s.dao.DeleteX(ctx, "account_id", usr.ID, &models.GroupAccount{}) if err != nil { - return &userrpcv3.DeleteUserResponse{}, err - } - err = s.dao.DeleteX(ctx, "account_id", usr.ID, &models.AccountResourcerole{}) - if err != nil { - return &userrpcv3.DeleteUserResponse{}, err - } - err = s.dao.DeleteX(ctx, "account_id", usr.ID, &models.ProjectAccountResourcerole{}) - if err != nil { - return &userrpcv3.DeleteUserResponse{}, err - } - err = s.dao.DeleteX(ctx, "account_id", usr.ID, &models.ProjectAccountNamespaceRole{}) - if err != nil { - return &userrpcv3.DeleteUserResponse{}, err + return &userrpcv3.DeleteUserResponse{}, fmt.Errorf("unable to delete user; %v", err) } return &userrpcv3.DeleteUserResponse{}, nil } - return &userrpcv3.DeleteUserResponse{}, fmt.Errorf("unable to find user '%v'", user.Metadata.Name) + return &userrpcv3.DeleteUserResponse{}, fmt.Errorf("unable to delete user '%v'", user.Metadata.Name) } diff --git a/components/usermgmt/pkg/service/user_test.go b/components/usermgmt/pkg/service/user_test.go index d2a2ec8..1627176 100644 --- a/components/usermgmt/pkg/service/user_test.go +++ b/components/usermgmt/pkg/service/user_test.go @@ -3,7 +3,6 @@ package service import ( "context" "fmt" - "strings" "testing" "github.com/DATA-DOG/go-sqlmock" @@ -12,21 +11,6 @@ import ( "github.com/google/uuid" ) -type mockAuthProvider struct{} - -func (m *mockAuthProvider) Create(ctx context.Context, traits map[string]interface{}) (string, error) { - return strings.Split(traits["email"].(string), "user-")[1], nil -} -func (k *mockAuthProvider) Update(ctx context.Context, id string, traits map[string]interface{}) error { - return nil -} -func (k *mockAuthProvider) GetRecoveryLink(ctx context.Context, id string) (string, error) { - return "https://recoverme.testing/" + id, nil -} -func (k *mockAuthProvider) Delete(ctx context.Context, id string) error { - return nil -} - func performUserBasicChecks(t *testing.T, user *userv3.User, uuuid string) { _, err := uuid.Parse(user.GetMetadata().GetOrganization()) if err == nil { @@ -36,8 +20,36 @@ func performUserBasicChecks(t *testing.T, user *userv3.User, uuuid string) { if err == nil { t.Error("partner in metadata should be name not id") } - if user.Status.ConditionStatus != v3.ConditionStatus_StatusOK { - t.Error("user status is not OK") +} + +func performUserBasicAuthzChecks(t *testing.T, mazc mockAuthzClient, uuuid string, roles []*userv3.ProjectNamespaceRole) { + if len(mazc.cp) > 0 { + for i, u := range mazc.cp[len(mazc.cp)-1].Policies { + if u.Sub != "u:user-"+uuuid { + t.Errorf("invalid sub in policy sent to authz; expected '%v', got '%v'", "u:user-"+uuuid, u.Sub) + } + if u.Obj != roles[i].Role { + t.Errorf("invalid obj in policy sent to authz; expected '%v', got '%v'", roles[i].Role, u.Obj) + } + if roles[i].Namespace != nil { + if u.Ns != fmt.Sprint(*roles[i].Namespace) { + t.Errorf("invalid ns in policy sent to authz; expected '%v', got '%v'", fmt.Sprint(roles[i].Namespace), u.Ns) + } + } else { + if u.Ns != "*" { + t.Errorf("invalid ns in policy sent to authz; expected '%v', got '%v'", "*", u.Ns) + } + } + if roles[i].Project != nil { + if u.Proj != *roles[i].Project { + t.Errorf("invalid proj in policy sent to authz; expected '%v', got '%v'", roles[i].Project, u.Proj) + } + } else { + if u.Proj != "*" { + t.Errorf("invalid proj in policy sent to authz; expected '%v', got '%v'", "*", u.Proj) + } + } + } } } @@ -46,7 +58,8 @@ func TestCreateUser(t *testing.T) { defer db.Close() ap := &mockAuthProvider{} - us := NewUserService(ap, db) + mazc := &mockAuthzClient{} + us := NewUserService(ap, db, mazc) defer us.Close() uuuid := uuid.New().String() @@ -70,6 +83,9 @@ func TestCreateUser(t *testing.T) { if user.GetMetadata().GetName() != "user-"+uuuid { t.Errorf("expected name 'user-%v'; got '%v'", uuuid, user.GetMetadata().GetName()) } + performBasicAuthzChecks(t, *mazc, 0, 0, 0, 0, 0, 0) + performBasicAuthProviderChecks(t, *ap, 1, 0, 1, 0) + performUserBasicAuthzChecks(t, *mazc, uuuid, []*userv3.ProjectNamespaceRole{}) } func TestCreateUserWithRole(t *testing.T) { @@ -98,7 +114,8 @@ func TestCreateUserWithRole(t *testing.T) { defer db.Close() ap := &mockAuthProvider{} - us := NewUserService(ap, db) + mazc := &mockAuthzClient{} + us := NewUserService(ap, db, mazc) defer us.Close() uuuid := uuid.New().String() @@ -140,6 +157,9 @@ func TestCreateUserWithRole(t *testing.T) { t.Errorf("expected name 'user-%v'; got '%v'", uuuid, user.GetMetadata().GetName()) } + performBasicAuthzChecks(t, *mazc, 1, 0, 0, 0, 0, 0) + performBasicAuthProviderChecks(t, *ap, 1, 0, 1, 0) + performUserBasicAuthzChecks(t, *mazc, uuuid, tc.roles) }) } } @@ -149,7 +169,8 @@ func TestUpdateUser(t *testing.T) { defer db.Close() ap := &mockAuthProvider{} - us := NewUserService(ap, db) + mazc := &mockAuthzClient{} + us := NewUserService(ap, db, mazc) defer us.Close() uuuid := uuid.New().String() @@ -194,6 +215,9 @@ func TestUpdateUser(t *testing.T) { if user.GetMetadata().GetName() != "user-"+uuuid { t.Errorf("expected name 'user-%v'; got '%v'", uuuid, user.GetMetadata().GetName()) } + performBasicAuthzChecks(t, *mazc, 1, 1, 0, 0, 0, 0) + performBasicAuthProviderChecks(t, *ap, 0, 1, 0, 0) + performUserBasicAuthzChecks(t, *mazc, uuuid, user.Spec.ProjectNamespaceRoles) } func TestUserGetByName(t *testing.T) { @@ -201,7 +225,8 @@ func TestUserGetByName(t *testing.T) { defer db.Close() ap := &mockAuthProvider{} - us := NewUserService(ap, db) + mazc := &mockAuthzClient{} + us := NewUserService(ap, db, mazc) defer us.Close() uuuid := uuid.New().String() @@ -243,6 +268,9 @@ func TestUserGetByName(t *testing.T) { if user.GetSpec().GetProjectNamespaceRoles()[2].GetNamespace() != 9 { t.Errorf("invalid namespace in role returned for user, expected 9; got '%v'", user.GetSpec().GetProjectNamespaceRoles()[2].Namespace) } + performBasicAuthzChecks(t, *mazc, 0, 0, 0, 0, 0, 0) + performBasicAuthProviderChecks(t, *ap, 0, 0, 0, 0) + performUserBasicAuthzChecks(t, *mazc, uuuid, user.Spec.ProjectNamespaceRoles) } func TestUserGetById(t *testing.T) { @@ -250,7 +278,8 @@ func TestUserGetById(t *testing.T) { defer db.Close() ap := &mockAuthProvider{} - us := NewUserService(ap, db) + mazc := &mockAuthzClient{} + us := NewUserService(ap, db, mazc) defer us.Close() uuuid := uuid.New().String() @@ -289,6 +318,10 @@ func TestUserGetById(t *testing.T) { if user.GetSpec().GetProjectNamespaceRoles()[2].GetNamespace() != 9 { t.Errorf("invalid namespace in role returned for user, expected 9; got '%v'", user.GetSpec().GetProjectNamespaceRoles()[2].Namespace) } + + performBasicAuthzChecks(t, *mazc, 0, 0, 0, 0, 0, 0) + performBasicAuthProviderChecks(t, *ap, 0, 0, 0, 0) + performUserBasicAuthzChecks(t, *mazc, uuuid, user.Spec.ProjectNamespaceRoles) } func TestUserList(t *testing.T) { @@ -296,7 +329,8 @@ func TestUserList(t *testing.T) { defer db.Close() ap := &mockAuthProvider{} - us := NewUserService(ap, db) + mazc := &mockAuthzClient{} + us := NewUserService(ap, db, mazc) defer us.Close() uuuid1 := uuid.New().String() @@ -355,6 +389,10 @@ func TestUserList(t *testing.T) { if userlist.Items[0].GetSpec().GetProjectNamespaceRoles()[2].GetNamespace() != 9 { t.Errorf("invalid namespace in role returned for user, expected 9; got '%v'", userlist.Items[0].GetSpec().GetProjectNamespaceRoles()[2].Namespace) } + + performBasicAuthzChecks(t, *mazc, 0, 0, 0, 0, 0, 0) + performBasicAuthProviderChecks(t, *ap, 0, 0, 0, 0) + performUserBasicAuthzChecks(t, *mazc, uuuid2, []*userv3.ProjectNamespaceRole{}) } func TestUserDelete(t *testing.T) { @@ -362,7 +400,8 @@ func TestUserDelete(t *testing.T) { defer db.Close() ap := &mockAuthProvider{} - us := NewUserService(ap, db) + mazc := &mockAuthzClient{} + us := NewUserService(ap, db, mazc) defer us.Close() uuuid := uuid.New().String() @@ -371,14 +410,15 @@ func TestUserDelete(t *testing.T) { mock.ExpectQuery(`SELECT "identities"."id" FROM "identities" WHERE .*traits ->> 'email' = 'user-` + uuuid + `'`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id", "traits"}).AddRow(uuuid, []byte(`{"email":"johndoe@provider.com"}`))) - mock.ExpectExec(`DELETE FROM "authsrv_groupaccount" AS "groupaccount" WHERE`). - WillReturnResult(sqlmock.NewResult(1, 1)) mock.ExpectExec(`DELETE FROM "authsrv_accountresourcerole" AS "accountresourcerole" WHERE`). WillReturnResult(sqlmock.NewResult(1, 1)) mock.ExpectExec(`DELETE FROM "authsrv_projectaccountresourcerole" AS "projectaccountresourcerole" WHERE`). WillReturnResult(sqlmock.NewResult(1, 1)) mock.ExpectExec(`DELETE FROM "authsrv_projectaccountnamespacerole" AS "projectaccountnamespacerole" WHERE`). WillReturnResult(sqlmock.NewResult(1, 1)) + // User delete is via kratos + mock.ExpectExec(`DELETE FROM "authsrv_groupaccount" AS "groupaccount" WHERE`). + WillReturnResult(sqlmock.NewResult(1, 1)) user := &userv3.User{ Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "user-" + uuuid}, @@ -387,4 +427,8 @@ func TestUserDelete(t *testing.T) { if err != nil { t.Fatal("could not delete user:", err) } + + performBasicAuthzChecks(t, *mazc, 0, 1, 0, 0, 0, 0) + performBasicAuthProviderChecks(t, *ap, 0, 0, 0, 1) + performUserBasicAuthzChecks(t, *mazc, uuuid, []*userv3.ProjectNamespaceRole{}) } diff --git a/components/usermgmt/pkg/service/utils.go b/components/usermgmt/pkg/service/utils.go deleted file mode 100644 index d53fda9..0000000 --- a/components/usermgmt/pkg/service/utils.go +++ /dev/null @@ -1,23 +0,0 @@ -package service - -import ( - v3 "github.com/RafaySystems/rcloud-base/components/common/proto/types/commonpb/v3" - "google.golang.org/protobuf/types/known/timestamppb" -) - -func statusFailed(err error) *v3.Status { - // maybe we can parse the errors here and give better user facing errors - return &v3.Status{ - ConditionType: "StatusFailed", - ConditionStatus: v3.ConditionStatus_StatusFailed, - LastUpdated: timestamppb.Now(), - Reason: err.Error(), - } -} - -func statusOK() *v3.Status { - return &v3.Status{ - ConditionType: "StatusOK", - ConditionStatus: v3.ConditionStatus_StatusOK, - } -} diff --git a/components/usermgmt/proto/rpc/v3/group.pb.go b/components/usermgmt/proto/rpc/v3/group.pb.go index 74341d6..8a03355 100644 --- a/components/usermgmt/proto/rpc/v3/group.pb.go +++ b/components/usermgmt/proto/rpc/v3/group.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc (unknown) // source: proto/rpc/v3/group.proto package rpcv3 diff --git a/components/usermgmt/proto/rpc/v3/group_grpc.pb.go b/components/usermgmt/proto/rpc/v3/group_grpc.pb.go index 70944d8..630d716 100644 --- a/components/usermgmt/proto/rpc/v3/group_grpc.pb.go +++ b/components/usermgmt/proto/rpc/v3/group_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.1 +// - protoc (unknown) // source: proto/rpc/v3/group.proto package rpcv3 diff --git a/components/usermgmt/proto/rpc/v3/role.pb.go b/components/usermgmt/proto/rpc/v3/role.pb.go index 75f325a..08d85c1 100644 --- a/components/usermgmt/proto/rpc/v3/role.pb.go +++ b/components/usermgmt/proto/rpc/v3/role.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc (unknown) // source: proto/rpc/v3/role.proto package rpcv3 diff --git a/components/usermgmt/proto/rpc/v3/role_grpc.pb.go b/components/usermgmt/proto/rpc/v3/role_grpc.pb.go index 2533948..e935d49 100644 --- a/components/usermgmt/proto/rpc/v3/role_grpc.pb.go +++ b/components/usermgmt/proto/rpc/v3/role_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.1 +// - protoc (unknown) // source: proto/rpc/v3/role.proto package rpcv3 diff --git a/components/usermgmt/proto/rpc/v3/rolepermission.pb.go b/components/usermgmt/proto/rpc/v3/rolepermission.pb.go index 0911ee7..a755ec7 100644 --- a/components/usermgmt/proto/rpc/v3/rolepermission.pb.go +++ b/components/usermgmt/proto/rpc/v3/rolepermission.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc (unknown) // source: proto/rpc/v3/rolepermission.proto package rpcv3 diff --git a/components/usermgmt/proto/rpc/v3/rolepermission_grpc.pb.go b/components/usermgmt/proto/rpc/v3/rolepermission_grpc.pb.go index 5a0bf86..1836782 100644 --- a/components/usermgmt/proto/rpc/v3/rolepermission_grpc.pb.go +++ b/components/usermgmt/proto/rpc/v3/rolepermission_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.1 +// - protoc (unknown) // source: proto/rpc/v3/rolepermission.proto package rpcv3 diff --git a/components/usermgmt/proto/rpc/v3/user.pb.go b/components/usermgmt/proto/rpc/v3/user.pb.go index b4a5576..2c2225d 100644 --- a/components/usermgmt/proto/rpc/v3/user.pb.go +++ b/components/usermgmt/proto/rpc/v3/user.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc (unknown) // source: proto/rpc/v3/user.proto package rpcv3 diff --git a/components/usermgmt/proto/rpc/v3/user_grpc.pb.go b/components/usermgmt/proto/rpc/v3/user_grpc.pb.go index cb993e1..3f72d60 100644 --- a/components/usermgmt/proto/rpc/v3/user_grpc.pb.go +++ b/components/usermgmt/proto/rpc/v3/user_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.1 +// - protoc (unknown) // source: proto/rpc/v3/user.proto package rpcv3 diff --git a/components/usermgmt/proto/types/userpb/v3/group.pb.go b/components/usermgmt/proto/types/userpb/v3/group.pb.go index 7087d95..e29fd3e 100644 --- a/components/usermgmt/proto/types/userpb/v3/group.pb.go +++ b/components/usermgmt/proto/types/userpb/v3/group.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc (unknown) // source: proto/types/userpb/v3/group.proto package userv3 import ( - _ "github.com/RafaySystems/rcloud-base/components/adminsrv/proto/types/systempb/v3" v3 "github.com/RafaySystems/rcloud-base/components/common/proto/types/commonpb/v3" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -308,132 +307,129 @@ var file_proto_types_userpb_v3_group_proto_rawDesc = []byte{ 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x24, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x70, 0x62, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x25, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x70, 0x62, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x70, 0x62, 0x2f, 0x76, 0x33, - 0x2f, 0x72, 0x6f, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, - 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x04, 0x0a, 0x05, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x69, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x49, 0x92, 0x41, 0x46, 0x2a, 0x0b, - 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x21, 0x41, 0x50, 0x49, - 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x14, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x6b, 0x38, 0x73, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x69, - 0x6f, 0x2f, 0x76, 0x33, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x40, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2c, - 0x92, 0x41, 0x29, 0x2a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x32, 0x1a, 0x4b, 0x69, 0x6e, 0x64, 0x20, - 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x04, 0x6b, 0x69, - 0x6e, 0x64, 0x12, 0x6e, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, - 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x2d, 0x92, 0x41, 0x2a, 0x2a, 0x08, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x32, 0x1e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x12, 0x65, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x22, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x53, 0x70, 0x65, 0x63, 0x42, 0x2d, 0x92, 0x41, 0x2a, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x32, 0x1e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x60, 0x0a, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x72, 0x61, 0x66, 0x61, - 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x25, 0x92, 0x41, - 0x22, 0x2a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0x16, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x40, 0x01, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3a, 0x39, 0x92, 0x41, 0x36, - 0x0a, 0x34, 0x2a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x32, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0xd2, 0x01, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0xd2, 0x01, 0x04, - 0x6b, 0x69, 0x6e, 0x64, 0xd2, 0x01, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xd2, - 0x01, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0x9a, 0x02, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, - 0x34, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x15, 0x92, 0x41, 0x12, 0x2a, 0x07, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x32, 0x07, - 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x88, 0x01, 0x01, 0x12, 0x3c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x19, 0x92, 0x41, 0x16, 0x2a, 0x09, 0x4e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x32, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x48, 0x01, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x23, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x0f, 0x92, 0x41, 0x0c, 0x2a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x32, 0x04, 0x52, 0x6f, - 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x3a, 0x4f, 0x92, 0x41, 0x4c, 0x0a, 0x4a, 0x2a, - 0x14, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x32, 0x32, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x20, - 0x72, 0x6f, 0x6c, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x20, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70, - 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x22, 0xd8, 0x02, 0x0a, 0x09, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x70, 0x65, - 0x63, 0x12, 0xb0, 0x01, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x2d, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, - 0x42, 0x4b, 0x92, 0x41, 0x48, 0x2a, 0x15, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x32, 0x2f, 0x50, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x2c, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x20, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x15, 0x70, + 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, + 0x75, 0x73, 0x65, 0x72, 0x70, 0x62, 0x2f, 0x76, 0x33, 0x2f, 0x72, 0x6f, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, + 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x04, 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x69, + 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x49, 0x92, 0x41, 0x46, 0x2a, 0x0b, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x21, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x14, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, + 0x6b, 0x38, 0x73, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x33, 0x52, 0x0a, 0x61, + 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x04, 0x6b, 0x69, 0x6e, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2c, 0x92, 0x41, 0x29, 0x2a, 0x04, 0x4b, 0x69, + 0x6e, 0x64, 0x32, 0x1a, 0x4b, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x05, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x6e, 0x0a, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, + 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x42, 0x2d, 0x92, 0x41, 0x2a, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x32, 0x1e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x65, 0x0a, 0x04, 0x73, + 0x70, 0x65, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x61, 0x66, 0x61, + 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, + 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x70, 0x65, 0x63, 0x42, 0x2d, 0x92, + 0x41, 0x2a, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x32, 0x1e, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x04, 0x73, 0x70, + 0x65, 0x63, 0x12, 0x60, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x25, 0x92, 0x41, 0x22, 0x2a, 0x06, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x32, 0x16, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, + 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x3a, 0x39, 0x92, 0x41, 0x36, 0x0a, 0x34, 0x2a, 0x05, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x32, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0xd2, 0x01, 0x0a, 0x61, 0x70, 0x69, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0xd2, 0x01, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0xd2, 0x01, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xd2, 0x01, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, + 0x9a, 0x02, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x15, 0x92, 0x41, 0x12, 0x2a, 0x07, + 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x32, 0x07, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x48, 0x00, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x88, 0x01, 0x01, 0x12, 0x3c, + 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x42, 0x19, 0x92, 0x41, 0x16, 0x2a, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x32, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x48, 0x01, 0x52, 0x09, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x23, 0x0a, 0x04, + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0x92, 0x41, 0x0c, 0x2a, + 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x32, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, + 0x65, 0x3a, 0x4f, 0x92, 0x41, 0x4c, 0x0a, 0x4a, 0x2a, 0x14, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x32, 0x32, + 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x20, 0x61, 0x6e, + 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x70, 0x61, 0x69, 0x72, + 0x69, 0x6e, 0x67, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x42, 0x0c, + 0x0a, 0x0a, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0xd8, 0x02, 0x0a, + 0x09, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x53, 0x70, 0x65, 0x63, 0x12, 0xb0, 0x01, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, - 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x09, 0x42, 0x23, 0x92, 0x41, 0x20, 0x2a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x32, - 0x17, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, 0x20, 0x66, - 0x6f, 0x72, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, - 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0x92, - 0x41, 0x15, 0x2a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x32, 0x0d, 0x54, 0x79, 0x70, 0x65, 0x20, 0x6f, - 0x66, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x2f, 0x92, - 0x41, 0x2c, 0x0a, 0x2a, 0x2a, 0x13, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x53, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x13, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa5, - 0x03, 0x0a, 0x09, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x5a, 0x0a, 0x0a, - 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x3a, 0x92, 0x41, 0x37, 0x2a, 0x0b, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x32, 0x26, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, - 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x6c, 0x69, 0x73, - 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x0a, 0x61, 0x70, - 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2c, 0x92, 0x41, 0x29, 0x2a, 0x04, 0x4b, 0x69, 0x6e, - 0x64, 0x32, 0x1f, 0x4b, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, + 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x72, 0x61, 0x66, + 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, + 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x4b, 0x92, 0x41, 0x48, 0x2a, 0x15, + 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x32, 0x2f, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x20, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2c, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x20, + 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x66, 0x6f, 0x72, + 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x15, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, + 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x39, 0x0a, + 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x42, 0x23, 0x92, 0x41, + 0x20, 0x2a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x32, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x6f, + 0x66, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0x92, 0x41, 0x15, 0x2a, 0x04, 0x54, 0x79, 0x70, + 0x65, 0x32, 0x0d, 0x54, 0x79, 0x70, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x2f, 0x92, 0x41, 0x2c, 0x0a, 0x2a, 0x2a, 0x13, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x20, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x32, 0x13, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa5, 0x03, 0x0a, 0x09, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x5a, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x3a, 0x92, 0x41, 0x37, 0x2a, 0x0b, + 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x26, 0x41, 0x50, 0x49, + 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x40, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x2c, 0x92, 0x41, 0x29, 0x2a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x32, 0x1f, 0x4b, 0x69, 0x6e, 0x64, + 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x6c, 0x69, + 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x04, 0x6b, + 0x69, 0x6e, 0x64, 0x12, 0x79, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, + 0x33, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x34, + 0x92, 0x41, 0x31, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x32, 0x23, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x40, 0x01, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x79, 0x0a, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, - 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x34, 0x92, 0x41, 0x31, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x32, 0x23, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, - 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x6c, 0x69, 0x73, 0x74, - 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x08, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x5f, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x42, 0x29, 0x92, 0x41, 0x26, 0x2a, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, - 0x32, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x40, 0x01, 0x52, - 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x3a, 0x1e, 0x92, 0x41, 0x1b, 0x0a, 0x19, 0x2a, 0x09, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x32, 0x0a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x20, - 0x6c, 0x69, 0x73, 0x74, 0x40, 0x01, 0x42, 0x80, 0x02, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, - 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, - 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x0a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x54, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x52, 0x61, 0x66, 0x61, 0x79, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x73, 0x2f, 0x72, 0x63, - 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x6d, 0x67, 0x6d, 0x74, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x70, 0x62, - 0x2f, 0x76, 0x33, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x76, 0x33, 0xa2, 0x02, 0x04, 0x52, 0x44, 0x54, - 0x55, 0xaa, 0x02, 0x17, 0x52, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x44, 0x65, 0x76, 0x2e, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x33, 0xca, 0x02, 0x17, 0x52, 0x61, - 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x55, 0x73, - 0x65, 0x72, 0x5c, 0x56, 0x33, 0xe2, 0x02, 0x23, 0x52, 0x61, 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, - 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x33, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1b, 0x52, 0x61, - 0x66, 0x61, 0x79, 0x3a, 0x3a, 0x44, 0x65, 0x76, 0x3a, 0x3a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x3a, - 0x3a, 0x55, 0x73, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x63, 0x65, 0x40, 0x01, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x5f, + 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x42, 0x29, 0x92, + 0x41, 0x26, 0x2a, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x32, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x20, + 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x40, 0x01, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x3a, + 0x1e, 0x92, 0x41, 0x1b, 0x0a, 0x19, 0x2a, 0x09, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x69, 0x73, + 0x74, 0x32, 0x0a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x40, 0x01, 0x42, + 0x80, 0x02, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, + 0x0a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x54, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x52, 0x61, 0x66, 0x61, 0x79, 0x53, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x73, 0x2f, 0x72, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x62, 0x61, + 0x73, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x75, 0x73, + 0x65, 0x72, 0x6d, 0x67, 0x6d, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x70, 0x62, 0x2f, 0x76, 0x33, 0x3b, 0x75, 0x73, 0x65, + 0x72, 0x76, 0x33, 0xa2, 0x02, 0x04, 0x52, 0x44, 0x54, 0x55, 0xaa, 0x02, 0x17, 0x52, 0x61, 0x66, + 0x61, 0x79, 0x2e, 0x44, 0x65, 0x76, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x2e, 0x56, 0x33, 0xca, 0x02, 0x17, 0x52, 0x61, 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, 0x76, + 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x33, 0xe2, 0x02, + 0x23, 0x52, 0x61, 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, + 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x33, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1b, 0x52, 0x61, 0x66, 0x61, 0x79, 0x3a, 0x3a, 0x44, 0x65, + 0x76, 0x3a, 0x3a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x3a, 0x3a, 0x55, 0x73, 0x65, 0x72, 0x3a, 0x3a, + 0x56, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/components/usermgmt/proto/types/userpb/v3/group.proto b/components/usermgmt/proto/types/userpb/v3/group.proto index c4cc674..1a1725b 100644 --- a/components/usermgmt/proto/types/userpb/v3/group.proto +++ b/components/usermgmt/proto/types/userpb/v3/group.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package rafay.dev.types.user.v3; import "proto/types/commonpb/v3/common.proto"; -import "proto/types/systempb/v3/project.proto"; import "proto/types/userpb/v3/role.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; // import "google/api/field_behavior.proto"; diff --git a/components/usermgmt/proto/types/userpb/v3/role.pb.go b/components/usermgmt/proto/types/userpb/v3/role.pb.go index 5f96485..28b82a1 100644 --- a/components/usermgmt/proto/types/userpb/v3/role.pb.go +++ b/components/usermgmt/proto/types/userpb/v3/role.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc (unknown) // source: proto/types/userpb/v3/role.proto package userv3 diff --git a/components/usermgmt/proto/types/userpb/v3/rolepermission.pb.go b/components/usermgmt/proto/types/userpb/v3/rolepermission.pb.go index da3f871..a496f7c 100644 --- a/components/usermgmt/proto/types/userpb/v3/rolepermission.pb.go +++ b/components/usermgmt/proto/types/userpb/v3/rolepermission.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc (unknown) // source: proto/types/userpb/v3/rolepermission.proto package userv3 diff --git a/components/usermgmt/proto/types/userpb/v3/user.pb.go b/components/usermgmt/proto/types/userpb/v3/user.pb.go index e9a0be4..84d45cc 100644 --- a/components/usermgmt/proto/types/userpb/v3/user.pb.go +++ b/components/usermgmt/proto/types/userpb/v3/user.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc (unknown) // source: proto/types/userpb/v3/user.proto package userv3 import ( - _ "github.com/RafaySystems/rcloud-base/components/adminsrv/proto/types/systempb/v3" v3 "github.com/RafaySystems/rcloud-base/components/common/proto/types/commonpb/v3" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -292,140 +291,137 @@ var file_proto_types_userpb_v3_user_proto_rawDesc = []byte{ 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x70, 0x62, 0x2f, 0x76, 0x33, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x25, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x70, 0x62, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x97, 0x04, 0x0a, 0x04, 0x55, 0x73, - 0x65, 0x72, 0x12, 0x68, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x48, 0x92, 0x41, 0x45, 0x2a, 0x0b, 0x41, 0x50, 0x49, - 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x20, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, - 0x72, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x14, 0x73, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x2e, 0x6b, 0x38, 0x73, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x33, - 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x04, - 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0x92, 0x41, 0x27, 0x2a, - 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x32, 0x19, 0x4b, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x3a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x6d, 0x0a, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, - 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x42, 0x2c, 0x92, 0x41, 0x29, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x32, 0x1d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x5b, 0x0a, 0x04, 0x73, - 0x70, 0x65, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x72, 0x61, 0x66, 0x61, - 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x42, 0x24, 0x92, 0x41, - 0x21, 0x2a, 0x04, 0x53, 0x70, 0x65, 0x63, 0x32, 0x19, 0x53, 0x70, 0x65, 0x63, 0x20, 0x6f, 0x66, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x60, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, - 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x25, 0x92, 0x41, 0x22, - 0x2a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0x16, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x40, 0x01, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3a, 0x37, 0x92, 0x41, 0x34, 0x0a, - 0x32, 0x2a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x32, 0x04, 0x55, 0x73, 0x65, 0x72, 0xd2, 0x01, 0x0a, - 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0xd2, 0x01, 0x04, 0x6b, 0x69, 0x6e, - 0x64, 0xd2, 0x01, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xd2, 0x01, 0x04, 0x73, - 0x70, 0x65, 0x63, 0x22, 0x95, 0x06, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, - 0x12, 0x44, 0x0a, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x26, 0x92, 0x41, 0x23, 0x2a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, - 0x61, 0x6d, 0x65, 0x32, 0x16, 0x46, 0x69, 0x72, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, - 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x52, 0x09, 0x66, 0x69, 0x72, - 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x24, 0x92, 0x41, 0x21, 0x2a, 0x08, 0x4c, - 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x32, 0x15, 0x4c, 0x61, 0x73, 0x74, 0x20, 0x6e, 0x61, - 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x52, 0x08, - 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x24, 0x92, 0x41, 0x21, 0x2a, 0x05, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x32, 0x18, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x52, 0x05, 0x70, - 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x23, 0x92, 0x41, 0x20, 0x2a, 0x08, 0x50, 0x61, 0x73, - 0x73, 0x77, 0x6f, 0x72, 0x64, 0x32, 0x14, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x20, - 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x52, 0x08, 0x70, 0x61, 0x73, - 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x40, 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x09, 0x42, 0x28, 0x92, 0x41, 0x25, 0x2a, 0x05, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x32, 0x1a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, - 0x65, 0x72, 0x20, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x73, 0x20, 0x74, 0x6f, 0x40, 0x01, 0x52, - 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0xaf, 0x01, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, - 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, - 0x33, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x4a, 0x92, 0x41, 0x47, 0x2a, 0x15, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x97, 0x04, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x68, 0x0a, 0x0a, 0x61, + 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x48, 0x92, 0x41, 0x45, 0x2a, 0x0b, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x32, 0x20, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, + 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x3a, 0x14, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x6b, 0x38, 0x73, 0x6d, + 0x67, 0x6d, 0x74, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x33, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x2a, 0x92, 0x41, 0x27, 0x2a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x32, 0x19, + 0x4b, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, + 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x6d, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x2c, 0x92, 0x41, + 0x29, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x32, 0x1d, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, + 0x72, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x5b, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x70, 0x65, 0x63, 0x42, 0x24, 0x92, 0x41, 0x21, 0x2a, 0x04, 0x53, 0x70, 0x65, 0x63, + 0x32, 0x19, 0x53, 0x70, 0x65, 0x63, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, + 0x65, 0x72, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x04, 0x73, 0x70, 0x65, + 0x63, 0x12, 0x60, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x42, 0x25, 0x92, 0x41, 0x22, 0x2a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x32, 0x16, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, + 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x3a, 0x37, 0x92, 0x41, 0x34, 0x0a, 0x32, 0x2a, 0x04, 0x55, 0x73, 0x65, 0x72, + 0x32, 0x04, 0x55, 0x73, 0x65, 0x72, 0xd2, 0x01, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0xd2, 0x01, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0xd2, 0x01, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xd2, 0x01, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0x95, 0x06, 0x0a, + 0x08, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x12, 0x44, 0x0a, 0x09, 0x66, 0x69, 0x72, + 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x26, 0x92, 0x41, + 0x23, 0x2a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x32, 0x16, 0x46, 0x69, + 0x72, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x75, 0x73, 0x65, 0x72, 0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x40, 0x0a, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x24, 0x92, 0x41, 0x21, 0x2a, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, + 0x32, 0x15, 0x4c, 0x61, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x3a, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x24, 0x92, 0x41, 0x21, 0x2a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x32, 0x18, 0x50, 0x68, + 0x6f, 0x6e, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, + 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x3f, 0x0a, + 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x23, 0x92, 0x41, 0x20, 0x2a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x32, 0x14, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x75, 0x73, 0x65, 0x72, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x40, + 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x42, 0x28, + 0x92, 0x41, 0x25, 0x2a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x32, 0x1a, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x62, 0x65, 0x6c, 0x6f, + 0x6e, 0x67, 0x73, 0x20, 0x74, 0x6f, 0x40, 0x01, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, + 0x12, 0xaf, 0x01, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x42, + 0x4a, 0x92, 0x41, 0x47, 0x2a, 0x15, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x32, 0x2e, 0x50, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2c, + 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x20, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x75, 0x73, 0x65, 0x72, 0x52, 0x15, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, - 0x65, 0x73, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x20, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2c, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x20, 0x61, 0x73, 0x73, - 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x75, 0x73, - 0x65, 0x72, 0x52, 0x15, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x6e, 0x0a, 0x0d, 0x65, 0x6d, 0x61, - 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, - 0x42, 0x48, 0x92, 0x41, 0x45, 0x2a, 0x0d, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x32, 0x32, 0x46, 0x6c, 0x61, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x68, - 0x6f, 0x77, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x20, - 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x77, 0x61, 0x73, 0x20, - 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x40, 0x01, 0x52, 0x0d, 0x65, 0x6d, 0x61, 0x69, - 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x0d, 0x70, 0x68, 0x6f, - 0x6e, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, - 0x42, 0x4b, 0x92, 0x41, 0x48, 0x2a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x56, 0x65, 0x72, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x32, 0x35, 0x46, 0x6c, 0x61, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x68, - 0x6f, 0x77, 0x20, 0x69, 0x66, 0x20, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x77, - 0x61, 0x73, 0x20, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x40, 0x01, 0x52, 0x0d, 0x70, - 0x68, 0x6f, 0x6e, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x3a, 0x2d, 0x92, 0x41, - 0x2a, 0x0a, 0x28, 0x2a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x20, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x12, 0x55, 0x73, 0x65, 0x72, 0x20, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xbf, 0x03, 0x0a, 0x08, - 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x71, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x51, 0x92, 0x41, - 0x4e, 0x2a, 0x0b, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x25, - 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x16, 0x75, 0x73, 0x65, 0x72, 0x6d, 0x67, 0x6d, 0x74, 0x2e, - 0x6b, 0x38, 0x73, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x33, 0x40, 0x01, 0x52, - 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x04, 0x6b, - 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x35, 0x92, 0x41, 0x32, 0x2a, 0x04, - 0x4b, 0x69, 0x6e, 0x64, 0x32, 0x1e, 0x4b, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x3a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x40, 0x01, - 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x78, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, - 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x42, 0x33, 0x92, 0x41, 0x30, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x32, 0x22, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x12, 0x5d, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1d, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x28, - 0x92, 0x41, 0x25, 0x2a, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x32, 0x1a, 0x4c, 0x69, 0x73, 0x74, - 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x40, 0x01, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x3a, - 0x1c, 0x92, 0x41, 0x19, 0x0a, 0x17, 0x2a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, - 0x32, 0x09, 0x55, 0x73, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x40, 0x01, 0x42, 0xff, 0x01, - 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x09, 0x55, - 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x54, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x52, 0x61, 0x66, 0x61, 0x79, 0x53, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x73, 0x2f, 0x72, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x62, 0x61, 0x73, 0x65, 0x2f, - 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x6d, - 0x67, 0x6d, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, - 0x75, 0x73, 0x65, 0x72, 0x70, 0x62, 0x2f, 0x76, 0x33, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x76, 0x33, - 0xa2, 0x02, 0x04, 0x52, 0x44, 0x54, 0x55, 0xaa, 0x02, 0x17, 0x52, 0x61, 0x66, 0x61, 0x79, 0x2e, - 0x44, 0x65, 0x76, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, - 0x33, 0xca, 0x02, 0x17, 0x52, 0x61, 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x33, 0xe2, 0x02, 0x23, 0x52, 0x61, - 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x55, 0x73, - 0x65, 0x72, 0x5c, 0x56, 0x33, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x1b, 0x52, 0x61, 0x66, 0x61, 0x79, 0x3a, 0x3a, 0x44, 0x65, 0x76, 0x3a, 0x3a, - 0x54, 0x79, 0x70, 0x65, 0x73, 0x3a, 0x3a, 0x55, 0x73, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x33, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x12, 0x6e, 0x0a, 0x0d, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x42, 0x48, 0x92, 0x41, 0x45, 0x2a, 0x0d, + 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x32, 0x32, 0x46, + 0x6c, 0x61, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x68, 0x6f, 0x77, 0x20, 0x69, 0x66, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x75, 0x73, 0x65, 0x72, 0x20, 0x77, 0x61, 0x73, 0x20, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x40, 0x01, 0x52, 0x0d, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x12, 0x71, 0x0a, 0x0d, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x42, 0x4b, 0x92, 0x41, 0x48, 0x2a, 0x0d, + 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x32, 0x35, 0x46, + 0x6c, 0x61, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x68, 0x6f, 0x77, 0x20, 0x69, 0x66, 0x20, 0x70, + 0x68, 0x6f, 0x6e, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x77, 0x61, 0x73, 0x20, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x40, 0x01, 0x52, 0x0d, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x56, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x3a, 0x2d, 0x92, 0x41, 0x2a, 0x0a, 0x28, 0x2a, 0x12, 0x55, 0x73, + 0x65, 0x72, 0x20, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x32, 0x12, 0x55, 0x73, 0x65, 0x72, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xbf, 0x03, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, + 0x74, 0x12, 0x71, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x51, 0x92, 0x41, 0x4e, 0x2a, 0x0b, 0x41, 0x50, 0x49, 0x20, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x25, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, + 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x16, + 0x75, 0x73, 0x65, 0x72, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x6b, 0x38, 0x73, 0x6d, 0x67, 0x6d, 0x74, + 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x33, 0x40, 0x01, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x35, 0x92, 0x41, 0x32, 0x2a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x32, 0x1e, 0x4b, + 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, + 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x08, 0x55, + 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x40, 0x01, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, + 0x78, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x33, 0x92, 0x41, 0x30, 0x2a, + 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x32, 0x22, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, + 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x5d, 0x0a, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, + 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, + 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x28, 0x92, 0x41, 0x25, 0x2a, 0x05, 0x49, 0x74, + 0x65, 0x6d, 0x73, 0x32, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, + 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x40, + 0x01, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x3a, 0x1c, 0x92, 0x41, 0x19, 0x0a, 0x17, 0x2a, + 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x32, 0x09, 0x55, 0x73, 0x65, 0x72, 0x20, + 0x6c, 0x69, 0x73, 0x74, 0x40, 0x01, 0x42, 0xff, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, + 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, + 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x09, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x54, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x52, 0x61, 0x66, 0x61, 0x79, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x73, 0x2f, 0x72, 0x63, 0x6c, + 0x6f, 0x75, 0x64, 0x2d, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, + 0x6e, 0x74, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x6d, 0x67, 0x6d, 0x74, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x70, 0x62, 0x2f, + 0x76, 0x33, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x76, 0x33, 0xa2, 0x02, 0x04, 0x52, 0x44, 0x54, 0x55, + 0xaa, 0x02, 0x17, 0x52, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x44, 0x65, 0x76, 0x2e, 0x54, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x33, 0xca, 0x02, 0x17, 0x52, 0x61, 0x66, + 0x61, 0x79, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x55, 0x73, 0x65, + 0x72, 0x5c, 0x56, 0x33, 0xe2, 0x02, 0x23, 0x52, 0x61, 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, 0x76, + 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x33, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1b, 0x52, 0x61, 0x66, + 0x61, 0x79, 0x3a, 0x3a, 0x44, 0x65, 0x76, 0x3a, 0x3a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x3a, 0x3a, + 0x55, 0x73, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/components/usermgmt/proto/types/userpb/v3/user.proto b/components/usermgmt/proto/types/userpb/v3/user.proto index 5ba30cb..a30640f 100644 --- a/components/usermgmt/proto/types/userpb/v3/user.proto +++ b/components/usermgmt/proto/types/userpb/v3/user.proto @@ -5,7 +5,6 @@ import "proto/types/commonpb/v3/common.proto"; import "proto/types/userpb/v3/role.proto"; import "proto/types/userpb/v3/rolepermission.proto"; import "proto/types/userpb/v3/group.proto"; -import "proto/types/systempb/v3/project.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; // import "google/api/field_behavior.proto";