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