-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of an NSAC emergency info role #330
base: master
Are you sure you want to change the base?
Changes from all commits
121c2e6
8b6f05a
97755cb
62f98ce
b966e2f
c7554c1
411bea4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,39 @@ public function run() | |
//add rol | ||
$user->roles()->attach(['1','2','3']); //id for Administrator | ||
$user->save(); | ||
|
||
//inserting test data | ||
$user = new \App\User(); | ||
$user->email = "[email protected]"; | ||
$user->password = bcrypt("test"); | ||
$user->firstname = "Board"; | ||
$user->preposition = "of"; | ||
$user->lastname = "NSAC"; | ||
$user->street = "Kerkstraat"; | ||
$user->houseNumber = 34; | ||
$user->city = "test"; | ||
$user->zipcode = "5301jh"; | ||
$user->country = "NL"; | ||
$user->phonenumber = "123456789"; | ||
$user->phonenumber_alt = "987654321"; | ||
$user->emergencyNumber = "147258369"; | ||
$user->emergencyHouseNumber = "19"; | ||
$user->emergencystreet = "Kerk straat"; | ||
$user->emergencycity = "Eindhoven"; | ||
$user->emergencyzipcode = "3633IK"; | ||
$user->emergencycountry = "NL"; | ||
$user->birthDay = Carbon::now()->subYear(20); | ||
$user->gender = "man"; | ||
$user->kind_of_member = "relationship"; //not 100% sure if this is the correct kind of member for nsac board | ||
$user->IBAN = "NL55 RABO 0107331020"; | ||
$user->BIC = ""; | ||
$user->incasso = false; | ||
$user->remark = "Ik ben een test NSAC bestuur gebruiker"; | ||
$user->save(); | ||
|
||
//add rol | ||
$user->roles()->attach(['5']); //id for nsac emergency info access | ||
$user->save(); | ||
|
||
//inserting test data | ||
$user = new \App\User(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,10 +37,14 @@ | |
<button type="submit" class="btn btn-success"><em class="ion-plus"></em> {{trans("user.makeActiveMember")}}</button> | ||
{{ Form::close() }} | ||
@endif | ||
|
||
@if(\Illuminate\Support\Facades\Auth::user()->hasRole(Config::get('constants.Administrator')) || \Illuminate\Support\Facades\Auth::user()->id === $user->id) | ||
<a href="{{url('/users/'.$user->id . '/edit' )}}" class="btn btn-primary"> | ||
<span title="{{trans("menu.edit")}}" class="ion-edit" aria-hidden="true"></span> | ||
{{trans("menu.edit")}} | ||
</a> | ||
@endif | ||
|
||
@if(\Illuminate\Support\Facades\Auth::user()->hasRole(Config::get('constants.Administrator'),Config::get('constants.Certificate_administrator'))) | ||
<a href="{{url('/users/'.$user->id . '/addCertificate' )}}" class="btn btn-primary"> | ||
<span title="{{trans("user.addCertificate")}}" class="ion-plus" aria-hidden="true"></span> | ||
|
@@ -70,30 +74,37 @@ | |
</div> | ||
<div class="card-body"> | ||
<ul class="nav nav-tabs" id="myTab" role="tablist"> | ||
<li class="nav-item"> | ||
<a class="nav-link active" id="tab1" data-toggle="tab" href="#tab1-content" role="tab" aria-controls="general" aria-selected="true">{{trans('user.personal')}}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" id="tab2" data-toggle="tab" href="#tab2-content" role="tab" aria-controls="billing" aria-selected="false">{{trans('user.financial')}}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" id="tab3" data-toggle="tab" href="#tab3-content" role="tab" aria-controls="security" aria-selected="false">{{trans('user.emergencyInfo')}}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" id="tab3" data-toggle="tab" href="#rols" role="tab" aria-controls="security" aria-selected="false">{{trans('user.rols')}}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" id="tab3" data-toggle="tab" href="#certifications" role="tab" aria-controls="security" aria-selected="false">{{trans('certificate.certificates') }}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" id="tab3" data-toggle="tab" href="#registrations" role="tab" aria-controls="security" aria-selected="false">{{trans('user.registrations') }}</a> | ||
</li> | ||
@if($user->registrationInfo !== null) | ||
@if(\Illuminate\Support\Facades\Auth::user()->hasRole(Config::get('constants.NSAC_emergency_info_administrator')) && \Illuminate\Support\Facades\Auth::user()->id !== $user->id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wat hier gebeurd is dat je conditioneel data toont wanneer een gebruiker een bepaalde rol heeft. Wat ik zou verwachten is dat deze data niet beschikbaar is voor de frontend wanneer een geberuiker geen rechten heeft tot de data. In dat geval zou ik alleen not null checks verwachten There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dat is wel een betere manier idd. Een deel van die checks moeten er volgens mij wel zijn aangezien een deel van de UI anders word als je niet alle data wilt laten zien, dus je moet bepalen welke tabs je laat zien en welke de start tab is based op welke rol de user heeft. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Klopt, Het is toelaatbaar als je conditioneel een deel van de template laat. maar conditioneel data uit de data base tonen is niet persee veilig. (er zijn manieren om dan toch de data in te kunnen zien) |
||
<li class="nav-item"> | ||
<a class="nav-link active" id="tab3" data-toggle="tab" href="#tab3-content" role="tab" aria-controls="security" aria-selected="true">{{trans('user.emergencyInfo')}}</a> | ||
</li> | ||
@else | ||
<li class="nav-item"> | ||
<a class="nav-link active" id="tab1" data-toggle="tab" href="#tab1-content" role="tab" aria-controls="general" aria-selected="true">{{trans('user.personal')}}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" id="tab2" data-toggle="tab" href="#tab2-content" role="tab" aria-controls="billing" aria-selected="false">{{trans('user.financial')}}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" id="tab3" data-toggle="tab" href="#tab3-content" role="tab" aria-controls="security" aria-selected="false">{{trans('user.emergencyInfo')}}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" data-toggle="tab" href="#registration_info" role="tab" aria-controls="security" aria-selected="false">{{trans('user.registrationInfo') }}</a> | ||
<a class="nav-link" id="tab3" data-toggle="tab" href="#rols" role="tab" aria-controls="security" aria-selected="false">{{trans('user.rols')}}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" id="tab3" data-toggle="tab" href="#certifications" role="tab" aria-controls="security" aria-selected="false">{{trans('certificate.certificates') }}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" id="tab3" data-toggle="tab" href="#registrations" role="tab" aria-controls="security" aria-selected="false">{{trans('user.registrations') }}</a> | ||
</li> | ||
@if($user->registrationInfo !== null) | ||
<li class="nav-item"> | ||
<a class="nav-link" data-toggle="tab" href="#registration_info" role="tab" aria-controls="security" aria-selected="false">{{trans('user.registrationInfo') }}</a> | ||
</li> | ||
@endif | ||
@endif | ||
</ul> | ||
|
||
@if(\Illuminate\Support\Facades\Auth::user()->hasRole(Config::get('constants.Administrator')) || \Illuminate\Support\Facades\Auth::user()->id === $user->id) | ||
<div class="tab-content space-sm"> | ||
<div class="tab-pane fade show active" id="tab1-content" role="tabpanel" aria-labelledby="tab1-content"> | ||
|
@@ -192,6 +203,7 @@ | |
</tr> | ||
</table> | ||
</div> | ||
{{-- This tab should be visible to the NSAC emergency info role --}} | ||
<div class="tab-pane fade" id="tab3-content" role="tabpanel" aria-labelledby="tab3-content"> | ||
<table class="table table-striped" style="width:100%"> | ||
<tr> | ||
|
@@ -235,7 +247,7 @@ | |
@endif | ||
</table> | ||
</div> | ||
@endif | ||
{{-- @endif --}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lege comment |
||
<div class="tab-pane fade" id="certifications" role="tabpanel" aria-labelledby="tab3-content"> | ||
<table class="table table-striped" style="width:100%"> | ||
<thead> | ||
|
@@ -304,12 +316,45 @@ | |
</tbody> | ||
</table> | ||
</div> | ||
@if($user->registrationInfo !== null) | ||
|
||
@if($user->registrationInfo !== null && (\Illuminate\Support\Facades\Auth::user()->hasRole(Config::get('constants.Administrator')) || \Illuminate\Support\Facades\Auth::user()->id === $user->id)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hetzelfde hier als comment er boven |
||
<div class="tab-pane fade" id="registration_info" role="tabpanel"> | ||
@include('beheer.user.partials.intro-info') | ||
</div> | ||
@endif | ||
</div> | ||
@elseif(\Illuminate\Support\Facades\Auth::user()->hasRole(Config::get('constants.NSAC_emergency_info_administrator')) && \Illuminate\Support\Facades\Auth::user()->id !== $user->id) | ||
<div class="tab-content space-sm"> | ||
<div class="tab-pane fade show active" id="tab3-content" role="tabpanel" aria-labelledby="tab3-content"> | ||
<table class="table table-striped" style="width:100%"> | ||
<tr> | ||
<td>{{trans('user.emergencystreet')}}</td> | ||
<td>{{$user->emergencystreet}}</td> | ||
</tr> | ||
<tr> | ||
<td>{{trans('user.emergencyHouseNumber')}}</td> | ||
<td>{{$user->emergencyHouseNumber}}</td> | ||
</tr> | ||
<tr> | ||
<td>{{trans('user.emergencyzipcode')}}</td> | ||
<td>{{$user->emergencyzipcode}}</td> | ||
</tr> | ||
<tr> | ||
<td>{{trans('user.emergencycity')}}</td> | ||
<td>{{$user->emergencycity}}</td> | ||
</tr> | ||
<tr> | ||
<td>{{trans('user.emergencycountry')}}</td> | ||
<td>{{trans('countries.' . $user->emergencycountry)}}</td> | ||
</tr> | ||
<tr> | ||
<td>{{trans('user.emergencyNumber')}}</td> | ||
<td>{{$user->emergencyNumber}}</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
@endif | ||
</div> | ||
</div> | ||
@endsection | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Het lijkt erop dat de rol hier toegang heeft tot het gehele User object. Wat stuurt de API terug naar de frontend? of filtered de API de informatie uit het user object waardoor enkel de info overblijft waar de NSAC role recht op heeft? e.g:
{ "name": "indie peeters", "emergencyInfo": { "emergencyPhonenumber": "phonenumber", "emergencyAddress": "adress", "emergencyCity": "city" } }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oeh dat is waar ja, zoals ik het had gemaakt filtert de frontend de data maar word het idd wel allemaal gestuurd volgens mij. Ik kan kijken of ik het zo kan krijgen dat het in de API al gefilterd word
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prima! laat maar weten als je hulp nodig hebt :)