extended subnet access control

This commit is contained in:
Chris
2020-06-15 10:38:07 +02:00
parent 6d504f3a48
commit 75784174fa
3 changed files with 12 additions and 0 deletions

View File

@@ -12,6 +12,10 @@ include_once(ROOT.DS.'inc'.DS.'config.inc.php');
include_once(ROOT . DS . 'inc' . DS. 'core.php');
loadAllContentControllers();
// check if client has permission to upload
if(defined('ALLOWED_SUBNET') && !isIPInRange( getUserIP(), ALLOWED_SUBNET ))
exit(json_encode(array('status'=>'err','reason'=> 'Access denied')));
// check write permissions first
if(!isFolderWritable(ROOT.DS.'data'))
exit(json_encode(array('status'=>'err','reason'=>'Data directory not writable')));

View File

@@ -12,6 +12,10 @@ include_once(ROOT.DS.'inc'.DS.'config.inc.php');
include_once(ROOT . DS . 'inc' . DS. 'core.php');
loadAllContentControllers();
// check if client has permission to upload
if(defined('ALLOWED_SUBNET') && !isIPInRange( getUserIP(), ALLOWED_SUBNET ))
exit(json_encode(array('status'=>'err','reason'=> 'Access denied')));
// check write permissions first
if(!isFolderWritable(ROOT.DS.'data'))
exit(json_encode(array('status'=>'err','reason'=>'Data directory not writable')));

View File

@@ -14,6 +14,10 @@ $controllers = loadAllContentControllers();
if(!in_array('TextController',$controllers))
exit(json_encode(array('status'=>'err','reason'=>'Text controller not enabled')));
// check if client has permission to upload
if(defined('ALLOWED_SUBNET') && !isIPInRange( getUserIP(), ALLOWED_SUBNET ))
exit(json_encode(array('status'=>'err','reason'=> 'Access denied')));
// check write permissions first
if(!isFolderWritable(ROOT.DS.'data'))
exit(json_encode(array('status'=>'err','reason'=>'Data directory not writable')));