forked from raystack/frontier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow by default if none of the permission is evaluated"
- Loading branch information
1 parent
0cb2a94
commit 0b2f555
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,6 +184,38 @@ func (s *EndToEndProxySmokeTestSuite) TestProxyToEchoServer() { | |
s.Assert().Equal(401, res.StatusCode) | ||
}) | ||
|
||
s.Run("permission expression: if none of the permission is evaluated, user shall be authenticated", func() { | ||
groupDetail, err := s.client.GetGroup(context.Background(), &shieldv1beta1.GetGroupRequest{Id: s.groupID}) | ||
s.Require().NoError(err) | ||
|
||
url := fmt.Sprintf("http://localhost:%d/api/create_firehose_based_on_sink", s.appConfig.Proxy.Services[0].Port) | ||
reqBodyMap := map[string]any{ | ||
"project": s.projID, | ||
"name": "test-resource-group-slug", | ||
"group_slug": groupDetail.GetGroup().GetSlug(), | ||
"organization": s.orgID, | ||
"configs": map[string]any{ | ||
"env_vars": map[string]any{ | ||
"SINK_TYPE": "log", | ||
}, | ||
}, | ||
} | ||
reqBodyBytes, err := json.Marshal(reqBodyMap) | ||
s.Require().NoError(err) | ||
|
||
req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(reqBodyBytes)) | ||
s.Require().NoError(err) | ||
|
||
req.Header.Set(testbench.IdentityHeader, "[email protected]") | ||
|
||
res, err := http.DefaultClient.Do(req) | ||
s.Require().NoError(err) | ||
|
||
defer res.Body.Close() | ||
fmt.Println("BODY", res) | ||
s.Assert().Equal(200, res.StatusCode) | ||
}) | ||
|
||
s.Run("resource created on echo server should persist in shieldDB when using group slug", func() { | ||
groupDetail, err := s.client.GetGroup(context.Background(), &shieldv1beta1.GetGroupRequest{Id: s.groupID}) | ||
s.Require().NoError(err) | ||
|