diff --git a/pkg/integrations/list_test.go b/pkg/integrations/list_test.go index b5da32154..1a5fc3f32 100644 --- a/pkg/integrations/list_test.go +++ b/pkg/integrations/list_test.go @@ -72,13 +72,27 @@ func TestList(t *testing.T) { assert.Error(t, err) assert.Contains(t, err.(*echo.HTTPError).Message, `You don't have the right to see this`) }) - t.Run("Shared Via Team", func(t *testing.T) { + // TODO: Each of these rights checks should also be checked for each right + // since everyone who has a right should be able to see the list, regardless of their right + t.Run("Shared Via Team readonly", func(t *testing.T) { + rec, err := testHandler.testReadOne(nil, map[string]string{"list": "6"}) + assert.NoError(t, err) + assert.Contains(t, rec.Body.String(), `"title":"Test6"`) + }) + t.Run("Shared Via Team write", func(t *testing.T) { + rec, err := testHandler.testReadOne(nil, map[string]string{"list": "7"}) + assert.NoError(t, err) + assert.Contains(t, rec.Body.String(), `"title":"Test7"`) + }) + t.Run("Shared Via Team admin", func(t *testing.T) { + rec, err := testHandler.testReadOne(nil, map[string]string{"list": "8"}) + assert.NoError(t, err) + assert.Contains(t, rec.Body.String(), `"title":"Test8"`) + }) + t.Run("Shared Via User", func(t *testing.T) { rec, err := testHandler.testReadOne(nil, map[string]string{"list": "3"}) assert.NoError(t, err) assert.Contains(t, rec.Body.String(), `"title":"Test3"`) - }) - t.Run("Shared Via User", func(t *testing.T) { - }) t.Run("Shared Via Namespace-Team", func(t *testing.T) { diff --git a/pkg/models/fixtures/list.yml b/pkg/models/fixtures/list.yml index 5a987759c..8c86df2cb 100644 --- a/pkg/models/fixtures/list.yml +++ b/pkg/models/fixtures/list.yml @@ -38,3 +38,35 @@ namespace_id: 5 updated: 0 created: 0 +- + id: 6 + title: Test6 + description: Lorem Ipsum + owner_id: 6 + namespace_id: 6 + updated: 0 + created: 0 +- + id: 7 + title: Test7 + description: Lorem Ipsum + owner_id: 6 + namespace_id: 6 + updated: 0 + created: 0 +- + id: 8 + title: Test8 + description: Lorem Ipsum + owner_id: 6 + namespace_id: 6 + updated: 0 + created: 0 +- + id: 9 + title: Test9 + description: Lorem Ipsum + owner_id: 6 + namespace_id: 6 + updated: 0 + created: 0 diff --git a/pkg/models/fixtures/namespaces.yml b/pkg/models/fixtures/namespaces.yml index e1a087c4d..760779f59 100644 --- a/pkg/models/fixtures/namespaces.yml +++ b/pkg/models/fixtures/namespaces.yml @@ -19,3 +19,10 @@ owner_id: 3 updated: 0 created: 0 +- + id: 6 + name: testnamespace6 + description: Lorem Ipsum + owner_id: 6 + updated: 0 + created: 0 diff --git a/pkg/models/fixtures/team_list.yml b/pkg/models/fixtures/team_list.yml index a1b875ece..136690726 100644 --- a/pkg/models/fixtures/team_list.yml +++ b/pkg/models/fixtures/team_list.yml @@ -5,9 +5,26 @@ updated: 0 created: 0 +# This team has read only access on list 6 - id: 2 team_id: 2 - list_id: 3 + list_id: 6 right: 0 updated: 0 created: 0 + +# This team has write access on list 7 +- id: 3 + team_id: 3 + list_id: 7 + right: 1 + updated: 0 + created: 0 + +# This team has admin access on list 8 +- id: 4 + team_id: 4 + list_id: 8 + right: 0 + updated: 0 + created: 0 \ No newline at end of file diff --git a/pkg/models/fixtures/team_members.yml b/pkg/models/fixtures/team_members.yml index cb5fe042b..407c84264 100644 --- a/pkg/models/fixtures/team_members.yml +++ b/pkg/models/fixtures/team_members.yml @@ -7,3 +7,15 @@ team_id: 1 user_id: 2 created: 0 +- + team_id: 2 + user_id: 1 + created: 0 +- + team_id: 3 + user_id: 1 + created: 0 +- + team_id: 4 + user_id: 1 + created: 0 diff --git a/pkg/models/fixtures/teams.yml b/pkg/models/fixtures/teams.yml index dab8f9134..c9c9b5da4 100644 --- a/pkg/models/fixtures/teams.yml +++ b/pkg/models/fixtures/teams.yml @@ -2,4 +2,13 @@ id: 1 name: testteam1 description: Lorem Ipsum + created_by_id: 1 +- id: 2 + name: testteam2_read_only_on_list6 + created_by_id: 1 +- id: 3 + name: testteam3_write_on_list7 + created_by_id: 1 +- id: 4 + name: testteam4_admin_on_list8 created_by_id: 1 \ No newline at end of file diff --git a/pkg/models/fixtures/users.yml b/pkg/models/fixtures/users.yml index 47f739df8..22bba8614 100644 --- a/pkg/models/fixtures/users.yml +++ b/pkg/models/fixtures/users.yml @@ -33,8 +33,16 @@ id: 5 username: 'user5' password: '$2a$14$dcadBoMBL9jQoOcZK8Fju.cy0Ptx2oZECkKLnaa8ekRoTFe1w7To.' # 1234 - email: 'user4@example.com' + email: 'user5@example.com' email_confirm_token: tiepiQueed8ahc7zeeFe1eveiy4Ein8osooxegiephauph2Ael is_active: false updated: 0 created: 0 +# This use is used to create a whole bunch of lists which are then shared directly with a user +- id: 6 + username: 'user6' + password: '$2a$14$dcadBoMBL9jQoOcZK8Fju.cy0Ptx2oZECkKLnaa8ekRoTFe1w7To.' # 1234 + email: 'user6@example.com' + is_active: true + updated: 0 + created: 0