diff --git a/app/ClubEvent.php b/app/ClubEvent.php index 986596163..23d679542 100644 --- a/app/ClubEvent.php +++ b/app/ClubEvent.php @@ -127,11 +127,11 @@ public function schedule() */ public function hasShift($person) { - return $this->shifts ->contains(function(Shift $shift) use($person){ - return $shift->person_id === $person->id; + return $this->shifts->contains(function(Shift $shift) use($person){ + return $shift->person_id == $person->id; }); } - + /** * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough|Shift */ diff --git a/app/Console/Commands/UpdateLara.php b/app/Console/Commands/UpdateLara.php index 71b3ce4e4..781f54b1f 100755 --- a/app/Console/Commands/UpdateLara.php +++ b/app/Console/Commands/UpdateLara.php @@ -95,7 +95,7 @@ public function handle() // log what you are doing $this->info(''); // new line - $this->info('Executing "'.$step.'"...'); + $this->info('Executing "' . $step . '"...'); // perform the instruction passthru($step, $result); @@ -115,8 +115,8 @@ public function handle() // Inform the users $this->info(''); // new line $this->info(''); // new line - Log::info('Finished Lara update after '.($counterEnd - $counterStart).' seconds.'); - $this->info('Finished Lara update after '.($counterEnd - $counterStart).' seconds.'); + Log::info('Finished Lara update after ' . ($counterEnd - $counterStart) . ' seconds.'); + $this->info('Finished Lara update after ' . ($counterEnd - $counterStart) . ' seconds.'); } } diff --git a/app/Http/Controllers/ClubEventController.php b/app/Http/Controllers/ClubEventController.php index 921546818..43b30dbed 100644 --- a/app/Http/Controllers/ClubEventController.php +++ b/app/Http/Controllers/ClubEventController.php @@ -19,8 +19,8 @@ use Lara\ShiftType; use Lara\Shift; use Lara\Person; -use Lara\Section; use Lara\Schedule; +use Lara\Section; use Lara\Template; use Lara\Utilities; use Lara\utilities\RoleUtility; diff --git a/app/Http/Controllers/LoginController.php b/app/Http/Controllers/LoginController.php index 9cede3665..5fa28b380 100755 --- a/app/Http/Controllers/LoginController.php +++ b/app/Http/Controllers/LoginController.php @@ -12,6 +12,7 @@ use Lara\Section; use Lara\User; use Lara\utilities\RoleUtility; +use Lara\Utilities; use Log; use Session; @@ -151,7 +152,8 @@ protected function attemptLoginViaLDAP() try { return $this->attemptLoginViaLDAPInternal(); } catch (\Exception $e) { - Log::error("ldap broken: " . $e->getMessage(), $e->getTrace()); + Log::error(Input::get("username") . " tried to login via LDAP, but LDAP is not available."); + Utilities::error(trans("auth.ldap_down")); return false; } } @@ -452,8 +454,7 @@ protected function attemptLoginWithCredentials($request, $userIdentifier = 'emai */ protected function loginFailed() { - Session::put('message', Config::get('messages_de.login-fail')); - Session::put('msgType', 'danger'); + Utilities::error(Config::get('messages_de.login-fail')); return redirect()->back(); } diff --git a/app/Http/Controllers/ShiftController.php b/app/Http/Controllers/ShiftController.php index d89c0bfc2..fa0bb4301 100644 --- a/app/Http/Controllers/ShiftController.php +++ b/app/Http/Controllers/ShiftController.php @@ -517,7 +517,12 @@ private function onAdd($shift, $userName, $ldapId, $userClub) */ private function updateStatus($shift) { if ( !is_null($shift->person_id) ) { - return Status::style($shift->person->prsn_status); + + $person = $shift->person; + $club = $person->club; + $section = $club->section(); + + return Status::style($person->prsn_status, $section); } return ["status"=>"fa fa-question", "style"=>"color:lightgrey;", "title"=>"Dienst frei"]; } diff --git a/app/Http/Controllers/TemplateController.php b/app/Http/Controllers/TemplateController.php index a718b2310..dc666fff8 100644 --- a/app/Http/Controllers/TemplateController.php +++ b/app/Http/Controllers/TemplateController.php @@ -134,7 +134,7 @@ private function createShifts($inputShifts, $amount) $weight = $inputShifts["weight"][$i]; $position = $i; - $shift = ShiftController::createShiftsFromEditSchedule($id, $title, $type, $start, $end, $weight, $position); + $shift = ShiftController::createShiftsFromEditSchedule($id, $title, $type, $start, $end, $weight, $position,true); if ($shift != null) { array_push($results, $shift->id); } diff --git a/app/Status.php b/app/Status.php index 268e28a85..d883fc58a 100644 --- a/app/Status.php +++ b/app/Status.php @@ -9,13 +9,16 @@ class Status { const CANDIDATE = 'candidate'; const MEMBER = 'member'; const VETERAN = 'veteran'; + const RESIGNED = 'resigned'; const EXMEMBER = 'ex-member'; const EXCANDIDATE = 'ex-candidate'; + const GUEST = 'guest'; const ALL = [ self::CANDIDATE, self::MEMBER, self::VETERAN, + self::RESIGNED, self::EXMEMBER, self::EXCANDIDATE, ]; @@ -40,19 +43,22 @@ public static function shortHand($status) return self::SHORTHANDS[$status]; } - public static function style($status) + public static function style($status, $section = NULL) { + if (!$section) { + $section = Section::query()->first(); + } switch ($status) { case STATUS::CANDIDATE: - return ["status" => "fa fa-adjust", "style" => "color:yellowgreen;", "title" => "Kandidat"]; + return ["status" => "fa fa-adjust", "style" => "color:yellowgreen;", "title" => self::localize($status, $section)]; case STATUS::VETERAN: - return ["status" => "fa fa-star", "style" => "color:gold;", "title" => "Veteran"]; + return ["status" => "fa fa-star", "style" => "color:gold;", "title" => self::localize($status, $section)]; case STATUS::MEMBER: - return ["status" => "fa fa-circle", "style" => "color:forestgreen;", "title" => "Aktiv"]; + return ["status" => "fa fa-circle", "style" => "color:forestgreen;", "title" => self::localize($status, $section)]; case STATUS::EXMEMBER: - return ["status" => "fa fa-star-o", "style" => "color:gold;", "title" => "ex-Mitglied"]; + return ["status" => "fa fa-star-o", "style" => "color:gold;", "title" => self::localize($status, $section)]; case STATUS::EXCANDIDATE: - return ["status"=>"fa fa-circle", "style"=>"color:lightgrey;", "title"=>"ex-Kandidat"]; + return ["status"=>"fa fa-circle", "style"=>"color:lightgrey;", "title" => self::localize($status, $section)]; default: return ["status" => "fa fa-circle", "style" => "color:lightgrey;", "title" => "Extern"]; } diff --git a/app/User.php b/app/User.php index 738715dae..cc338dd72 100644 --- a/app/User.php +++ b/app/User.php @@ -128,6 +128,9 @@ public static function createFromPerson(Person $person) 'person_id' => $person->id, 'status' => $newStatus ]); + + $person->prsn_status = $newStatus; + $person->save(); RoleUtility::assignPrivileges( $user, $person->club->section(), RoleUtility::PRIVILEGE_MEMBER diff --git a/app/Utilities.php b/app/Utilities.php index f20b3f217..e45845e24 100755 --- a/app/Utilities.php +++ b/app/Utilities.php @@ -72,14 +72,18 @@ static function getEventTypeTranslation($typeNumber){ static function error($message) { - Session::put('message', $message); - Session::put('msgType', 'danger'); + if (!Session::has('message')) { + Session::put('message', $message); + Session::put('msgType', 'danger'); + } } static function success($message) { - Session::put('message', $message); - Session::put('msgType', 'success'); + if (!Session::has('message')) { + Session::put('message', $message); + Session::put('msgType', 'success'); + } } } diff --git a/resources/lang/de/auth.php b/resources/lang/de/auth.php index 8de3c5a18..5a38a08af 100644 --- a/resources/lang/de/auth.php +++ b/resources/lang/de/auth.php @@ -33,5 +33,6 @@ 'status' => 'Status', 'password' => 'Passwort', 'confirmPassword' => 'Passwort bestätigen', - 'register_submit' => 'Neuen Nutzer registrieren' + 'register_submit' => 'Neuen Nutzer registrieren', + 'ldap_down' => 'LDAP scheint nicht erreichbar zu sein, bitte melde dich mit deiner E-Mail Adresse an.', ]; diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index da0f82e2e..91af4cd6b 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -33,5 +33,6 @@ 'status' => 'Status', 'password' => 'Password', 'confirmPassword' => 'Confirm password', - 'register_submit' => 'Register new user' + 'register_submit' => 'Register new user', + 'ldap_down' => 'LDAP is down, please use your E-Mail for logging in.', ]; diff --git a/resources/lang/pirate/auth.php b/resources/lang/pirate/auth.php index 36b1d66ad..37c8610a5 100644 --- a/resources/lang/pirate/auth.php +++ b/resources/lang/pirate/auth.php @@ -33,5 +33,6 @@ 'status' => 'Status', 'password' => 'Passwort', 'confirmPassword' => 'Passwort bestätigen', - 'register_submit' => 'Neuen Nutzer registrieren' + 'register_submit' => 'Neuen Nutzer registrieren', + 'ldap_down' => 'LDAP scheint nicht erreichbar zu sein, bitte melde dich mit deiner E-Mail Adresse an.', ]; diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index efa4b7644..ceb91bf30 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -13,7 +13,7 @@
{{ Form::open(['class'=>"form-horizontal","method"=>"POST","route"=>'register']) }}
- +
diff --git a/resources/views/monthView.blade.php b/resources/views/monthView.blade.php index bc48a0d8a..301081a0e 100644 --- a/resources/views/monthView.blade.php +++ b/resources/views/monthView.blade.php @@ -9,8 +9,11 @@
diff --git a/resources/views/partials/navigation.blade.php b/resources/views/partials/navigation.blade.php index 78e17e98d..02f839889 100755 --- a/resources/views/partials/navigation.blade.php +++ b/resources/views/partials/navigation.blade.php @@ -86,7 +86,7 @@ class="dropdown-toggle" @endis {{-- LARA LOGS / section management or admins only --}} - @is(Roles::PRIVILEGE_CL, Roles::PRIVILEGE_ADMINISTRATOR) + @is(Roles::PRIVILEGE_ADMINISTRATOR)
  • Logs
  • @endis diff --git a/resources/views/partials/surveyForm.blade.php b/resources/views/partials/surveyForm.blade.php index d3836485e..5eefd82ab 100644 --- a/resources/views/partials/surveyForm.blade.php +++ b/resources/views/partials/surveyForm.blade.php @@ -29,11 +29,13 @@
    - + @if(!Auth::user()->isAn(Roles::PRIVILEGE_MARKETING)) + + @endif
    diff --git a/resources/views/user/edituser.blade.php b/resources/views/user/edituser.blade.php index d9643152f..a490f9410 100644 --- a/resources/views/user/edituser.blade.php +++ b/resources/views/user/edituser.blade.php @@ -27,7 +27,7 @@ @canEditUser($user)
    - + {{ Form::text('name',$user->name,['class'=>"form-control" ,'id'=>'userName','required'=>"",'autofocus'=>'']) }} @if ($errors->has('name')) diff --git a/resources/views/user/index.blade.php b/resources/views/user/index.blade.php index 9339ce19e..b47cf52ae 100644 --- a/resources/views/user/index.blade.php +++ b/resources/views/user/index.blade.php @@ -11,80 +11,82 @@
    - - - - - - - - - - - - -
    - - - - - @noLdapUser - - - - - - @endnoLdapUser -
    +
    +
    - {{ trans('auth.section') }} - - {{ trans('auth.nickname') }} - - {{ trans('auth.givenname') }} - - {{ trans('auth.lastname') }} - - {{ trans('auth.email') }} - - {{ trans('auth.status') }} -
    + + + + + + + + + + + +
    + + + + + @noLdapUser + + + + + + @endnoLdapUser +
    - @foreach($users as $user) - - - - - - - - - @endforeach - -
    + {{ trans('auth.section') }} + + {{ trans('auth.nickname') }} + + {{ trans('auth.givenname') }} + + {{ trans('auth.lastname') }} + + {{ trans('auth.email') }} + + {{ trans('auth.status') }} +
    - {{ $user->section->title }} - - $user->id])}}"> - {{ $user->name }} - - - {{ $user->givenname }} - - {{ $user->lastname }} - - {{ $user->email }} - - @canEditUser($user) - {{ Form::model($user, ['route' => ['user.update', $user->id], 'id' => 'change-user-status-' . $user->id, 'class'=>'change-user-status-form', 'method' => 'PUT']) }} - - {{ Form::close() }} - @endcanEditUser -
    + @foreach($users as $user) + + + {{ $user->section->title }} + + + $user->id])}}"> + {{ $user->name }} + + + + {{ $user->givenname }} + + + {{ $user->lastname }} + + + {{ $user->email }} + + + @canEditUser($user) + {{ Form::model($user, ['route' => ['user.update', $user->id], 'id' => 'change-user-status-' . $user->id, 'class'=>'change-user-status-form', 'method' => 'PUT']) }} + + {{ Form::close() }} + @endcanEditUser + + + @endforeach + + +
    diff --git a/routes/web.php b/routes/web.php index c5c51087a..3f4bfb058 100755 --- a/routes/web.php +++ b/routes/web.php @@ -52,7 +52,7 @@ // LOG VIEWER Route::get('logs', 'LogViewerController@index') - ->middleware('checkRoles:admin,marketing'); + ->middleware('checkRoles:admin'); // DEFAULT @@ -79,7 +79,7 @@ // MONTH Route::get('/calendar/month', 'MonthController@currentMonth'); -Route::get('/calendar/{year}/{month}', 'MonthController@showMonth'); +Route::get('/calendar/{year}/{month}', 'MonthController@showMonth')->name('calendar.month'); // WEEK @@ -199,4 +199,4 @@ // LEGAL Route::get('/privacy', 'LegalController@showPrivacyPolicy'); Route::get('/impressum', 'LegalController@showImpressum'); - Route::post('userAgreesPrivacy','UserController@agreePrivacy')->name('user.agreePrivacy'); \ No newline at end of file + Route::post('userAgreesPrivacy','UserController@agreePrivacy')->name('user.agreePrivacy');