| @@ 53-55 (lines=3) @@ | ||
| 50 | } |
|
| 51 | ||
| 52 | // check if user have permission to access there |
|
| 53 | if (!App::$User->isAuth() || !App::$User->identity()->getRole()->can('global/file')) { |
|
| 54 | throw new NativeException('Permission denied'); |
|
| 55 | } |
|
| 56 | ||
| 57 | // check if directory exist |
|
| 58 | if (!Directory::exist('/upload/gallery/' . $id)) { |
|
| @@ 127-129 (lines=3) @@ | ||
| 124 | } |
|
| 125 | ||
| 126 | // check if user have permission to access there |
|
| 127 | if (!App::$User->isAuth() || !App::$User->identity()->getRole()->can('global/file')) { |
|
| 128 | throw new NativeException('Permission denied'); |
|
| 129 | } |
|
| 130 | ||
| 131 | $thumbDir = Normalize::diskFullPath('/upload/gallery/' . $id . '/orig/'); |
|
| 132 | if (!Directory::exist($thumbDir)) { |
|
| @@ 124-126 (lines=3) @@ | ||
| 121 | // if no entity is founded for this path lets try to find on trashed |
|
| 122 | if ($contentRecord === null || $contentRecord->count() !== 1) { |
|
| 123 | // check if user can access to content list on admin panel |
|
| 124 | if (!App::$User->isAuth() || !App::$User->identity()->getRole()->can('Admin/Content/Index')) { |
|
| 125 | throw new NotFoundException(); |
|
| 126 | } |
|
| 127 | // lets try to find in trashed |
|
| 128 | $contentRecord->withTrashed(); |
|
| 129 | // no way, lets throw exception |
|