Skip to content

Commit

Permalink
9.7.인증구현-접근제어
Browse files Browse the repository at this point in the history
  • Loading branch information
egoing committed Jul 22, 2018
1 parent 6e6f8d8 commit 0cf5c65
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ var app = http.createServer(function (request, response) {
});
}
} else if (pathname === '/create') {
if(authIsOwner(request, response) === false){
response.end('Login required!!');
return false;
}
fs.readdir('./data', function (error, filelist) {
var title = 'WEB - create';
var list = template.list(filelist);
Expand All @@ -88,6 +92,10 @@ var app = http.createServer(function (request, response) {
response.end(html);
});
} else if (pathname === '/create_process') {
if(authIsOwner(request, response) === false){
response.end('Login required!!');
return false;
}
var body = '';
request.on('data', function (data) {
body = body + data;
Expand All @@ -104,6 +112,10 @@ var app = http.createServer(function (request, response) {
})
});
} else if (pathname === '/update') {
if(authIsOwner(request, response) === false){
response.end('Login required!!');
return false;
}
fs.readdir('./data', function (error, filelist) {
var filteredId = path.parse(queryData.id).base;
fs.readFile(`data/${filteredId}`, 'utf8', function (err, description) {
Expand All @@ -130,6 +142,10 @@ var app = http.createServer(function (request, response) {
});
});
} else if (pathname === '/update_process') {
if(authIsOwner(request, response) === false){
response.end('Login required!!');
return false;
}
var body = '';
request.on('data', function (data) {
body = body + data;
Expand All @@ -149,6 +165,10 @@ var app = http.createServer(function (request, response) {
});
});
} else if (pathname === '/delete_process') {
if(authIsOwner(request, response) === false){
response.end('Login required!!');
return false;
}
var body = '';
request.on('data', function (data) {
body = body + data;
Expand Down Expand Up @@ -196,10 +216,16 @@ var app = http.createServer(function (request, response) {
],
Location: `/`
});
response.end();
} else {
response.end('Who?');
}
response.end();
});
} else if (pathname === '/logout_process') {
if(authIsOwner(request, response) === false){
response.end('Login required!!');
return false;
}
var body = '';
request.on('data', function (data) {
body = body + data;
Expand Down

0 comments on commit 0cf5c65

Please sign in to comment.