From 930afdc33738a487bd9e596c5d35bc9f686eaaa1 Mon Sep 17 00:00:00 2001
From: Jason Croft
Date: Fri, 13 May 2016 10:32:30 -0400
Subject: Show only projects where user is creator, has project access >= 20,
or has group access.
---
app.js | 1 +
public/js/index.js | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/app.js b/app.js
index 5d847f76..35408bb0 100644
--- a/app.js
+++ b/app.js
@@ -448,6 +448,7 @@ app.get('/gitlab', function (req, res) {
models.User.findById(req.cookies.userid)
.then(function(user) {
ret.accesstoken = user.accessToken;
+ ret.profileid = user.profileid;
request(
config.gitlab.baseURL + '/api/v3/projects?access_token=' + user.accessToken,
function(error, httpResponse, body) {
diff --git a/public/js/index.js b/public/js/index.js
index a1e0445b..7e692bee 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1164,7 +1164,10 @@ ui.toolbar.export.snippet.click(function() {
return (a.path_with_namespace < b.path_with_namespace) ? -1 : ((a.path_with_namespace > b.path_with_namespace) ? 1 : 0);
});
data.projects.forEach(function(project) {
- if (!project.snippets_enabled) {
+ if (!project.snippets_enabled
+ || (project.permissions.project_access === null && project.permissions.group_access === null)
+ || (project.permissions.project_access !== null && project.permissions.project_access.access_level < 20))
+ {
return;
}
$('