Commit 38ce1ca0 authored by Vincent Sherwood's avatar Vincent Sherwood

For Backend Storage type files, add a user element to the file name so that...

For Backend Storage type files, add a user element to the file name so that multiple accounts on the same device do not overwrite each others data in a single file named only for the device.
parent 119acfdc
...@@ -443,7 +443,8 @@ class FileStateMachine implements IStateMachine { ...@@ -443,7 +443,8 @@ class FileStateMachine implements IStateMachine {
* @throws StateInvalidException * @throws StateInvalidException
*/ */
private function getFullFilePath($devid, $type, $key = false, $counter = false, $doNotCreateDirs = false) { private function getFullFilePath($devid, $type, $key = false, $counter = false, $doNotCreateDirs = false) {
$testkey = $devid . (($key !== false)? "-". $key : "") . (($type !== "")? "-". $type : ""); $user = preg_replace('/[^a-z0-9]/', '-', Request::GetAuthUser());
$testkey = $devid . (($key !== false)? "-". $key : "") . (($type !== "")? "-". $type : "") . (($type == IStateMachine::BACKENDSTORAGE)? "-". $user : "");
if (preg_match('/^[a-zA-Z0-9-]+$/', $testkey, $matches) || ($type == "" && $key === false)) if (preg_match('/^[a-zA-Z0-9-]+$/', $testkey, $matches) || ($type == "" && $key === false))
$internkey = $testkey . (($counter && is_int($counter))?"-".$counter:""); $internkey = $testkey . (($counter && is_int($counter))?"-".$counter:"");
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment