This is the codeAbility Sharing Platform! Learn more about the
codeAbility Sharing Platform
.
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
codeAbility Sharing Platform
Manage
Activity
Members
Labels
Plan
Issues
43
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
development
sharing
codeAbility Sharing Platform
Commits
0628aabc
Commit
0628aabc
authored
3 years ago
by
Daniel Crazzolara
Browse files
Options
Downloads
Patches
Plain Diff
Changed to 'only MAINTAINERS' can import
parent
dcbfd616
2 merge requests
!188
Merging Peer Reviewing et. al to Master
,
!164
211 peer reviewing functionality
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/at/ac/uibk/gitsearch/service/GitlabService.java
+4
-4
4 additions, 4 deletions
...main/java/at/ac/uibk/gitsearch/service/GitlabService.java
src/main/java/at/ac/uibk/gitsearch/web/rest/GitlabResource.java
+1
-2
1 addition, 2 deletions
...in/java/at/ac/uibk/gitsearch/web/rest/GitlabResource.java
with
5 additions
and
6 deletions
src/main/java/at/ac/uibk/gitsearch/service/GitlabService.java
+
4
−
4
View file @
0628aabc
...
@@ -297,13 +297,13 @@ public class GitlabService {
...
@@ -297,13 +297,13 @@ public class GitlabService {
/**
/**
* Used to retrieve all Gitlab groups where the current user
* Used to retrieve all Gitlab groups where the current user
* has at least a
DEVELOP
ER membership
* has at least a
MAINTAIN
ER membership
*
*
* @return List of all groups with at least
DEVELOP
ER membership
* @return List of all groups with at least
MAINTAIN
ER membership
* @throws AuthenticationException
* @throws AuthenticationException
* @throws GitLabApiException
* @throws GitLabApiException
*/
*/
public
List
<
Group
>
getAllGroupsWithAtLeast
Develop
erRole
()
throws
AuthenticationException
,
GitLabApiException
{
public
List
<
Group
>
getAllGroupsWithAtLeast
Maintain
erRole
()
throws
AuthenticationException
,
GitLabApiException
{
UserApi
userApi
=
gitLabRepository
.
getGitLabApi
(
tokenProvider
.
getGitLabAccessInfo
()).
getUserApi
();
UserApi
userApi
=
gitLabRepository
.
getGitLabApi
(
tokenProvider
.
getGitLabAccessInfo
()).
getUserApi
();
GroupApi
groupApi
=
gitLabRepository
.
getGitLabApi
(
tokenProvider
.
getGitLabAccessInfo
()).
getGroupApi
();
GroupApi
groupApi
=
gitLabRepository
.
getGitLabApi
(
tokenProvider
.
getGitLabAccessInfo
()).
getGroupApi
();
Integer
userId
=
userApi
.
getCurrentUser
().
getId
();
Integer
userId
=
userApi
.
getCurrentUser
().
getId
();
...
@@ -312,7 +312,7 @@ public class GitlabService {
...
@@ -312,7 +312,7 @@ public class GitlabService {
List
<
Group
>
groups
=
getGroups
();
List
<
Group
>
groups
=
getGroups
();
groups
=
groups
.
stream
().
filter
(
group
->
{
groups
=
groups
.
stream
().
filter
(
group
->
{
try
{
try
{
return
groupApi
.
getMember
(
group
.
getId
(),
userId
,
true
).
getAccessLevel
().
value
>=
3
0
;
return
groupApi
.
getMember
(
group
.
getId
(),
userId
,
true
).
getAccessLevel
().
value
>=
4
0
;
}
catch
(
GitLabApiException
e
)
{
}
catch
(
GitLabApiException
e
)
{
log
.
warn
(
"Could not retrieve membership of user [{}] for group [{}]. Skipping.."
,
userId
,
group
.
getId
());
log
.
warn
(
"Could not retrieve membership of user [{}] for group [{}]. Skipping.."
,
userId
,
group
.
getId
());
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/at/ac/uibk/gitsearch/web/rest/GitlabResource.java
+
1
−
2
View file @
0628aabc
...
@@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.naming.AuthenticationException
;
import
javax.naming.AuthenticationException
;
import
java.nio.file.attribute.GroupPrincipal
;
import
java.util.List
;
import
java.util.List
;
@RestController
@RestController
...
@@ -35,7 +34,7 @@ public class GitlabResource {
...
@@ -35,7 +34,7 @@ public class GitlabResource {
@GetMapping
(
"/groups"
)
@GetMapping
(
"/groups"
)
public
ResponseEntity
<
List
<
Group
>>
getUserGroups
()
throws
GitLabApiException
{
public
ResponseEntity
<
List
<
Group
>>
getUserGroups
()
throws
GitLabApiException
{
try
{
try
{
return
ResponseEntity
.
ok
(
gitlabService
.
getAllGroupsWithAtLeast
Develop
erRole
());
return
ResponseEntity
.
ok
(
gitlabService
.
getAllGroupsWithAtLeast
Maintain
erRole
());
}
catch
(
AuthenticationException
ae
)
{
}
catch
(
AuthenticationException
ae
)
{
return
ResponseEntity
.
status
(
401
).
body
(
null
);
return
ResponseEntity
.
status
(
401
).
body
(
null
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment