-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
hide issues from org private repos w/o team assignment #4034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6f46ee3
0e3c279
0b4402b
2d77d18
17b946e
8ea95f6
a122731
cab5121
a1fdf48
7b990f7
4ea560c
abdaa54
4e21fc7
498357b
d7b0a49
f5a3465
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,12 @@ func TestAccessLevel(t *testing.T) { | |
|
||
user1 := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) | ||
user2 := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User) | ||
repo1 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 2, IsPrivate: false}).(*Repository) | ||
repo2 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 3, IsPrivate: true}).(*Repository) | ||
// A public repository owned by User 2 | ||
repo1 := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) | ||
assert.False(t, repo1.IsPrivate) | ||
// A private repository owned by Org 3 | ||
repo2 := AssertExistsAndLoadBean(t, &Repository{ID: 3}).(*Repository) | ||
assert.True(t, repo2.IsPrivate) | ||
|
||
level, err := AccessLevel(user1.ID, repo1) | ||
assert.NoError(t, err) | ||
|
@@ -47,8 +51,12 @@ func TestHasAccess(t *testing.T) { | |
|
||
user1 := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) | ||
user2 := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User) | ||
repo1 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 2, IsPrivate: false}).(*Repository) | ||
repo2 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 3, IsPrivate: true}).(*Repository) | ||
// A public repository owned by User 2 | ||
repo1 := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Since it is not supported to use bools in xorm, I propose to add an check if IsPrivate is set right: assert.False(t, repo1.IsPrivate) or assert.True(t, repo1.IsPrivate) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed it such that it really loads the expected repository. The resulting repository is the same, just an assurance. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But it would be good to check that the repository is really private/public a comment does not ensure that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can add it of course, just think that it's nothing that adds value since its predefined by the fixtures anyway. |
||
assert.False(t, repo1.IsPrivate) | ||
// A private repository owned by Org 3 | ||
repo2 := AssertExistsAndLoadBean(t, &Repository{ID: 3}).(*Repository) | ||
assert.True(t, repo2.IsPrivate) | ||
|
||
for _, accessMode := range accessModes { | ||
has, err := HasAccess(user1.ID, repo1, accessMode) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
- | ||
id: 1 | ||
team_id: 1 | ||
type: 1 | ||
|
||
- | ||
id: 2 | ||
team_id: 1 | ||
type: 2 | ||
|
||
- | ||
id: 3 | ||
team_id: 1 | ||
type: 3 | ||
|
||
- | ||
id: 4 | ||
team_id: 1 | ||
type: 4 | ||
|
||
- | ||
id: 5 | ||
team_id: 1 | ||
type: 5 | ||
|
||
- | ||
id: 6 | ||
team_id: 1 | ||
type: 6 | ||
|
||
- | ||
id: 7 | ||
team_id: 1 | ||
type: 7 | ||
|
||
- | ||
id: 8 | ||
team_id: 2 | ||
type: 1 | ||
|
||
- | ||
id: 9 | ||
team_id: 2 | ||
type: 2 | ||
|
||
- | ||
id: 10 | ||
team_id: 2 | ||
type: 3 | ||
|
||
- | ||
id: 11 | ||
team_id: 2 | ||
type: 4 | ||
|
||
- | ||
id: 12 | ||
team_id: 2 | ||
type: 5 | ||
|
||
- | ||
id: 13 | ||
team_id: 2 | ||
type: 6 | ||
|
||
- | ||
id: 14 | ||
team_id: 2 | ||
type: 7 | ||
|
||
- | ||
id: 15 | ||
team_id: 3 | ||
type: 1 | ||
|
||
- | ||
id: 16 | ||
team_id: 3 | ||
type: 2 | ||
|
||
- | ||
id: 17 | ||
team_id: 3 | ||
type: 3 | ||
|
||
- | ||
id: 18 | ||
team_id: 3 | ||
type: 4 | ||
|
||
- | ||
id: 19 | ||
team_id: 3 | ||
type: 5 | ||
|
||
- | ||
id: 20 | ||
team_id: 3 | ||
type: 6 | ||
|
||
- | ||
id: 21 | ||
team_id: 3 | ||
type: 7 | ||
|
||
- | ||
id: 22 | ||
team_id: 4 | ||
type: 1 | ||
|
||
- | ||
id: 23 | ||
team_id: 4 | ||
type: 2 | ||
|
||
- | ||
id: 24 | ||
team_id: 4 | ||
type: 3 | ||
|
||
- | ||
id: 25 | ||
team_id: 4 | ||
type: 4 | ||
|
||
- | ||
id: 26 | ||
team_id: 4 | ||
type: 5 | ||
|
||
- | ||
id: 27 | ||
team_id: 4 | ||
type: 6 | ||
|
||
- | ||
id: 28 | ||
team_id: 4 | ||
type: 7 | ||
|
||
- | ||
id: 29 | ||
team_id: 5 | ||
type: 1 | ||
|
||
- | ||
id: 30 | ||
team_id: 5 | ||
type: 2 | ||
|
||
- | ||
id: 31 | ||
team_id: 5 | ||
type: 3 | ||
|
||
- | ||
id: 32 | ||
team_id: 5 | ||
type: 4 | ||
|
||
- | ||
id: 33 | ||
team_id: 5 | ||
type: 5 | ||
|
||
- | ||
id: 34 | ||
team_id: 5 | ||
type: 6 | ||
|
||
- | ||
id: 35 | ||
team_id: 5 | ||
type: 7 | ||
|
||
- | ||
id: 36 | ||
team_id: 6 | ||
type: 1 | ||
|
||
- | ||
id: 37 | ||
team_id: 6 | ||
type: 2 | ||
|
||
- | ||
id: 38 | ||
team_id: 6 | ||
type: 3 | ||
|
||
- | ||
id: 39 | ||
team_id: 6 | ||
type: 4 | ||
|
||
- | ||
id: 40 | ||
team_id: 6 | ||
type: 5 | ||
|
||
- | ||
id: 41 | ||
team_id: 6 | ||
type: 6 | ||
|
||
- | ||
id: 42 | ||
team_id: 6 | ||
type: 7 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ | |
is_admin: false | ||
avatar: avatar3 | ||
avatar_email: [email protected] | ||
num_repos: 2 | ||
num_repos: 3 | ||
num_members: 2 | ||
num_teams: 2 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the
IsPrivate: false
part?