Show only projects where user is creator, has project access >= 20, or has group access.
This commit is contained in:
		
							parent
							
								
									edcb766b63
								
							
						
					
					
						commit
						930afdc337
					
				
							
								
								
									
										1
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								app.js
									
									
									
									
									
								
							| @ -448,6 +448,7 @@ app.get('/gitlab', function (req, res) { | |||||||
|     models.User.findById(req.cookies.userid) |     models.User.findById(req.cookies.userid) | ||||||
|         .then(function(user) { |         .then(function(user) { | ||||||
|             ret.accesstoken = user.accessToken; |             ret.accesstoken = user.accessToken; | ||||||
|  |             ret.profileid = user.profileid; | ||||||
|             request( |             request( | ||||||
|                 config.gitlab.baseURL + '/api/v3/projects?access_token=' + user.accessToken, |                 config.gitlab.baseURL + '/api/v3/projects?access_token=' + user.accessToken, | ||||||
|                 function(error, httpResponse, body) { |                 function(error, httpResponse, body) { | ||||||
|  | |||||||
| @ -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); |                     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) { |                 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; |                         return; | ||||||
|                     } |                     } | ||||||
|                     $('<option>').val(project.id).text(project.path_with_namespace).appendTo("#snippetExportModalProjects"); |                     $('<option>').val(project.id).text(project.path_with_namespace).appendTo("#snippetExportModalProjects"); | ||||||
| @ -1249,7 +1252,10 @@ ui.toolbar.import.snippet.click(function () { | |||||||
|                     return (a.path_with_namespace < b.path_with_namespace) ? -1 : ((a.path_with_namespace > b.path_with_namespace) ? 1 : 0); |                     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) { |                 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; |                         return; | ||||||
|                     } |                     } | ||||||
|                     $('<option>').val(project.id).text(project.path_with_namespace).appendTo("#snippetImportModalProjects"); |                     $('<option>').val(project.id).text(project.path_with_namespace).appendTo("#snippetImportModalProjects"); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user