-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
org/members: display 2FA members states + optimize sql requests #7621
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
Merged
techknowlogick
merged 23 commits into
go-gitea:master
from
sapk-fork:display-2fa-mermbers
Aug 2, 2019
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
602ba7b
org/members: display 2FA state
sapk 3dca80e
fix comment typo
sapk b2b2cbf
lay down UserList bases
sapk 225467f
add basic test for previous methods
sapk 564c313
add comment for UserList type
sapk 68b1505
add valid two-fa account
sapk fd16091
test new UserList methods
sapk 6839402
optimize MembersIsPublic by side loading info on GetMembers + fix int…
sapk 385e1d8
respect fmt rules
sapk f5046af
use map for data
sapk 2494db4
Optimize GetTwoFaStatus
sapk 4f44e72
rewrite by using existing sub func
sapk b74810f
Optimize IsUserOrgOwner
sapk 371a4fb
remove un-used code
sapk 3b6b0de
tests: cover empty org + fix import order
sapk dfcbb89
tests: add ErrTeamNotExist path
sapk 4371160
tests: fix wrong expected result
sapk 398d3e4
Merge branch 'master' into display-2fa-mermbers
sapk 41712c1
Merge branch 'master' into display-2fa-mermbers
sapk 65e0f43
Merge branch 'master' into display-2fa-mermbers
sapk 26ed9de
Merge branch 'master' into display-2fa-mermbers
sapk 6b03f6e
Merge branch 'master' into display-2fa-mermbers
sapk 1e79d62
Merge branch 'master' into display-2fa-mermbers
lafriks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
lay down UserList bases
- Loading branch information
commit b2b2cbf2713bfddaa72328cc7f2f8a52c63bcdc1
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2019 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package models | ||
|
||
type UserList []*User | ||
|
||
//TODO paginate | ||
|
||
// IsPublicMember returns true if user public his/her membership in given organization. | ||
func (ul UserList) IsPublicMember(orgID int64) []bool { | ||
results := make([]bool, len(ul)) | ||
//TODO use directly xorm | ||
for i, u := range ul { | ||
results[i] = u.IsPublicMember(orgID) | ||
} | ||
return results | ||
} | ||
|
||
// IsUserOrgOwner returns true if user is in the owner team of given organization. | ||
func (ul UserList) IsUserOrgOwner(orgID int64) []bool { | ||
results := make([]bool, len(ul)) | ||
//TODO use directly xorm | ||
for i, u := range ul { | ||
results[i] = u.IsUserOrgOwner(orgID) | ||
} | ||
return results | ||
} | ||
|
||
// IsTwoFaEnrolled return state of 2FA enrollement | ||
func (ul UserList) IsTwoFaEnrolled() []bool { | ||
results := make([]bool, len(ul)) | ||
//TODO use directly xorm | ||
for i, u := range ul { | ||
results[i] = u.IsTwoFaEnrolled() | ||
} | ||
return results | ||
} |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.