|
|
|
@ -655,17 +655,19 @@ Class Common {
@@ -655,17 +655,19 @@ Class Common {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$allowed = true; |
|
|
|
|
$authDirs = Common::getPwdAuthDirsFromSession(); |
|
|
|
|
if (!empty($authConfig['alldirs']) && empty($authConfig['nonebutdirs'][$dir]) && empty($authDirs['alldirs'])) { |
|
|
|
|
$authDirs = self::getPwdAuthDirsFromSession(); |
|
|
|
|
if (!empty($authConfig['default']) && empty($authConfig['allow'][$dir]) && !in_array('default', $authDirs)) { |
|
|
|
|
//所有目录都需要授权 |
|
|
|
|
$allowed = false; |
|
|
|
|
}else if (!empty($authConfig['nonebutdirs'][$dir]) && empty($authDirs[$dir])) { |
|
|
|
|
}else if (empty($authConfig['default']) && !empty($authConfig['allow'][$dir]) && !in_array($dir, $authDirs)) { |
|
|
|
|
//只有部分目录需要授权 |
|
|
|
|
$allowed = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $allowed; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//密码授权检查 |
|
|
|
|
//密码授权检查,如果密码正确,则增加目录到已授权列表 |
|
|
|
|
public static function pwdAuthToDir($dir, $userPassword) { |
|
|
|
|
if( empty(FSC::$app['config']['password_auth']) ) { |
|
|
|
|
return true; |
|
|
|
@ -676,15 +678,17 @@ Class Common {
@@ -676,15 +678,17 @@ Class Common {
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$allowed = true; |
|
|
|
|
$authDirs = Common::getPwdAuthDirsFromSession(); |
|
|
|
|
if (!empty($authConfig['alldirs']) && empty($authConfig['nonebutdirs'][$dir]) && empty($authDirs['alldirs'])) { |
|
|
|
|
$allowed = false; |
|
|
|
|
}else if (!empty($authConfig['nonebutdirs'][$dir]) && empty($authDirs[$dir])) { |
|
|
|
|
$allowed = false; |
|
|
|
|
$authed = false; |
|
|
|
|
$authDirs = self::getPwdAuthDirsFromSession(); |
|
|
|
|
if (!empty($authConfig['default']) && empty($authConfig['allow'][$dir]) && $userPassword == $authConfig['default']) { |
|
|
|
|
self::savePwdAuthDirToSession($dir); |
|
|
|
|
$authed = true; |
|
|
|
|
}else if (empty($authConfig['default']) && !empty($authConfig['allow'][$dir]) && $authConfig['allow'][$dir] == $userPassword) { |
|
|
|
|
self::savePwdAuthDirToSession($dir); |
|
|
|
|
$authed = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $allowed; |
|
|
|
|
return $authed; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |