Skip to content

Commit 930afdc

Browse files
author
Jason Croft
committed
Show only projects where user is creator, has project access >= 20, or has group access.
1 parent edcb766 commit 930afdc

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ app.get('/gitlab', function (req, res) {
448448
models.User.findById(req.cookies.userid)
449449
.then(function(user) {
450450
ret.accesstoken = user.accessToken;
451+
ret.profileid = user.profileid;
451452
request(
452453
config.gitlab.baseURL + '/api/v3/projects?access_token=' + user.accessToken,
453454
function(error, httpResponse, body) {

public/js/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,10 @@ ui.toolbar.export.snippet.click(function() {
11641164
return (a.path_with_namespace < b.path_with_namespace) ? -1 : ((a.path_with_namespace > b.path_with_namespace) ? 1 : 0);
11651165
});
11661166
data.projects.forEach(function(project) {
1167-
if (!project.snippets_enabled) {
1167+
if (!project.snippets_enabled
1168+
|| (project.permissions.project_access === null && project.permissions.group_access === null)
1169+
|| (project.permissions.project_access !== null && project.permissions.project_access.access_level < 20))
1170+
{
11681171
return;
11691172
}
11701173
$('<option>').val(project.id).text(project.path_with_namespace).appendTo("#snippetExportModalProjects");
@@ -1249,7 +1252,10 @@ ui.toolbar.import.snippet.click(function () {
12491252
return (a.path_with_namespace < b.path_with_namespace) ? -1 : ((a.path_with_namespace > b.path_with_namespace) ? 1 : 0);
12501253
});
12511254
data.projects.forEach(function(project) {
1252-
if (!project.snippets_enabled) {
1255+
if (!project.snippets_enabled
1256+
|| (project.permissions.project_access === null && project.permissions.group_access === null)
1257+
|| (project.permissions.project_access !== null && project.permissions.project_access.access_level < 20))
1258+
{
12531259
return;
12541260
}
12551261
$('<option>').val(project.id).text(project.path_with_namespace).appendTo("#snippetImportModalProjects");

0 commit comments

Comments
 (0)