← All changes
|
Modules/Course/Http/Policies/CourseAdminPolicy.php
+3
-78
2.7.7
→
2.10.0
View file →
| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | if (!$user->hasCourseCreatorAccess()) { |
| 26 | 26 | return false; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - if ($request->get('course_id')) { | |
| 29 | + if ($this->getRouteParam($request, 'course_id')) { | |
| 30 | 30 | return $this->canManageCourse($request); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | return true; |
| @@ -32,92 +32,17 @@ | ||
| 32 | 32 | |
| 33 | 33 | return true; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function findCourse(Request $request) | |
| 37 | - { | |
| 38 | - return $this->canManageCourse($request); | |
| 39 | - } | |
| 40 | - | |
| 41 | - public function updateCourse(Request $request) | |
| 42 | - { | |
| 43 | - return $this->canManageCourse($request); | |
| 44 | - } | |
| 45 | - | |
| 46 | - public function deleteCourse(Request $request) | |
| 47 | - { | |
| 48 | - return $this->canManageCourse($request); | |
| 49 | - } | |
| 50 | - | |
| 51 | - public function getOtherUsers(Request $request) | |
| 52 | - { | |
| 53 | - return $this->canManageCourse($request); | |
| 54 | - } | |
| 55 | - | |
| 56 | - public function addStudent(Request $request) | |
| 57 | - { | |
| 58 | - return $this->canManageCourse($request); | |
| 59 | - } | |
| 60 | - | |
| 61 | - public function removeStudent(Request $request) | |
| 62 | - { | |
| 63 | - return $this->canManageCourse($request); | |
| 64 | - } | |
| 65 | - | |
| 66 | - public function resetStudentProgress(Request $request) | |
| 67 | - { | |
| 68 | - return $this->canManageCourse($request); | |
| 69 | - } | |
| 70 | - | |
| 71 | - public function bulkAddStudents(Request $request) | |
| 72 | - { | |
| 73 | - return $this->canManageCourse($request); | |
| 74 | - } | |
| 75 | - | |
| 76 | - public function bulkImportStudents(Request $request) | |
| 77 | - { | |
| 78 | - return $this->canManageCourse($request); | |
| 79 | - } | |
| 80 | - | |
| 81 | - public function resolveCrmTagCourse(Request $request) | |
| 82 | - { | |
| 83 | - return $this->canManageCourse($request); | |
| 84 | - } | |
| 85 | - | |
| 86 | - public function updateLinks(Request $request) | |
| 87 | - { | |
| 88 | - return $this->canManageCourse($request); | |
| 89 | - } | |
| 90 | - | |
| 91 | - public function updateCourseLockscreenSettings(Request $request) | |
| 92 | - { | |
| 93 | - return $this->canManageCourse($request); | |
| 94 | - } | |
| 95 | - | |
| 96 | - public function getCourseWelcomeBannerSettings(Request $request) | |
| 97 | - { | |
| 98 | - return $this->canManageCourse($request); | |
| 99 | - } | |
| 100 | - | |
| 101 | - public function updateCourseWelcomeBannerSettings(Request $request) | |
| 102 | - { | |
| 103 | - return $this->canManageCourse($request); | |
| 104 | - } | |
| 105 | - | |
| 106 | - public function duplicateLesson(Request $request) | |
| 107 | - { | |
| 108 | - return $this->canManageCourse($request); | |
| 109 | - } | |
| 110 | - | |
| 111 | 36 | protected function canManageCourse(Request $request) |
| 112 | 37 | { |
| 113 | - if (current_user_can('manage_options')) { | |
| 38 | + if (Helper::isSuperAdmin()) { | |
| 114 | 39 | return true; |
| 115 | 40 | } |
| 116 | 41 | |
| 117 | 42 | $user = Helper::getCurrentUser(true); |
| 118 | 43 | |
| 119 | - if ($courseId = $request->get('course_id')) { | |
| 44 | + if ($courseId = $this->getRouteParam($request, 'course_id')) { | |
| 120 | 45 | $course = Course::find($courseId); |
| 121 | 46 | if (!$course) { |
| 122 | 47 | return false; |
| 123 | 48 | } |