| @@ 55-57 (lines=3) @@ | ||
| 52 | } |
|
| 53 | ||
| 54 | // check if user have permission to access there |
|
| 55 | if (!App::$User->isAuth() || !App::$User->identity()->getRole()->can('global/file')) { |
|
| 56 | throw new NativeException(__('Permissions to upload is denied')); |
|
| 57 | } |
|
| 58 | ||
| 59 | // check if directory exist |
|
| 60 | if (!Directory::exist('/upload/gallery/' . $id)) { |
|
| @@ 136-138 (lines=3) @@ | ||
| 133 | } |
|
| 134 | ||
| 135 | // check if user have permission to access there |
|
| 136 | if (!App::$User->isAuth() || !App::$User->identity()->getRole()->can('global/file')) { |
|
| 137 | throw new NativeException('Permission denied'); |
|
| 138 | } |
|
| 139 | ||
| 140 | $thumbDir = Normalize::diskFullPath('/upload/gallery/' . $id . '/orig/'); |
|
| 141 | if (!Directory::exist($thumbDir)) { |
|
| @@ 102-104 (lines=3) @@ | ||
| 99 | // if no entity is founded for this path lets try to find on trashed |
|
| 100 | if ($contentRecord === null || $contentRecord->count() !== 1) { |
|
| 101 | // check if user can access to content list on admin panel |
|
| 102 | if (!App::$User->isAuth() || !App::$User->identity()->getRole()->can('Admin/Content/Index')) { |
|
| 103 | throw new NotFoundException(); |
|
| 104 | } |
|
| 105 | // lets try to find in trashed |
|
| 106 | $contentRecord->withTrashed(); |
|
| 107 | // no way, lets throw exception |
|