1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | namespace Aurora\Modules\Files; |
9: | |
10: | use Afterlogic\DAV\Constants; |
11: | use Afterlogic\DAV\Server; |
12: | use Aurora\Api; |
13: | use Aurora\Modules\Core\Models\User; |
14: | use Aurora\Modules\Core\Models\Tenant; |
15: | use Aurora\Modules\Core\Module as CoreModule; |
16: | use Aurora\Modules\Files\Enums\ErrorCodes; |
17: | use Aurora\System\Classes\InheritedAttributes; |
18: | use Aurora\System\EventEmitter; |
19: | use Aurora\System\Exceptions\ApiException; |
20: | |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: | |
29: | |
30: | |
31: | |
32: | class Module extends \Aurora\System\Module\AbstractModule |
33: | { |
34: | protected static $sStorageType = ''; |
35: | |
36: | |
37: | |
38: | |
39: | public $oApiFileCache = null; |
40: | |
41: | |
42: | |
43: | |
44: | |
45: | protected $oMinModuleDecorator = null; |
46: | |
47: | public function getFilecacheManager() |
48: | { |
49: | if ($this->oApiFileCache === null) { |
50: | $this->oApiFileCache = new \Aurora\System\Managers\Filecache(); |
51: | } |
52: | |
53: | return $this->oApiFileCache; |
54: | } |
55: | |
56: | |
57: | |
58: | |
59: | public static function getInstance() |
60: | { |
61: | return parent::getInstance(); |
62: | } |
63: | |
64: | |
65: | |
66: | |
67: | public static function Decorator() |
68: | { |
69: | return parent::Decorator(); |
70: | } |
71: | |
72: | |
73: | |
74: | |
75: | public function getModuleSettings() |
76: | { |
77: | return $this->oModuleSettings; |
78: | } |
79: | |
80: | |
81: | |
82: | |
83: | |
84: | |
85: | |
86: | |
87: | public function init() |
88: | { |
89: | $this->subscribeEvent('Files::GetStorages::after', array($this, 'onAfterGetStorages'), 1000); |
90: | $this->subscribeEvent('Core::CreateUser::after', array($this, 'onAfterCreateUser'), 1000); |
91: | $this->subscribeEvent('Files::Rename::after', array($this, 'onAfterRename'), 1000); |
92: | $this->subscribeEvent('Files::Move::after', array($this, 'onAfterMove'), 1000); |
93: | |
94: | $this->AddEntries( |
95: | array( |
96: | 'upload' => 'UploadFileData', |
97: | 'download-file' => 'EntryDownloadFile' |
98: | ) |
99: | ); |
100: | $this->denyMethodsCallByWebApi(['getRawFile', 'getRawFileData', 'GetItems']); |
101: | |
102: | $this->aErrors = [ |
103: | Enums\ErrorCodes::NotFound => $this->i18N('INFO_NOTFOUND'), |
104: | Enums\ErrorCodes::NotPermitted => $this->i18N('INFO_NOTPERMITTED'), |
105: | Enums\ErrorCodes::AlreadeExists => $this->i18N('ERROR_ITEM_ALREADY_EXISTS'), |
106: | Enums\ErrorCodes::CantDeleteSharedItem => $this->i18N('ERROR_CANNOT_DELETE_SHARED_ITEM'), |
107: | Enums\ErrorCodes::CannotCopyOrMoveItemToItself => $this->i18N('ERROR_CANNOT_COPY_OR_MOVE_ITEM_TO_ITSELF'), |
108: | Enums\ErrorCodes::NotPossibleToMoveSharedFileToCorporateStorage => $this->i18N('ERROR_NOT_POSSIBLE_TO_MOVE_SHARED_FILE_OR_DIR_TO_CORPORATE_STORAGE'), |
109: | ]; |
110: | |
111: | InheritedAttributes::addAttributes(User::class, ['Files::UserSpaceLimitMb']); |
112: | InheritedAttributes::addAttributes(Tenant::class, ['Files::UserSpaceLimitMb', 'Files::TenantSpaceLimitMb']); |
113: | } |
114: | |
115: | |
116: | |
117: | |
118: | |
119: | |
120: | private function getMinModuleDecorator() |
121: | { |
122: | return \Aurora\System\Api::GetModuleDecorator('Min'); |
123: | } |
124: | |
125: | |
126: | |
127: | |
128: | |
129: | |
130: | |
131: | protected function checkStorageType($Type) |
132: | { |
133: | return $Type === static::$sStorageType; |
134: | } |
135: | |
136: | public function getRawFileData($iUserId, $sType, $sPath, $sFileName, $SharedHash = null, $sAction = '', $iOffset = 0, $iChunkSize = 0) |
137: | { |
138: | $bDownload = true; |
139: | $bThumbnail = false; |
140: | $mResult = false; |
141: | |
142: | switch ($sAction) { |
143: | case 'view': |
144: | $bDownload = false; |
145: | $bThumbnail = false; |
146: | break; |
147: | case 'thumb': |
148: | $bDownload = false; |
149: | $bThumbnail = true; |
150: | break; |
151: | case 'download': |
152: | $bDownload = true; |
153: | $bThumbnail = false; |
154: | |
155: | break; |
156: | default: |
157: | $bDownload = true; |
158: | $bThumbnail = false; |
159: | break; |
160: | } |
161: | if (!$bDownload || $iChunkSize == 0) { |
162: | $iLength = -1; |
163: | $iOffset = -1; |
164: | } else { |
165: | $iLength = $iChunkSize; |
166: | $iOffset = $iChunkSize * $iOffset; |
167: | } |
168: | |
169: | $oModuleDecorator = $this->getMinModuleDecorator(); |
170: | $mMin = ($oModuleDecorator && $SharedHash !== null) ? $oModuleDecorator->GetMinByHash($SharedHash) : array(); |
171: | |
172: | $iUserId = (!empty($mMin['__hash__'])) ? $mMin['UserId'] : $iUserId; |
173: | |
174: | try { |
175: | if ($iUserId && $SharedHash !== null) { |
176: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::Anonymous); |
177: | \Afterlogic\DAV\Server::setUser($iUserId); |
178: | } else { |
179: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
180: | if ($iUserId !== \Aurora\System\Api::getAuthenticatedUserId()) { |
181: | throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::AccessDenied); |
182: | } |
183: | } |
184: | } catch (\Aurora\System\Exceptions\ApiException $oEx) { |
185: | echo 'Access denied'; |
186: | exit(); |
187: | } |
188: | |
189: | if (isset($sType, $sPath, $sFileName)) { |
190: | $sContentType = (empty($sFileName)) ? 'text/plain' : \MailSo\Base\Utils::MimeContentType($sFileName); |
191: | |
192: | $mResult = false; |
193: | if ($bThumbnail) { |
194: | $sRawKey = (string) \Aurora\System\Router::getItemByIndex(1, ''); |
195: | if (!empty($sRawKey)) { |
196: | \Aurora\System\Managers\Response::verifyCacheByKey($sRawKey); |
197: | } |
198: | $mResult = \Aurora\System\Managers\Thumb::GetResourceCache($iUserId, $sFileName); |
199: | } |
200: | if (!$mResult) { |
201: | $aArgs = array( |
202: | 'UserId' => $iUserId, |
203: | 'Type' => $sType, |
204: | 'Path' => $sPath, |
205: | 'Name' => &$sFileName, |
206: | 'Id' => $sFileName, |
207: | 'IsThumb' => $bThumbnail, |
208: | 'Offset' => $iOffset, |
209: | 'ChunkSize' => $iChunkSize |
210: | ); |
211: | $this->broadcastEvent( |
212: | 'GetFile', |
213: | $aArgs, |
214: | $mResult |
215: | ); |
216: | } |
217: | } |
218: | |
219: | return $mResult; |
220: | } |
221: | |
222: | |
223: | |
224: | |
225: | |
226: | |
227: | |
228: | |
229: | |
230: | |
231: | |
232: | |
233: | |
234: | public function getRawFile($iUserId, $sType, $sPath, $sFileName, $SharedHash = null, $sAction = '', $iOffset = 0, $iChunkSize = 0, $bShared = false) |
235: | { |
236: | |
237: | if ($sAction !== 'download' && strtolower(pathinfo($sFileName, PATHINFO_EXTENSION)) === 'svg') { |
238: | $this->oHttp->StatusHeader(403); |
239: | exit(); |
240: | } |
241: | |
242: | $bDownload = true; |
243: | $bThumbnail = false; |
244: | |
245: | switch ($sAction) { |
246: | case 'view': |
247: | $bDownload = false; |
248: | $bThumbnail = false; |
249: | break; |
250: | case 'thumb': |
251: | $bDownload = false; |
252: | $bThumbnail = true; |
253: | break; |
254: | case 'download': |
255: | $bDownload = true; |
256: | $bThumbnail = false; |
257: | |
258: | break; |
259: | default: |
260: | $bDownload = true; |
261: | $bThumbnail = false; |
262: | break; |
263: | } |
264: | if (!$bDownload || $iChunkSize == 0) { |
265: | $iLength = -1; |
266: | $iOffset = -1; |
267: | } else { |
268: | $iLength = $iChunkSize; |
269: | $iOffset = $iChunkSize * $iOffset; |
270: | } |
271: | |
272: | $oModuleDecorator = $this->getMinModuleDecorator(); |
273: | $mMin = ($oModuleDecorator && $SharedHash !== null) ? $oModuleDecorator->GetMinByHash($SharedHash) : array(); |
274: | |
275: | $iUserId = (!empty($mMin['__hash__'])) ? $mMin['UserId'] : $iUserId; |
276: | |
277: | try { |
278: | if ($iUserId && $SharedHash !== null) { |
279: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::Anonymous); |
280: | \Afterlogic\DAV\Server::setUser($iUserId); |
281: | } else { |
282: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
283: | if ($iUserId !== \Aurora\System\Api::getAuthenticatedUserId()) { |
284: | throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::AccessDenied); |
285: | } |
286: | } |
287: | } catch (\Aurora\System\Exceptions\ApiException $oEx) { |
288: | |
289: | $this->oHttp->StatusHeader(403); |
290: | exit; |
291: | } |
292: | |
293: | if ($sType) { |
294: | $sContentType = ($sFileName === '') ? 'text/plain' : \MailSo\Base\Utils::MimeContentType($sFileName); |
295: | |
296: | $mResult = false; |
297: | if ($bThumbnail) { |
298: | $sRawKey = (string) \Aurora\System\Router::getItemByIndex(1, ''); |
299: | if (!empty($sRawKey)) { |
300: | \Aurora\System\Managers\Response::verifyCacheByKey($sRawKey); |
301: | } |
302: | $mResult = \Aurora\System\Managers\Thumb::GetResourceCache($iUserId, $sFileName); |
303: | if ($mResult) { |
304: | $sContentType = \MailSo\Base\Utils::MimeContentType($sFileName); |
305: | \Aurora\System\Managers\Response::OutputHeaders($bDownload, $sContentType, $sFileName); |
306: | echo $mResult; |
307: | exit(); |
308: | } |
309: | } |
310: | |
311: | if (!$mResult) { |
312: | $aArgs = array( |
313: | 'UserId' => $iUserId, |
314: | 'Type' => $sType, |
315: | 'Path' => $sPath, |
316: | 'Name' => &$sFileName, |
317: | 'Id' => $sFileName, |
318: | 'IsThumb' => $bThumbnail, |
319: | 'Offset' => $iOffset, |
320: | 'ChunkSize' => $iChunkSize, |
321: | 'Shared' => $bShared |
322: | ); |
323: | $this->broadcastEvent( |
324: | 'GetFile', |
325: | $aArgs, |
326: | $mResult |
327: | ); |
328: | } |
329: | |
330: | if (false !== $mResult) { |
331: | if (is_resource($mResult)) { |
332: | $sFileName = \trim($sFileName, DIRECTORY_SEPARATOR); |
333: | $sContentType = \MailSo\Base\Utils::MimeContentType($sFileName); |
334: | \Aurora\System\Managers\Response::OutputHeaders($bDownload, $sContentType, $sFileName); |
335: | |
336: | \header('Cache-Control: no-cache', true); |
337: | |
338: | if ($bThumbnail) { |
339: | return \Aurora\System\Managers\Thumb::GetResource( |
340: | $iUserId, |
341: | $mResult, |
342: | $sFileName |
343: | ); |
344: | } elseif ($sContentType === 'text/html' && !$bDownload) { |
345: | echo(\MailSo\Base\HtmlUtils::ClearHtmlSimple(stream_get_contents($mResult, $iLength, $iOffset))); |
346: | } elseif ($sContentType === 'text/plain') { |
347: | echo(stream_get_contents($mResult, $iLength, $iOffset)); |
348: | } elseif ($iLength > -1 && $iOffset > -1) { |
349: | \MailSo\Base\Utils::GetFilePart($mResult, $iLength, $iOffset); |
350: | } else { |
351: | \MailSo\Base\Utils::FpassthruWithTimeLimitReset($mResult); |
352: | } |
353: | |
354: | @fclose($mResult); |
355: | } else { |
356: | |
357: | $this->oHttp->StatusHeader(404); |
358: | exit; |
359: | } |
360: | } |
361: | } |
362: | } |
363: | |
364: | |
365: | |
366: | |
367: | |
368: | |
369: | |
370: | |
371: | |
372: | |
373: | |
374: | public function UploadFileData() |
375: | { |
376: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
377: | $mResult = false; |
378: | $aPaths = \Aurora\System\Application::GetPaths(); |
379: | if (isset($aPaths[1]) && strtolower($aPaths[1]) === strtolower(self::GetName())) { |
380: | $sType = isset($aPaths[2]) ? strtolower($aPaths[2]) : 'personal'; |
381: | $rData = fopen("php://input", "r"); |
382: | $aFilePath = array_slice($aPaths, 3); |
383: | $sFilePath = urldecode(implode('/', $aFilePath)); |
384: | |
385: | $bOverwrite = true; |
386: | if (strpos($sFilePath, '!') === 0) { |
387: | $sFilePath = substr($sFilePath, 1); |
388: | $bOverwrite = false; |
389: | } |
390: | |
391: | $iUserId = \Aurora\System\Api::getAuthenticatedUserId( |
392: | \Aurora\System\Api::getAuthTokenFromHeaders() |
393: | ); |
394: | $oUser = \Aurora\System\Api::getAuthenticatedUser($iUserId); |
395: | if ($oUser) { |
396: | if ($rData) { |
397: | $aArgs = array( |
398: | 'UserId' => $oUser->UUID, |
399: | 'Type' => $sType, |
400: | 'Path' => dirname($sFilePath), |
401: | 'Name' => basename($sFilePath), |
402: | 'Data' => $rData, |
403: | 'Overwrite' => $bOverwrite, |
404: | 'RangeType' => 0, |
405: | 'Offset' => 0, |
406: | 'ExtendedProps' => array() |
407: | ); |
408: | $this->broadcastEvent( |
409: | 'CreateFile', |
410: | $aArgs, |
411: | $mResult |
412: | ); |
413: | } else { |
414: | $mResult = false; |
415: | } |
416: | } else { |
417: | $mResult = false; |
418: | } |
419: | } |
420: | if ($mResult) { |
421: | echo 'true'; |
422: | } else { |
423: | echo 'false'; |
424: | } |
425: | } |
426: | |
427: | |
428: | |
429: | |
430: | |
431: | |
432: | |
433: | |
434: | |
435: | |
436: | |
437: | |
438: | |
439: | |
440: | |
441: | |
442: | |
443: | |
444: | |
445: | |
446: | |
447: | |
448: | |
449: | |
450: | |
451: | |
452: | |
453: | |
454: | |
455: | |
456: | |
457: | |
458: | |
459: | |
460: | |
461: | |
462: | |
463: | |
464: | |
465: | |
466: | |
467: | |
468: | |
469: | |
470: | |
471: | |
472: | |
473: | |
474: | |
475: | |
476: | |
477: | |
478: | |
479: | |
480: | |
481: | |
482: | |
483: | |
484: | |
485: | public function GetSettings() |
486: | { |
487: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::Anonymous); |
488: | |
489: | $iPostMaxSize = (int) ini_get('post_max_size'); |
490: | $iUploadMaxFilesize = (int) ini_get('upload_max_filesize'); |
491: | |
492: | $aAppData = array( |
493: | 'EnableUploadSizeLimit' => $this->oModuleSettings->EnableUploadSizeLimit, |
494: | 'UploadSizeLimitMb' => min([$iPostMaxSize, $iUploadMaxFilesize, $this->oModuleSettings->UploadSizeLimitMb]), |
495: | 'CustomTabTitle' => $this->oModuleSettings->CustomTabTitle, |
496: | 'UserSpaceLimitMb' => $this->oModuleSettings->UserSpaceLimitMb, |
497: | 'TenantSpaceLimitMb' => $this->oModuleSettings->TenantSpaceLimitMb |
498: | ); |
499: | |
500: | $oAuthenticatedUser = \Aurora\System\Api::getAuthenticatedUser(); |
501: | if ($oAuthenticatedUser instanceof User |
502: | && ($oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::NormalUser |
503: | || $oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::TenantAdmin |
504: | || $oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::SuperAdmin)) { |
505: | $aAppData['Storages'] = \Aurora\Modules\Files\Module::Decorator()->GetStorages(); |
506: | } |
507: | |
508: | $sPublicHash = \Aurora\System\Router::getItemByIndex(1); |
509: | if (isset($sPublicHash)) { |
510: | $aAppData['PublicHash'] = $sPublicHash; |
511: | $oModuleDecorator = $this->getMinModuleDecorator(); |
512: | $mMin = ($oModuleDecorator && $sPublicHash !== null) ? $oModuleDecorator->GetMinByHash($sPublicHash) : array(); |
513: | if (isset($mMin['__hash__']) && $mMin['IsFolder']) { |
514: | $aAppData['PublicFolderName'] = $mMin['Name']; |
515: | } |
516: | } |
517: | return $aAppData; |
518: | } |
519: | |
520: | public function GetSettingsForEntity($EntityType, $EntityId) |
521: | { |
522: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::Anonymous); |
523: | |
524: | $aResult = []; |
525: | if ($EntityType === 'Tenant') { |
526: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::TenantAdmin); |
527: | $oTenant = \Aurora\Modules\Core\Module::Decorator()->GetTenantWithoutRoleCheck($EntityId); |
528: | if ($oTenant instanceof Tenant) { |
529: | $aResult = [ |
530: | 'TenantSpaceLimitMb' => $oTenant->getExtendedProp(self::GetName() . '::TenantSpaceLimitMb'), |
531: | 'UserSpaceLimitMb' => $oTenant->getExtendedProp(self::GetName() . '::UserSpaceLimitMb'), |
532: | 'AllocatedSpace' => $this->GetAllocatedSpaceForUsersInTenant($oTenant->Id) |
533: | ]; |
534: | } |
535: | } |
536: | if ($EntityType === 'User') { |
537: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
538: | $oUser = \Aurora\Modules\Core\Module::Decorator()->GetUserWithoutRoleCheck($EntityId); |
539: | if ($oUser instanceof User) { |
540: | $aResult = [ |
541: | 'UserSpaceLimitMb' => $oUser->getExtendedProp(self::GetName() . '::UserSpaceLimitMb'), |
542: | ]; |
543: | } |
544: | } |
545: | |
546: | return $aResult; |
547: | } |
548: | |
549: | |
550: | |
551: | |
552: | |
553: | |
554: | |
555: | |
556: | |
557: | |
558: | |
559: | |
560: | |
561: | |
562: | |
563: | |
564: | |
565: | |
566: | |
567: | |
568: | |
569: | |
570: | |
571: | |
572: | |
573: | |
574: | |
575: | |
576: | |
577: | |
578: | |
579: | |
580: | |
581: | |
582: | |
583: | |
584: | |
585: | |
586: | |
587: | |
588: | |
589: | |
590: | |
591: | |
592: | |
593: | |
594: | |
595: | |
596: | |
597: | |
598: | |
599: | |
600: | |
601: | |
602: | |
603: | |
604: | public function UpdateSettings($EnableUploadSizeLimit, $UploadSizeLimitMb) |
605: | { |
606: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::TenantAdmin); |
607: | |
608: | $this->setConfig('EnableUploadSizeLimit', $EnableUploadSizeLimit); |
609: | $this->setConfig('UploadSizeLimitMb', $UploadSizeLimitMb); |
610: | return (bool) $this->saveModuleConfig(); |
611: | } |
612: | |
613: | |
614: | |
615: | |
616: | |
617: | |
618: | |
619: | |
620: | |
621: | |
622: | |
623: | |
624: | |
625: | |
626: | |
627: | |
628: | |
629: | |
630: | |
631: | |
632: | |
633: | |
634: | |
635: | |
636: | |
637: | |
638: | |
639: | |
640: | |
641: | |
642: | |
643: | |
644: | |
645: | |
646: | |
647: | |
648: | |
649: | |
650: | |
651: | |
652: | |
653: | |
654: | |
655: | |
656: | |
657: | |
658: | |
659: | |
660: | |
661: | |
662: | |
663: | |
664: | |
665: | |
666: | |
667: | |
668: | |
669: | |
670: | |
671: | |
672: | |
673: | |
674: | |
675: | |
676: | |
677: | |
678: | |
679: | |
680: | |
681: | |
682: | |
683: | |
684: | |
685: | |
686: | |
687: | |
688: | public function UploadFile($UserId, $Type, $Path, $UploadData, $SubPath = '', $Overwrite = true, $RangeType = 0, $Offset = 0, $ExtendedProps = []) |
689: | { |
690: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
691: | |
692: | $sUserPublicId = \Aurora\System\Api::getUserPublicIdById($UserId); |
693: | |
694: | $sError = ''; |
695: | $mResponse = array(); |
696: | |
697: | if ($sUserPublicId) { |
698: | if (is_array($UploadData)) { |
699: | if (isset($ExtendedProps['FirstChunk']) && $RangeType == 1 && self::Decorator()->IsFileExists($UserId, $Type, $Path, $UploadData['name'])) { |
700: | $sError = \Aurora\System\Notifications::FileAlreadyExists; |
701: | } elseif (!isset($ExtendedProps['FirstChunk']) && $RangeType == 1 && !self::Decorator()->IsFileExists($UserId, $Type, $Path, $UploadData['name'])) { |
702: | $sError = \Aurora\System\Notifications::FileNotFound; |
703: | } else { |
704: | $iSize = (int) $UploadData['size']; |
705: | $iUploadSizeLimitMb = $this->oModuleSettings->UploadSizeLimitMb; |
706: | if ($iUploadSizeLimitMb > 0 && $iSize / (1024 * 1024) > $iUploadSizeLimitMb) { |
707: | throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::CanNotUploadFileLimit); |
708: | } |
709: | |
710: | if (!self::Decorator()->CheckQuota($UserId, $Type, $iSize)) { |
711: | throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::CanNotUploadFileQuota); |
712: | } |
713: | |
714: | if ($SubPath !== '' && !self::Decorator()->IsFileExists($UserId, $Type, $Path, $SubPath)) { |
715: | try { |
716: | self::Decorator()->CreateFolder($UserId, $Type, $Path, $SubPath); |
717: | } catch (\Exception $oException) { |
718: | |
719: | |
720: | if ($oException->getMessage() !== 'Can\'t create a directory') { |
721: | throw $oException; |
722: | } |
723: | } |
724: | } |
725: | |
726: | $sUploadName = $UploadData['name']; |
727: | $sMimeType = \MailSo\Base\Utils::MimeContentType($sUploadName); |
728: | |
729: | $sSavedName = 'upload-post-' . md5($UploadData['name'] . $UploadData['tmp_name']); |
730: | $rData = false; |
731: | if (\is_resource($UploadData['tmp_name'])) { |
732: | $rData = $UploadData['tmp_name']; |
733: | } elseif ($this->getFilecacheManager()->moveUploadedFile($sUserPublicId, $sSavedName, $UploadData['tmp_name'], '', self::GetName())) { |
734: | $rData = $this->getFilecacheManager()->getFile($sUserPublicId, $sSavedName, '', self::GetName()); |
735: | } |
736: | if ($rData) { |
737: | $aArgs = array( |
738: | 'UserId' => $UserId, |
739: | 'Type' => $Type, |
740: | 'Path' => $SubPath === '' ? $Path : $Path . '/' . $SubPath, |
741: | 'Name' => $sUploadName, |
742: | 'Data' => $rData, |
743: | 'Overwrite' => $Overwrite, |
744: | 'RangeType' => $RangeType, |
745: | 'Offset' => $Offset, |
746: | 'ExtendedProps' => $ExtendedProps |
747: | ); |
748: | $mResult = false; |
749: | $this->broadcastEvent( |
750: | 'CreateFile', |
751: | $aArgs, |
752: | $mResult |
753: | ); |
754: | |
755: | if ($mResult) { |
756: | $mResponse['File'] = array( |
757: | 'Name' => $sUploadName, |
758: | 'TempName' => $sSavedName, |
759: | 'MimeType' => $sMimeType, |
760: | 'Size' => (int) $iSize |
761: | ); |
762: | } else { |
763: | $mResponse = false; |
764: | } |
765: | } else { |
766: | throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::CanNotUploadFileErrorData); |
767: | } |
768: | } |
769: | } else { |
770: | throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::InvalidInputParameter); |
771: | } |
772: | } else { |
773: | $sError = 'auth'; |
774: | } |
775: | |
776: | if (0 < strlen($sError)) { |
777: | $mResponse['Error'] = $sError; |
778: | } |
779: | |
780: | return $mResponse; |
781: | } |
782: | |
783: | public function EntryDownloadFile() |
784: | { |
785: | |
786: | |
787: | $sHash = (string) \Aurora\System\Router::getItemByIndex(1, ''); |
788: | $sAction = (string) \Aurora\System\Router::getItemByIndex(2, 'download'); |
789: | $iOffset = (int) \Aurora\System\Router::getItemByIndex(3, ''); |
790: | $iChunkSize = (int) \Aurora\System\Router::getItemByIndex(4, ''); |
791: | |
792: | $aValues = \Aurora\System\Api::DecodeKeyValues($sHash); |
793: | |
794: | $iUserId = isset($aValues['UserId']) ? (int) $aValues['UserId'] : 0; |
795: | $sType = isset($aValues['Type']) ? $aValues['Type'] : ''; |
796: | $sPath = isset($aValues['Path']) ? $aValues['Path'] : ''; |
797: | $sFileName = isset($aValues['Name']) ? $aValues['Name'] : ''; |
798: | $sPublicHash = isset($aValues['PublicHash']) ? $aValues['PublicHash'] : null; |
799: | $bShared = isset($aValues['Shared']) ? $aValues['Shared'] : null; |
800: | |
801: | $this->getRawFile($iUserId, $sType, $sPath, $sFileName, $sPublicHash, $sAction, $iOffset, $iChunkSize, $bShared); |
802: | } |
803: | |
804: | |
805: | |
806: | |
807: | |
808: | |
809: | |
810: | |
811: | |
812: | |
813: | |
814: | |
815: | |
816: | |
817: | |
818: | |
819: | |
820: | |
821: | |
822: | |
823: | |
824: | |
825: | |
826: | |
827: | |
828: | |
829: | |
830: | |
831: | |
832: | |
833: | |
834: | |
835: | |
836: | |
837: | |
838: | |
839: | |
840: | |
841: | |
842: | |
843: | |
844: | |
845: | |
846: | public function ViewFile($UserId, $Type, $Path, $Name, $SharedHash) |
847: | { |
848: | |
849: | $this->getRawFile( |
850: | \Aurora\System\Api::getUserPublicIdById($UserId), |
851: | $Type, |
852: | $Path, |
853: | $Name, |
854: | $SharedHash, |
855: | false |
856: | ); |
857: | } |
858: | |
859: | |
860: | |
861: | |
862: | |
863: | |
864: | |
865: | |
866: | |
867: | |
868: | |
869: | |
870: | |
871: | |
872: | |
873: | |
874: | |
875: | |
876: | |
877: | |
878: | |
879: | |
880: | |
881: | |
882: | |
883: | |
884: | |
885: | |
886: | |
887: | |
888: | |
889: | |
890: | |
891: | |
892: | |
893: | |
894: | |
895: | |
896: | |
897: | |
898: | |
899: | |
900: | |
901: | public function GetFileThumbnail($UserId, $Type, $Path, $Name, $SharedHash) |
902: | { |
903: | return false; |
904: | |
905: | |
906: | |
907: | |
908: | |
909: | |
910: | |
911: | |
912: | |
913: | |
914: | |
915: | |
916: | } |
917: | |
918: | |
919: | |
920: | |
921: | |
922: | |
923: | |
924: | |
925: | |
926: | |
927: | |
928: | |
929: | |
930: | |
931: | |
932: | |
933: | |
934: | |
935: | |
936: | |
937: | |
938: | |
939: | |
940: | |
941: | |
942: | |
943: | |
944: | |
945: | |
946: | |
947: | |
948: | |
949: | |
950: | |
951: | |
952: | |
953: | |
954: | |
955: | |
956: | |
957: | |
958: | |
959: | |
960: | |
961: | |
962: | |
963: | |
964: | |
965: | |
966: | |
967: | |
968: | |
969: | |
970: | |
971: | |
972: | |
973: | |
974: | |
975: | public function GetStorages() |
976: | { |
977: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
978: | return []; |
979: | } |
980: | |
981: | |
982: | |
983: | |
984: | public function GetSubModules() |
985: | { |
986: | return []; |
987: | } |
988: | |
989: | |
990: | |
991: | |
992: | |
993: | |
994: | |
995: | |
996: | |
997: | |
998: | |
999: | |
1000: | |
1001: | |
1002: | |
1003: | |
1004: | |
1005: | |
1006: | |
1007: | |
1008: | |
1009: | |
1010: | |
1011: | |
1012: | |
1013: | |
1014: | |
1015: | |
1016: | |
1017: | |
1018: | |
1019: | |
1020: | |
1021: | |
1022: | |
1023: | |
1024: | |
1025: | |
1026: | |
1027: | |
1028: | |
1029: | |
1030: | |
1031: | |
1032: | |
1033: | |
1034: | |
1035: | |
1036: | |
1037: | |
1038: | |
1039: | |
1040: | |
1041: | |
1042: | |
1043: | |
1044: | |
1045: | |
1046: | |
1047: | public function GetQuota($UserId, $Type) |
1048: | { |
1049: | return [ |
1050: | 'Limit' => 0, |
1051: | 'Used' => 0 |
1052: | ]; |
1053: | } |
1054: | |
1055: | public function CheckQuota($UserId, $Type, $Size) |
1056: | { |
1057: | return false; |
1058: | } |
1059: | |
1060: | public function GetItems($UserId, $Type, $Path, $Pattern, $PublicHash = null, $Shared = false) |
1061: | { |
1062: | $aArgs = [ |
1063: | 'UserId' => $UserId, |
1064: | 'Type' => $Type, |
1065: | 'Path' => $Path, |
1066: | 'Pattern' => $Pattern, |
1067: | 'PublicHash' => $PublicHash, |
1068: | 'Shared' => $Shared |
1069: | ]; |
1070: | $mResult = []; |
1071: | |
1072: | $this->broadcastEvent('GetItems', $aArgs, $mResult); |
1073: | |
1074: | $aItems = []; |
1075: | if (is_array($mResult)) { |
1076: | foreach ($mResult as $oItem) { |
1077: | if ($oItem instanceof Classes\FileItem) { |
1078: | $aItems[] = self::Decorator()->PopulateFileItem($aArgs['UserId'], $oItem); |
1079: | } |
1080: | } |
1081: | |
1082: | $mResult = $aItems; |
1083: | } |
1084: | |
1085: | return $aItems; |
1086: | } |
1087: | |
1088: | |
1089: | |
1090: | |
1091: | |
1092: | |
1093: | |
1094: | |
1095: | |
1096: | |
1097: | |
1098: | |
1099: | |
1100: | |
1101: | |
1102: | |
1103: | |
1104: | |
1105: | |
1106: | |
1107: | |
1108: | |
1109: | |
1110: | |
1111: | |
1112: | |
1113: | |
1114: | |
1115: | |
1116: | |
1117: | |
1118: | |
1119: | |
1120: | |
1121: | |
1122: | |
1123: | |
1124: | |
1125: | |
1126: | |
1127: | |
1128: | |
1129: | |
1130: | |
1131: | |
1132: | |
1133: | |
1134: | |
1135: | |
1136: | |
1137: | |
1138: | |
1139: | |
1140: | |
1141: | |
1142: | |
1143: | |
1144: | |
1145: | |
1146: | |
1147: | |
1148: | |
1149: | |
1150: | |
1151: | |
1152: | |
1153: | |
1154: | |
1155: | |
1156: | public function GetFiles($UserId, $Type, $Path, $Pattern, $Shared = false) |
1157: | { |
1158: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
1159: | return [ |
1160: | 'Items' => self::Decorator()->GetItems($UserId, $Type, $Path, $Pattern, null, $Shared), |
1161: | 'Quota' => self::Decorator()->GetQuota($UserId, $Type) |
1162: | ]; |
1163: | } |
1164: | |
1165: | |
1166: | |
1167: | |
1168: | |
1169: | |
1170: | public function onAfterGetStorages($aArgs, &$mResult) |
1171: | { |
1172: | if (is_array($mResult)) { |
1173: | \usort($mResult, function ($aItem1, $aItem2) { |
1174: | $aItem1['Order'] = isset($aItem1['Order']) ? $aItem1['Order'] : 1000; |
1175: | $aItem2['Order'] = isset($aItem2['Order']) ? $aItem2['Order'] : 1000; |
1176: | |
1177: | return ($aItem1['Order'] == $aItem2['Order']) ? 0 : ($aItem1['Order'] > $aItem2['Order'] ? +1 : -1); |
1178: | }); |
1179: | } |
1180: | } |
1181: | |
1182: | |
1183: | |
1184: | |
1185: | |
1186: | |
1187: | |
1188: | |
1189: | |
1190: | |
1191: | |
1192: | private function generateMinArray($iUserId, $sType, $sPath, $sName, $sSize, $bIsFolder = false) |
1193: | { |
1194: | $aData = null; |
1195: | if ($iUserId) { |
1196: | $aData = array( |
1197: | 'UserId' => $iUserId, |
1198: | 'Type' => $sType, |
1199: | 'Path' => $sPath, |
1200: | 'Name' => $sName, |
1201: | 'Size' => $sSize, |
1202: | 'IsFolder' => $bIsFolder |
1203: | ); |
1204: | } |
1205: | |
1206: | return $aData; |
1207: | } |
1208: | |
1209: | protected function updateMinHash($iUserId, $sType, $sPath, $sName, $sNewType, $sNewPath, $sNewName, $bIsFolder) |
1210: | { |
1211: | $sUserPublicId = \Aurora\Api::getUserPublicIdById($iUserId); |
1212: | $sID = \Aurora\Modules\Min\Module::generateHashId([$sUserPublicId, $sType, $sPath, $sName]); |
1213: | $sNewID = \Aurora\Modules\Min\Module::generateHashId([$sUserPublicId, $sNewType, $sNewPath, $sNewName]); |
1214: | |
1215: | $mData = $this->getMinModuleDecorator()->GetMinByID($sID); |
1216: | |
1217: | if ($mData) { |
1218: | $aData = $this->generateMinArray($sUserPublicId, $sNewType, $sNewPath, $sNewName, $mData['Size'], $bIsFolder); |
1219: | if ($aData) { |
1220: | $this->getMinModuleDecorator()->UpdateMinByID($sID, $aData, $sNewID); |
1221: | } |
1222: | } |
1223: | } |
1224: | |
1225: | |
1226: | |
1227: | |
1228: | |
1229: | |
1230: | public function onAfterRename($aArgs, &$mResult) |
1231: | { |
1232: | if ($mResult && isset($aArgs['UserId'])) { |
1233: | $this->updateMinHash($aArgs['UserId'], $aArgs['Type'], $aArgs['Path'], $aArgs['Name'], $aArgs['Type'], $aArgs['Path'], $aArgs['NewName'], $aArgs['IsFolder']); |
1234: | } |
1235: | } |
1236: | |
1237: | public function onAfterMove($aArgs, &$mResult) |
1238: | { |
1239: | if ($mResult && isset($aArgs['Files']) && is_array($aArgs['Files']) && count($aArgs['Files']) > 0) { |
1240: | foreach ($aArgs['Files'] as $aFile) { |
1241: | $this->updateMinHash( |
1242: | $aArgs['UserId'], |
1243: | $aFile['FromType'], |
1244: | $aFile['FromPath'], |
1245: | $aFile['Name'], |
1246: | $aArgs['ToType'], |
1247: | $aArgs['ToPath'], |
1248: | $aFile['NewName'], |
1249: | $aFile['IsFolder'] |
1250: | ); |
1251: | } |
1252: | } |
1253: | } |
1254: | |
1255: | |
1256: | |
1257: | |
1258: | |
1259: | |
1260: | public function onAfterCreateUser($aArgs, &$mResult) |
1261: | { |
1262: | if ($mResult) { |
1263: | $oUser = \Aurora\Modules\Core\Module::getInstance()->GetUserWithoutRoleCheck($mResult); |
1264: | if ($oUser) { |
1265: | $oTenant = \Aurora\Modules\Core\Module::getInstance()->GetTenantWithoutRoleCheck($oUser->IdTenant); |
1266: | $oUser->setExtendedProp($this->GetName() . '::UserSpaceLimitMb', $oTenant->getExtendedProp($this->GetName() . '::UserSpaceLimitMb')); |
1267: | $oUser->save(); |
1268: | } |
1269: | } |
1270: | } |
1271: | |
1272: | |
1273: | |
1274: | |
1275: | |
1276: | |
1277: | |
1278: | |
1279: | public function PopulateFileItem($UserId, $Item) |
1280: | { |
1281: | return $Item; |
1282: | } |
1283: | |
1284: | |
1285: | |
1286: | |
1287: | |
1288: | |
1289: | |
1290: | |
1291: | public function PopulateFileItems($UserId, $Items) |
1292: | { |
1293: | return $Items; |
1294: | } |
1295: | |
1296: | |
1297: | |
1298: | |
1299: | |
1300: | |
1301: | |
1302: | |
1303: | |
1304: | public function GetFileContent($UserId, $Type, $Path, $Name) |
1305: | { |
1306: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
1307: | |
1308: | } |
1309: | |
1310: | |
1311: | |
1312: | |
1313: | |
1314: | |
1315: | |
1316: | |
1317: | |
1318: | |
1319: | public function GetFileInfo($UserId, $Type, $Path, $Id) |
1320: | { |
1321: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
1322: | |
1323: | return null; |
1324: | } |
1325: | |
1326: | |
1327: | |
1328: | |
1329: | |
1330: | |
1331: | |
1332: | |
1333: | |
1334: | |
1335: | |
1336: | |
1337: | |
1338: | |
1339: | |
1340: | |
1341: | |
1342: | |
1343: | |
1344: | |
1345: | |
1346: | |
1347: | |
1348: | |
1349: | |
1350: | |
1351: | |
1352: | |
1353: | |
1354: | |
1355: | |
1356: | |
1357: | |
1358: | |
1359: | |
1360: | |
1361: | |
1362: | |
1363: | |
1364: | |
1365: | |
1366: | |
1367: | |
1368: | |
1369: | |
1370: | |
1371: | |
1372: | |
1373: | |
1374: | |
1375: | |
1376: | |
1377: | |
1378: | |
1379: | |
1380: | |
1381: | |
1382: | |
1383: | |
1384: | public function GetPublicFiles($Hash, $Path) |
1385: | { |
1386: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::Anonymous); |
1387: | |
1388: | $mResult = []; |
1389: | |
1390: | $oMinDecorator = $this->getMinModuleDecorator(); |
1391: | if ($oMinDecorator) { |
1392: | $mMin = $oMinDecorator->GetMinByHash($Hash); |
1393: | if (!empty($mMin['__hash__'])) { |
1394: | $sUserPublicId = $mMin['UserId']; |
1395: | if ($sUserPublicId) { |
1396: | $oUser = CoreModule::Decorator()->GetUserByPublicId($sUserPublicId); |
1397: | if ($oUser) { |
1398: | $bPrevState = \Aurora\System\Api::skipCheckUserRole(true); |
1399: | $sMinPath = implode('/', array($mMin['Path'], $mMin['Name'])); |
1400: | $mPos = strpos($Path, $sMinPath); |
1401: | if ($mPos === 0 || $Path === '') { |
1402: | if ($mPos !== 0) { |
1403: | $Path = $sMinPath . $Path; |
1404: | } |
1405: | $Path = str_replace('.', '', $Path); |
1406: | $mResult = [ |
1407: | 'Items' => self::Decorator()->GetItems($oUser->Id, $mMin['Type'], $Path, '', $Hash) |
1408: | ]; |
1409: | } |
1410: | \Aurora\System\Api::skipCheckUserRole($bPrevState); |
1411: | } |
1412: | } |
1413: | } |
1414: | } |
1415: | |
1416: | return $mResult; |
1417: | } |
1418: | |
1419: | |
1420: | |
1421: | |
1422: | |
1423: | |
1424: | |
1425: | |
1426: | |
1427: | |
1428: | |
1429: | |
1430: | |
1431: | |
1432: | |
1433: | |
1434: | |
1435: | |
1436: | |
1437: | |
1438: | |
1439: | |
1440: | |
1441: | |
1442: | |
1443: | |
1444: | |
1445: | |
1446: | |
1447: | |
1448: | |
1449: | |
1450: | |
1451: | |
1452: | |
1453: | |
1454: | |
1455: | |
1456: | |
1457: | |
1458: | |
1459: | |
1460: | |
1461: | |
1462: | |
1463: | |
1464: | |
1465: | |
1466: | |
1467: | |
1468: | |
1469: | |
1470: | |
1471: | |
1472: | |
1473: | |
1474: | |
1475: | |
1476: | |
1477: | |
1478: | |
1479: | public function CreateFolder($UserId, $Type, $Path, $FolderName) |
1480: | { |
1481: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
1482: | |
1483: | return false; |
1484: | } |
1485: | |
1486: | |
1487: | |
1488: | |
1489: | |
1490: | |
1491: | |
1492: | |
1493: | |
1494: | |
1495: | |
1496: | |
1497: | |
1498: | |
1499: | |
1500: | |
1501: | |
1502: | |
1503: | |
1504: | |
1505: | |
1506: | |
1507: | |
1508: | |
1509: | |
1510: | |
1511: | |
1512: | |
1513: | |
1514: | |
1515: | |
1516: | |
1517: | |
1518: | |
1519: | |
1520: | |
1521: | |
1522: | |
1523: | |
1524: | |
1525: | |
1526: | |
1527: | |
1528: | |
1529: | |
1530: | |
1531: | |
1532: | |
1533: | |
1534: | |
1535: | |
1536: | |
1537: | |
1538: | |
1539: | |
1540: | |
1541: | |
1542: | |
1543: | |
1544: | |
1545: | |
1546: | |
1547: | |
1548: | |
1549: | |
1550: | |
1551: | |
1552: | |
1553: | public function CreateLink($UserId, $Type, $Path, $Link, $Name) |
1554: | { |
1555: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
1556: | return false; |
1557: | } |
1558: | |
1559: | |
1560: | |
1561: | |
1562: | |
1563: | |
1564: | |
1565: | |
1566: | |
1567: | |
1568: | |
1569: | |
1570: | |
1571: | |
1572: | |
1573: | |
1574: | |
1575: | |
1576: | |
1577: | |
1578: | |
1579: | |
1580: | |
1581: | |
1582: | |
1583: | |
1584: | |
1585: | |
1586: | |
1587: | |
1588: | |
1589: | |
1590: | |
1591: | |
1592: | |
1593: | |
1594: | |
1595: | |
1596: | |
1597: | |
1598: | |
1599: | |
1600: | |
1601: | |
1602: | |
1603: | |
1604: | |
1605: | |
1606: | |
1607: | |
1608: | |
1609: | |
1610: | |
1611: | |
1612: | |
1613: | |
1614: | |
1615: | |
1616: | |
1617: | |
1618: | public function Delete($UserId, $Type, $Items) |
1619: | { |
1620: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
1621: | |
1622: | return false; |
1623: | } |
1624: | |
1625: | |
1626: | |
1627: | |
1628: | |
1629: | |
1630: | |
1631: | |
1632: | |
1633: | |
1634: | |
1635: | |
1636: | |
1637: | |
1638: | |
1639: | |
1640: | |
1641: | |
1642: | |
1643: | |
1644: | |
1645: | |
1646: | |
1647: | |
1648: | |
1649: | |
1650: | |
1651: | |
1652: | |
1653: | |
1654: | |
1655: | |
1656: | |
1657: | |
1658: | |
1659: | |
1660: | |
1661: | |
1662: | |
1663: | |
1664: | |
1665: | |
1666: | |
1667: | |
1668: | |
1669: | |
1670: | |
1671: | |
1672: | |
1673: | |
1674: | |
1675: | |
1676: | |
1677: | |
1678: | |
1679: | |
1680: | |
1681: | |
1682: | |
1683: | |
1684: | public function LeaveShare($UserId, $Type, $Items) |
1685: | { |
1686: | $aArgs = [ |
1687: | 'UserId' => $UserId, |
1688: | 'Type' => $Type, |
1689: | 'Items' => $Items |
1690: | ]; |
1691: | EventEmitter::getInstance()->emit('Files', 'Delete::before', $aArgs); |
1692: | |
1693: | $UserId = $aArgs['UserId']; |
1694: | $Type = $aArgs['Type']; |
1695: | $Items = $aArgs['Items']; |
1696: | |
1697: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
1698: | $aNodes = []; |
1699: | $aItems = []; |
1700: | foreach ($Items as $aItem) { |
1701: | try { |
1702: | $oNode = Server::getNodeForPath(Constants::FILESTORAGE_PATH_ROOT . '/' . $Type . '/' . $aItem['Path'] . '/' . $aItem['Name']); |
1703: | $aItems[] = $oNode; |
1704: | } catch (\Exception $oEx) { |
1705: | Api::LogException($oEx); |
1706: | throw new ApiException(ErrorCodes::NotFound); |
1707: | } |
1708: | |
1709: | if (!($oNode instanceof \Afterlogic\DAV\FS\Shared\File || $oNode instanceof \Afterlogic\DAV\FS\Shared\Directory)) { |
1710: | throw new ApiException(ErrorCodes::CantDeleteSharedItem); |
1711: | } |
1712: | |
1713: | $oItem = new Classes\FileItem(); |
1714: | $oItem->Id = $aItem['Name']; |
1715: | $oItem->Name = $aItem['Name']; |
1716: | $oItem->TypeStr = $Type; |
1717: | $oItem->Path = $aItem['Path']; |
1718: | |
1719: | self::Decorator()->DeletePublicLink($UserId, $Type, $aItem['Path'], $aItem['Name']); |
1720: | \Aurora\System\Managers\Thumb::RemoveFromCache($UserId, $oItem->getHash(), $aItem['Name']); |
1721: | } |
1722: | |
1723: | $aArgs = [ |
1724: | 'UserId' => $UserId, |
1725: | 'Type' => $Type, |
1726: | 'Items' => $aItems |
1727: | ]; |
1728: | $mResult = false; |
1729: | |
1730: | EventEmitter::getInstance()->emit('Files', 'LeaveShare', $aArgs, $mResult); |
1731: | |
1732: | return $mResult; |
1733: | } |
1734: | |
1735: | |
1736: | |
1737: | |
1738: | |
1739: | |
1740: | |
1741: | |
1742: | |
1743: | |
1744: | |
1745: | |
1746: | |
1747: | |
1748: | |
1749: | |
1750: | |
1751: | |
1752: | |
1753: | |
1754: | |
1755: | |
1756: | |
1757: | |
1758: | |
1759: | |
1760: | |
1761: | |
1762: | |
1763: | |
1764: | |
1765: | |
1766: | |
1767: | |
1768: | |
1769: | |
1770: | |
1771: | |
1772: | |
1773: | |
1774: | |
1775: | |
1776: | |
1777: | |
1778: | |
1779: | |
1780: | |
1781: | |
1782: | |
1783: | |
1784: | |
1785: | |
1786: | |
1787: | |
1788: | |
1789: | |
1790: | |
1791: | |
1792: | |
1793: | |
1794: | |
1795: | |
1796: | |
1797: | |
1798: | |
1799: | |
1800: | public function Rename($UserId, $Type, $Path, $Name, $NewName, $IsLink) |
1801: | { |
1802: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
1803: | |
1804: | if ($Name === '') { |
1805: | throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::InvalidInputParameter); |
1806: | } |
1807: | |
1808: | $oItem = new Classes\FileItem(); |
1809: | $oItem->Id = $Name; |
1810: | $oItem->Name = $Name; |
1811: | $oItem->TypeStr = $Type; |
1812: | $oItem->Path = $Path; |
1813: | |
1814: | \Aurora\System\Managers\Thumb::RemoveFromCache($UserId, $oItem->getHash(), $Name); |
1815: | |
1816: | |
1817: | return false; |
1818: | } |
1819: | |
1820: | |
1821: | |
1822: | |
1823: | |
1824: | |
1825: | |
1826: | |
1827: | |
1828: | |
1829: | |
1830: | |
1831: | |
1832: | |
1833: | |
1834: | |
1835: | |
1836: | |
1837: | |
1838: | |
1839: | |
1840: | |
1841: | |
1842: | |
1843: | |
1844: | |
1845: | |
1846: | |
1847: | |
1848: | |
1849: | |
1850: | |
1851: | |
1852: | |
1853: | |
1854: | |
1855: | |
1856: | |
1857: | |
1858: | |
1859: | |
1860: | |
1861: | |
1862: | |
1863: | |
1864: | |
1865: | |
1866: | |
1867: | |
1868: | |
1869: | |
1870: | |
1871: | |
1872: | |
1873: | |
1874: | |
1875: | |
1876: | |
1877: | |
1878: | |
1879: | |
1880: | |
1881: | |
1882: | |
1883: | |
1884: | |
1885: | |
1886: | |
1887: | |
1888: | |
1889: | public function Copy($UserId, $FromType, $ToType, $FromPath, $ToPath, $Files) |
1890: | { |
1891: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
1892: | return null; |
1893: | } |
1894: | |
1895: | |
1896: | |
1897: | |
1898: | |
1899: | |
1900: | |
1901: | |
1902: | |
1903: | |
1904: | |
1905: | |
1906: | |
1907: | |
1908: | |
1909: | |
1910: | |
1911: | |
1912: | |
1913: | |
1914: | |
1915: | |
1916: | |
1917: | |
1918: | |
1919: | |
1920: | |
1921: | |
1922: | |
1923: | |
1924: | |
1925: | |
1926: | |
1927: | |
1928: | |
1929: | |
1930: | |
1931: | |
1932: | |
1933: | |
1934: | |
1935: | |
1936: | |
1937: | |
1938: | |
1939: | |
1940: | |
1941: | |
1942: | |
1943: | |
1944: | |
1945: | |
1946: | |
1947: | |
1948: | |
1949: | |
1950: | |
1951: | |
1952: | |
1953: | |
1954: | |
1955: | |
1956: | |
1957: | |
1958: | |
1959: | |
1960: | |
1961: | |
1962: | |
1963: | |
1964: | public function Move($UserId, $FromType, $ToType, $FromPath, $ToPath, $Files) |
1965: | { |
1966: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
1967: | foreach ($Files as $aFile) { |
1968: | if (!$aFile['IsFolder']) { |
1969: | $oItem = new Classes\FileItem(); |
1970: | $oItem->Id = $aFile['Name']; |
1971: | $oItem->Name = $aFile['Name']; |
1972: | $oItem->TypeStr = $FromType; |
1973: | $oItem->Path = $FromPath; |
1974: | |
1975: | \Aurora\System\Managers\Thumb::RemoveFromCache($UserId, $oItem->getHash(), $aFile['Name']); |
1976: | } |
1977: | } |
1978: | |
1979: | return false; |
1980: | } |
1981: | |
1982: | |
1983: | |
1984: | |
1985: | |
1986: | |
1987: | |
1988: | |
1989: | |
1990: | |
1991: | |
1992: | |
1993: | |
1994: | |
1995: | |
1996: | |
1997: | |
1998: | |
1999: | |
2000: | |
2001: | |
2002: | |
2003: | |
2004: | |
2005: | |
2006: | |
2007: | |
2008: | |
2009: | |
2010: | |
2011: | |
2012: | |
2013: | |
2014: | |
2015: | |
2016: | |
2017: | |
2018: | |
2019: | |
2020: | |
2021: | |
2022: | |
2023: | |
2024: | |
2025: | |
2026: | |
2027: | |
2028: | |
2029: | |
2030: | |
2031: | |
2032: | |
2033: | |
2034: | |
2035: | |
2036: | |
2037: | |
2038: | |
2039: | |
2040: | |
2041: | |
2042: | |
2043: | |
2044: | |
2045: | |
2046: | public function CreatePublicLink($UserId, $Type, $Path, $Name, $Size, $IsFolder) |
2047: | { |
2048: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
2049: | return false; |
2050: | } |
2051: | |
2052: | |
2053: | |
2054: | |
2055: | |
2056: | |
2057: | |
2058: | |
2059: | |
2060: | |
2061: | |
2062: | |
2063: | |
2064: | |
2065: | |
2066: | |
2067: | |
2068: | |
2069: | |
2070: | |
2071: | |
2072: | |
2073: | |
2074: | |
2075: | |
2076: | |
2077: | |
2078: | |
2079: | |
2080: | |
2081: | |
2082: | |
2083: | |
2084: | |
2085: | |
2086: | |
2087: | |
2088: | |
2089: | |
2090: | |
2091: | |
2092: | |
2093: | |
2094: | |
2095: | |
2096: | |
2097: | |
2098: | |
2099: | |
2100: | |
2101: | |
2102: | |
2103: | |
2104: | |
2105: | |
2106: | |
2107: | |
2108: | |
2109: | |
2110: | |
2111: | |
2112: | public function DeletePublicLink($UserId, $Type, $Path, $Name) |
2113: | { |
2114: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
2115: | return false; |
2116: | } |
2117: | |
2118: | |
2119: | |
2120: | |
2121: | |
2122: | |
2123: | |
2124: | |
2125: | |
2126: | |
2127: | |
2128: | |
2129: | public function CheckUrl($Url) |
2130: | { |
2131: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
2132: | $mResult = false; |
2133: | |
2134: | if (substr($Url, 0, 11) === 'javascript:') { |
2135: | $Url = substr($Url, 11); |
2136: | } |
2137: | |
2138: | $aArgs = array( |
2139: | 'Url' => $Url |
2140: | ); |
2141: | $this->broadcastEvent( |
2142: | 'CheckUrl', |
2143: | $aArgs, |
2144: | $mResult |
2145: | ); |
2146: | |
2147: | return $mResult; |
2148: | } |
2149: | |
2150: | |
2151: | |
2152: | |
2153: | public function GetFilesForUpload($UserId, $Hashes = array()) |
2154: | { |
2155: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
2156: | $sUUID = \Aurora\System\Api::getUserUUIDById($UserId); |
2157: | |
2158: | $mResult = false; |
2159: | if (is_array($Hashes) && 0 < count($Hashes)) { |
2160: | $mResult = array(); |
2161: | foreach ($Hashes as $sHash) { |
2162: | $aData = \Aurora\System\Api::DecodeKeyValues($sHash); |
2163: | if (\is_array($aData) && 0 < \count($aData)) { |
2164: | $oFileInfo = self::Decorator()->GetFileInfo($UserId, $aData['Type'], $aData['Path'], $aData['Id']); |
2165: | |
2166: | $aArgs = array( |
2167: | 'UserId' => $UserId, |
2168: | 'Type' => $aData['Type'], |
2169: | 'Path' => $aData['Path'], |
2170: | 'Name' => $aData['Name'], |
2171: | 'Id' => $aData['Id'] |
2172: | ); |
2173: | $rFile = false; |
2174: | $this->broadcastEvent( |
2175: | 'GetFile', |
2176: | $aArgs, |
2177: | $rFile |
2178: | ); |
2179: | |
2180: | $sTempName = md5('Files/Tmp/' . $aData['Type'] . $aData['Path'] . $aData['Name'] . microtime(true) . rand(1000, 9999)); |
2181: | |
2182: | if (is_resource($rFile) && $this->getFilecacheManager()->putFile($sUUID, $sTempName, $rFile)) { |
2183: | $aItem = array( |
2184: | 'Name' => $oFileInfo->Name, |
2185: | 'TempName' => $sTempName, |
2186: | 'Size' => $oFileInfo->Size, |
2187: | 'Hash' => $sHash, |
2188: | 'MimeType' => '' |
2189: | ); |
2190: | |
2191: | $aItem['MimeType'] = \MailSo\Base\Utils::MimeContentType($aItem['Name']); |
2192: | $aItem['NewHash'] = \Aurora\System\Api::EncodeKeyValues(array( |
2193: | 'TempFile' => true, |
2194: | 'UserId' => $UserId, |
2195: | 'Name' => $aItem['Name'], |
2196: | 'TempName' => $sTempName |
2197: | )); |
2198: | |
2199: | $aActions = array( |
2200: | 'view' => array( |
2201: | 'url' => '?file-cache/' . $aItem['NewHash'] . '/view' |
2202: | ), |
2203: | 'download' => array( |
2204: | 'url' => '?file-cache/' . $aItem['NewHash'] |
2205: | ) |
2206: | ); |
2207: | $aItem['Actions'] = $aActions; |
2208: | |
2209: | $mResult[] = $aItem; |
2210: | |
2211: | if (is_resource($rFile)) { |
2212: | @fclose($rFile); |
2213: | } |
2214: | } |
2215: | } |
2216: | } |
2217: | } else { |
2218: | throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::InvalidInputParameter); |
2219: | } |
2220: | |
2221: | return $mResult; |
2222: | } |
2223: | |
2224: | |
2225: | |
2226: | |
2227: | |
2228: | |
2229: | |
2230: | |
2231: | |
2232: | public function IsFileExists($UserId, $Type, $Path, $Name) |
2233: | { |
2234: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
2235: | return true; |
2236: | } |
2237: | |
2238: | |
2239: | |
2240: | |
2241: | |
2242: | |
2243: | |
2244: | |
2245: | public function GetNonExistentFileName($UserId, $Type, $Path, $Name, $WithoutGroup = false) |
2246: | { |
2247: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
2248: | return $Name; |
2249: | } |
2250: | |
2251: | |
2252: | |
2253: | |
2254: | |
2255: | |
2256: | public function SaveFilesAsTempFiles($UserId, $Files) |
2257: | { |
2258: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
2259: | |
2260: | $mResult = false; |
2261: | |
2262: | if (is_array($Files) && count($Files) > 0) { |
2263: | $mResult = array(); |
2264: | foreach ($Files as $aFile) { |
2265: | $Storage = $aFile['Storage']; |
2266: | $Path = $aFile['Path']; |
2267: | $Name = $aFile['Name']; |
2268: | $Id = $aFile['Name']; |
2269: | |
2270: | $aArgs = array( |
2271: | 'UserId' => $UserId, |
2272: | 'Type' => $Storage, |
2273: | 'Path' => $Path, |
2274: | 'Name' => &$Name, |
2275: | 'Id' => $Id, |
2276: | 'IsThumb' => false, |
2277: | 'Offset' => 0, |
2278: | 'ChunkSize' => 0 |
2279: | ); |
2280: | $mFileResource = false; |
2281: | $this->broadcastEvent( |
2282: | 'GetFile', |
2283: | $aArgs, |
2284: | $mFileResource |
2285: | ); |
2286: | |
2287: | if (is_resource($mFileResource)) { |
2288: | $sUUID = \Aurora\System\Api::getUserUUIDById($UserId); |
2289: | try { |
2290: | $sTempName = md5($sUUID . $Storage . $Path . $Name); |
2291: | |
2292: | if (!$this->getFilecacheManager()->isFileExists($sUUID, $sTempName)) { |
2293: | $this->getFilecacheManager()->putFile($sUUID, $sTempName, $mFileResource); |
2294: | } |
2295: | |
2296: | if ($this->getFilecacheManager()->isFileExists($sUUID, $sTempName)) { |
2297: | $mResult[] = \Aurora\System\Utils::GetClientFileResponse( |
2298: | null, |
2299: | $UserId, |
2300: | $Name, |
2301: | $sTempName, |
2302: | $this->getFilecacheManager()->fileSize($sUUID, $sTempName) |
2303: | ); |
2304: | } |
2305: | } catch (\Exception $oException) { |
2306: | throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::FilesNotAllowed, $oException); |
2307: | } |
2308: | } |
2309: | } |
2310: | } |
2311: | |
2312: | return $mResult; |
2313: | } |
2314: | |
2315: | public function UpdateSettingsForEntity($EntityType, $EntityId, $UserSpaceLimitMb, $TenantSpaceLimitMb) |
2316: | { |
2317: | $bResult = false; |
2318: | $oAuthenticatedUser = \Aurora\System\Api::getAuthenticatedUser(); |
2319: | |
2320: | if ($EntityType === '') { |
2321: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::SuperAdmin); |
2322: | $this->setConfig('TenantSpaceLimitMb', $TenantSpaceLimitMb); |
2323: | $this->setConfig('UserSpaceLimitMb', $UserSpaceLimitMb); |
2324: | return $this->saveModuleConfig(); |
2325: | } |
2326: | if ($EntityType === 'Tenant') { |
2327: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::TenantAdmin); |
2328: | $oTenant = \Aurora\Modules\Core\Module::Decorator()->GetTenantWithoutRoleCheck($EntityId); |
2329: | |
2330: | if ($oTenant instanceof Tenant |
2331: | && $oAuthenticatedUser instanceof User |
2332: | && (($oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::TenantAdmin && $oTenant->Id === $oAuthenticatedUser->IdTenant) |
2333: | || $oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::SuperAdmin)) { |
2334: | if ($oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::SuperAdmin) { |
2335: | $oTenant->setExtendedProp(self::GetName() . '::TenantSpaceLimitMb', $TenantSpaceLimitMb); |
2336: | } |
2337: | if (is_int($UserSpaceLimitMb)) { |
2338: | if ($UserSpaceLimitMb <= $TenantSpaceLimitMb || $TenantSpaceLimitMb === 0) { |
2339: | $oTenant->setExtendedProp(self::GetName() . '::UserSpaceLimitMb', $UserSpaceLimitMb); |
2340: | } else { |
2341: | throw new \Aurora\System\Exceptions\ApiException(1, null, 'User space limit must be less then tenant space limit'); |
2342: | } |
2343: | } |
2344: | |
2345: | $bResult = \Aurora\Modules\Core\Module::Decorator()->UpdateTenantObject($oTenant); |
2346: | } |
2347: | } |
2348: | if ($EntityType === 'User') { |
2349: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::TenantAdmin); |
2350: | $oUser = \Aurora\Modules\Core\Module::Decorator()->GetUserWithoutRoleCheck($EntityId); |
2351: | |
2352: | if ($oUser instanceof \Aurora\Modules\Core\Models\User |
2353: | && $oAuthenticatedUser instanceof \Aurora\Modules\Core\Models\User |
2354: | && (($oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::TenantAdmin && $oUser->IdTenant === $oAuthenticatedUser->IdTenant) |
2355: | || $oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::SuperAdmin)) { |
2356: | $oTenant = \Aurora\Modules\Core\Module::Decorator()->GetTenantWithoutRoleCheck($oUser->IdTenant); |
2357: | |
2358: | $iTenantSpaceLimitMb = $oTenant->getExtendedProp(self::GetName() . '::TenantSpaceLimitMb'); |
2359: | if ($iTenantSpaceLimitMb > 0) { |
2360: | $iAllocatedSpaceForUsersInTenant = $this->GetAllocatedSpaceForUsersInTenant($oUser->IdTenant); |
2361: | $iNewAllocatedSpaceForUsersInTenant = $iAllocatedSpaceForUsersInTenant - $oUser->getExtendedProp(self::GetName() . '::UserSpaceLimitMb') + $UserSpaceLimitMb; |
2362: | if ($iNewAllocatedSpaceForUsersInTenant > $iTenantSpaceLimitMb) { |
2363: | throw new \Aurora\System\Exceptions\ApiException(1, null, 'Over quota'); |
2364: | } |
2365: | } |
2366: | |
2367: | $oUser->setExtendedProp(self::GetName() . '::UserSpaceLimitMb', $UserSpaceLimitMb); |
2368: | |
2369: | $bResult = \Aurora\Modules\Core\Module::Decorator()->UpdateUserObject($oUser); |
2370: | } |
2371: | } |
2372: | |
2373: | return $bResult; |
2374: | } |
2375: | |
2376: | public function UpdateUserSpaceLimit($UserId, $Limit) |
2377: | { |
2378: | $mResult = false; |
2379: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::TenantAdmin); |
2380: | |
2381: | $oAuthenticatedUser = \Aurora\System\Api::getAuthenticatedUser(); |
2382: | $oUser = \Aurora\Modules\Core\Module::Decorator()->GetUserWithoutRoleCheck($UserId); |
2383: | |
2384: | if ($oUser instanceof \Aurora\Modules\Core\Models\User && $oAuthenticatedUser instanceof \Aurora\Modules\Core\Models\User && ( |
2385: | ($oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::TenantAdmin && $oUser->IdTenant === $oAuthenticatedUser->IdTenant) || |
2386: | $oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::SuperAdmin |
2387: | ) |
2388: | ) { |
2389: | $oUser->setExtendedProp(self::GetName() . '::UserSpaceLimitMb', $Limit); |
2390: | $mResult = \Aurora\Modules\Core\Module::Decorator()->UpdateUserObject($oUser); |
2391: | } |
2392: | |
2393: | return $mResult; |
2394: | } |
2395: | |
2396: | public function UpdateTenantSpaceLimit($TenantId, $Limit) |
2397: | { |
2398: | $mResult = false; |
2399: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::SuperAdmin); |
2400: | |
2401: | $oAuthenticatedUser = \Aurora\System\Api::getAuthenticatedUser(); |
2402: | $oTenant = \Aurora\Modules\Core\Module::Decorator()->GetTenantWithoutRoleCheck($TenantId); |
2403: | |
2404: | if ($oTenant instanceof Tenant && $oAuthenticatedUser instanceof User && ( |
2405: | ($oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::TenantAdmin && $oTenant->Id === $oAuthenticatedUser->IdTenant) || |
2406: | $oAuthenticatedUser->Role === \Aurora\System\Enums\UserRole::SuperAdmin |
2407: | ) |
2408: | ) { |
2409: | $oTenant->setExtendedProp(self::GetName() . '::UserSpaceLimitMb', $Limit); |
2410: | $mResult = \Aurora\Modules\Core\Module::Decorator()->UpdateUserObject($oTenant); |
2411: | } |
2412: | |
2413: | return $mResult; |
2414: | } |
2415: | |
2416: | public function GetAllocatedSpaceForUsersInTenant($TenantId) |
2417: | { |
2418: | return User::where('IdTenant', $TenantId)->sum('Properties->Files::UserSpaceLimitMb'); |
2419: | } |
2420: | |
2421: | public function CheckAllocatedSpaceLimitForUsersInTenant($oTenant, $UserSpaceLimitMb) |
2422: | { |
2423: | $iTenantSpaceLimitMb = $oTenant->getExtendedProp(self::GetName() . '::TenantSpaceLimitMb'); |
2424: | $iAllocatedSpaceForUsersInTenant = $this->GetAllocatedSpaceForUsersInTenant($oTenant->Id); |
2425: | |
2426: | if ($iTenantSpaceLimitMb > 0 && $iAllocatedSpaceForUsersInTenant + $UserSpaceLimitMb > $iTenantSpaceLimitMb) { |
2427: | throw new \Aurora\System\Exceptions\ApiException(1, null, 'Over quota'); |
2428: | } |
2429: | } |
2430: | |
2431: | |
2432: | |
2433: | |
2434: | |
2435: | |
2436: | |
2437: | |
2438: | |
2439: | |
2440: | |
2441: | |
2442: | public function UpdateExtendedProps($UserId, $Type, $Path, $Name, $ExtendedProps) |
2443: | { |
2444: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
2445: | |
2446: | return false; |
2447: | |
2448: | } |
2449: | |
2450: | public function GetExtendedProps($UserId = null, $Type = null, $Path = null, $Name = null) |
2451: | { |
2452: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
2453: | |
2454: | if ($UserId === null || $Type === null || $Path === null || $Name === null) { |
2455: | throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Notifications::InvalidInputParameter); |
2456: | } |
2457: | |
2458: | return false; |
2459: | |
2460: | } |
2461: | |
2462: | public function GetAccessInfoForPath($UserId, $Type, $Path) |
2463: | { |
2464: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser); |
2465: | |
2466: | |
2467: | return false; |
2468: | } |
2469: | |
2470: | } |
2471: | |