업데이트 기능 추가

This commit is contained in:
2018-06-19 02:11:17 +09:00
parent d7b9e8b2e0
commit ccbef236d3
2 changed files with 34 additions and 11 deletions
+18 -7
View File
@@ -19,12 +19,6 @@ function getVersion($target=null){
}
$session = Session::requireLogin(null)->setReadOnly();
if($session->userGrade < 5){
Json::die([
'result'=>false,
'reason'=>'권한이 충분하지 않습니다'
]);
}
$request = $_POST + $_GET;
@@ -48,7 +42,24 @@ if(!$v->validate()){
$target = Util::getReq('target');
$server = basename($request['server']);
if($session->userGrade <= 5 || !$target){
$allowFullUpdate = in_array('fullUpdate', $session->acl[$server]??[]);
$allowFullUpdate |= $session->userGrade >= 6;
$allowUpdate = in_array('update', $session->acl[$server]??[]);
$allowUpdate |= $session->userGrade >= 5;
$allowUpdate |= $allowFullUpdate;
if(!$allowUpdate){
Json::die([
'result'=>false,
'reason'=>'권한이 충분하지 않습니다'
]);
}
if(!$allowFullUpdate || !$target){
$target = $storage->$server;
if($target){
$target = $target[0];
+16 -4
View File
@@ -25,13 +25,25 @@ function serverUpdate(caller){
if(typeof isRoot !== 'boolean'){
isRoot = (isRoot != 'false');
};
var allowFullUpdate = (server in window.aclList && window.aclList[server].indexOf('fullUpdate')>=0);
allowFullUpdate |= window.adminGrade > 5;
var allowUpdate = (server in window.aclList && window.aclList[server].indexOf('update')>=0);
allowUpdate |= window.adminGrade >= 5;
allowUpdate |= allowFullUpdate;
if(!allowUpdate){
alert('권한이 없습니다!');
return;
}
if(isRoot){
if(!confirm('서버 라이브러리, 루트 서버에 대해 git pull을 실행합니다.')){
return;
}
}
else if(window.adminGrade < 6){
else if(!allowFullUpdate){
if (!confirm('다음 git tree-ish 주소로 업데이트를 시도합니다 : ' + target)) {
return;
}
@@ -94,7 +106,7 @@ function drawServerAdminList(serverList){
var aclByServer = serverList.acl[server.name];
$.each(aclByServer, function(idx, action){
console.log(action);
if(action == 'update'){
if(action == 'update' || action == 'fullUpdate'){
if(!server.installed){
return true;
}
@@ -115,8 +127,8 @@ function drawServerAdminList(serverList){
});
});
window.adminGrade = serverList.grade;
if(serverList.grade == 5){
window.aclList = serverList.acl;
if(serverList.grade <= 5){
$table.find('.only_admin').prop('disabled', true);
}
}