| @@ 112-114 (lines=3) @@ | ||
| 109 | } |
|
| 110 | ||
| 111 | // check if user have permission to access there |
|
| 112 | if (!App::$User->isAuth() || !App::$User->identity()->getRole()->can('global/file')) { |
|
| 113 | throw new NativeException(__('Permissions to upload is denied')); |
|
| 114 | } |
|
| 115 | ||
| 116 | // check if directory exist |
|
| 117 | if (!Directory::exist('/upload/gallery/' . $id)) { |
|
| @@ 194-196 (lines=3) @@ | ||
| 191 | } |
|
| 192 | ||
| 193 | // check if user have permission to access there |
|
| 194 | if (!App::$User->isAuth() || !App::$User->identity()->getRole()->can('global/file')) { |
|
| 195 | throw new NativeException('Permission denied'); |
|
| 196 | } |
|
| 197 | ||
| 198 | $thumbDir = Normalize::diskFullPath('/upload/gallery/' . $id . '/orig/'); |
|
| 199 | if (!Directory::exist($thumbDir)) { |
|
| @@ 111-113 (lines=3) @@ | ||
| 108 | // if no entity is founded for this path lets try to find on trashed |
|
| 109 | if ($contentRecord === null || $contentRecord->count() !== 1) { |
|
| 110 | // check if user can access to content list on admin panel |
|
| 111 | if (!App::$User->isAuth() || !App::$User->identity()->getRole()->can('Admin/Content/Index')) { |
|
| 112 | throw new NotFoundException(); |
|
| 113 | } |
|
| 114 | // lets try to find in trashed |
|
| 115 | $contentRecord->withTrashed(); |
|
| 116 | // no way, lets throw exception |
|