Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
m4lab_tv1
User Account
Commits
e0da3a30
Commit
e0da3a30
authored
3 years ago
by
Rosanny Sihombing
Browse files
Options
Download
Email Patches
Plain Diff
add /deleteProject
parent
1ea9adf8
master
MLAB-677
devel
reset-jul13
reset-merge
testing
5 merge requests
!143
updating yml config
,
!91
Prepare prod
,
!90
Testing
,
!89
Testing
,
!80
Mlab 501
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
routes/routes-account.js
+35
-4
routes/routes-account.js
with
35 additions
and
4 deletions
+35
-4
routes/routes-account.js
+
35
-
4
View file @
e0da3a30
...
...
@@ -562,10 +562,13 @@ module.exports = function (app, config, passport, i18n) {
}
else
{
let
project
=
await
gitlab
.
getProjectById
(
req
.
query
.
id
)
if
(
!
project
)
{
console
.
log
(
"
=================== error or no project found
"
)
console
.
log
(
"
========= Error or no project found
"
)
res
.
redirect
(
'
/account/services
'
)
}
else
if
(
!
project
.
owner
)
{
console
.
log
(
"
========= Project cannot be accessed, since it does not have an owner
"
)
res
.
redirect
(
'
/account/services
'
)
}
else
if
(
project
.
owner
.
id
!=
loggedInUser
.
getGitlabUserId
())
{
console
.
log
(
"
=========
========== n
ot your project
"
)
console
.
log
(
"
=========
Access denied: N
ot your project
"
)
res
.
redirect
(
'
/account/services
'
)
}
else
{
let
curInformation
=
new
projectInformation
(
loggedInUser
.
getGitlabUserId
(),
req
.
query
.
id
,
project
.
name
,
project
.
description
,
...
...
@@ -579,7 +582,7 @@ module.exports = function (app, config, passport, i18n) {
}
}
})
// update a website
app
.
post
(
'
/updateInformation
'
,
async
function
(
req
,
res
){
if
(
!
req
.
isAuthenticated
()
)
{
res
.
redirect
(
'
/login
'
)
...
...
@@ -635,7 +638,35 @@ module.exports = function (app, config, passport, i18n) {
}
})
// RS: delete projektInformation?
app
.
delete
(
'
/deleteProject
'
,
async
function
(
req
,
res
){
console
.
log
(
"
delete project
"
)
if
(
!
req
.
isAuthenticated
()
)
{
res
.
redirect
(
'
/login
'
)
}
else
{
let
loggedInUser
=
await
getLoggedInUserData
(
req
.
user
.
email
)
let
projectId
=
req
.
body
.
id
if
(
projectId
)
{
// check if the owner is valid
let
project
=
await
gitlab
.
getProjectById
(
projectId
)
if
(
!
project
)
{
console
.
log
(
"
========= Error or no project found
"
)
}
else
if
(
!
project
.
owner
)
{
console
.
log
(
"
========= Project cannot be accessed, since it does not have an owner
"
)
}
else
if
(
project
.
owner
.
id
!=
loggedInUser
.
getGitlabUserId
())
{
console
.
log
(
"
========= Access denied: Not your project
"
)
}
else
{
// delete project
let
project
=
await
gitlab
.
deleteProjectById
(
projectId
)
if
(
project
.
error
)
{
res
.
flash
(
"
error
"
,
"
Project cannot be deleted. Please try again.
"
)
}
}
}
res
.
redirect
(
'
/account/services
'
)
}
})
// ============= NEW USERS REGISTRATION ===========================
app
.
get
(
'
/registration
'
,
function
(
req
,
res
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets