15 Julio Commit
15 Julio Commit
app/Http/Controllers/Admin/RoleController.php
... ... @@ -4,10 +4,12 @@ namespace App\Http\Controllers\Admin;
4 4
5 5 use App\Http\Controllers\Controller;
6 6 use Illuminate\Http\Request;
7 + use Silber\Bouncer\Database\Ability;
7 8 use Silber\Bouncer\Database\Role;
8 9
9 10 class RoleController extends Controller
10 11 {
12 +
11 13 public function index()
12 14 {
13 15 $roles = Role::all();
... ... @@ -16,7 +18,8 @@ class RoleController extends Controller
16 18
17 19 public function show(Request $request, Role $role)
18 20 {
19 - return view('admin.roles.show', compact('role'));
21 + $abilities = Ability::orderBy('name')->get();
22 + return view('admin.roles.show', compact('role', 'abilities'));
20 23 }
21 24
22 25 public function store(Request $request)
... ... @@ -55,4 +58,15 @@ class RoleController extends Controller
55 58
56 59 return redirect()->route('admin.roles.index');
57 60 }
61 +
62 + public function syncAbilities(Request $request, Role $role)
63 + {
64 + $request->validate(['abilities' => 'required']);
65 +
66 + \Bouncer::sync($role)->abilities($request->get('abilities'));
67 +
68 + feedback('success', 'Se guardaron las habilidades');
69 +
70 + return redirect()->route('admin.roles.show', $role);
71 + }
58 72 }
app/Http/Controllers/Auth/ResetPasswordController.php
... ... @@ -27,4 +27,18 @@ class ResetPasswordController extends Controller
27 27 * @var string
28 28 */
29 29 protected $redirectTo = RouteServiceProvider::HOME;
30 +
31 + /**
32 + * Get the password reset validation rules.
33 + *
34 + * @return array
35 + */
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 1/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
app/Models/Client.php 0 → 100644
1 + <?php
2 +
3 + namespace App\Models;
4 +
5 + use Illuminate\Database\Eloquent\Model;
6 +
7 + class Client extends Model
8 +{
9 + protected $guarded = ['active'];
10 +
11 + public function plan()
12 + {
13 + return $this->belongsTo(Plan::class);
14 + }
15 +}
app/Models/ClientType.php 0 → 100644
1 + <?php
2 +
3 + namespace App\Models;
4 +
5 + use Illuminate\Database\Eloquent\Model;
6 +
7 + class ClientType extends Model
8 +{
9 + protected $guarded = [];
10 +}
app/Models/Plan.php 0 → 100644
1 + <?php
2 +
3 + namespace App\Models;
4 +
5 + use Illuminate\Database\Eloquent\Model;
6 +
7 + class Plan extends Model
8 +{
9 + protected $guarded = ['active'];
10 +}
app/Providers/AppServiceProvider.php
... ... @@ -23,6 +23,6 @@ class AppServiceProvider extends ServiceProvider
23 23 */
24 24 public function boot()
25 25 {
26 - //
26 + \Schema::defaultStringLength(191);
27 27 }
28 28 }
app/Providers/BladeServiceProvider.php
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 2/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
35 34 Blade::if('admin', function() {
36 - return true;
37 - return \Auth::user()->role == Roles::ADMIN;
35 + return \Auth::user()->isA(Roles::ADMIN['name']);
38 36 });
39 37
40 - Blade::if('docente', function() {
41 - return true;
42 - return \Auth::user()->role == Roles::DOCENTE;
38 + Blade::if('user', function() {
39 + return \Auth::user()->isA(Roles::USER['name']);
43 40 });
44 41
45 - Blade::if('egt_admin', function() {
46 - return true;
47 - return \Auth::user()->role >= Roles::ADMIN;
48 - });
49 -
50 - Blade::if('elt_admin', function() {
51 - return true;
52 - return \Auth::user()->role <= Roles::ADMIN;
53 - });
54 -
55 - Blade::if('elt_docente', function() {
56 - return true;
57 - return \Auth::user()->role <= Roles::DOCENTE;
42 + Blade::if('adminplus', function() {
43 + return \Auth::user()->isA(Roles::ADMIN['name']) || \Auth::user()-
>isA(Roles::SUPERADMIN['name']);
58 44 });
59 45
60 46 }
... ...
app/Support/Globals.php
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 3/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
34 + ];
35 +
36 + const MANAGE_ROLES = [
37 + 'name' => 'MANAGE_ROLES',
38 + 'title' => 'Administrar Roles y Permisos'
39 + ];
40 +
41 + const DO_TESTS = [
42 + 'name' => 'DO_TESTS',
43 + 'title' => 'Realizar Pruebas'
44 + ];
45 +
46 + public static function getConstants() {
47 + $oClass = new ReflectionClass(__CLASS__);
48 + return $oClass->getConstants();
49 + }
15 50 }
16 51
17 52
53 + if (!function_exists('ability')) {
54 + function ability($name)
55 + {
56 + $abilities = Abilities::getConstants();
57 + $ability = collect($abilities)->first(fn($a) => $a['name'] == $name);
58 + if (!$ability) throw new \InvalidArgumentException("Ability '{$name}' doesn't exists.");
59 + return $ability['name'];
60 + }
61 +}
62 +
18 63 if (!function_exists('feedback')) {
19 64 function feedback($type, $message)
20 65 {
... ...
app/User.php
... ... @@ -2,6 +2,7 @@
2 2
3 3 namespace App;
4 4
5 + use App\Models\Client;
5 6 use App\Models\Support\AccessLog;
6 7 use Illuminate\Contracts\Auth\MustVerifyEmail;
7 8 use Illuminate\Foundation\Auth\User as Authenticatable;
... ... @@ -45,4 +46,9 @@ class User extends Authenticatable
45 46 {
46 47 return $this->hasMany(AccessLog::class);
47 48 }
49 +
50 + public function client()
51 + {
52 + return $this->belongsTo(Client::class);
53 + }
48 54 }
database/factories/UserFactory.php
database/migrations/2020_07_13_083635_create_plans_table.php 0 → 100644
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 4/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
1 + <?php
2 +
3 + use App\Models\Plan;
4 + use Illuminate\Database\Migrations\Migration;
5 + use Illuminate\Database\Schema\Blueprint;
6 + use Illuminate\Support\Facades\Schema;
7 +
8 + class CreatePlansTable extends Migration
9 +{
10 + /**
11 + * Run the migrations.
12 + *
13 + * @return void
14 + */
15 + public function up()
16 + {
17 + Schema::create('plans', function (Blueprint $table) {
18 + $table->id();
19 + $table->string('name');
20 + $table->string('description');
21 + $table->boolean('active')->default(true);
22 + $table->timestamps();
23 + });
24 +
25 + Plan::create([
26 + 'name' => 'merani',
27 + 'description' => 'Plan Fundación Merani, Exclusivo para superadmins'
28 + ]);
29 + }
30 +
31 + /**
32 + * Reverse the migrations.
33 + *
34 + * @return void
35 + */
36 + public function down()
37 + {
38 + Schema::dropIfExists('plans');
39 + }
40 +}
database/migrations/2020_07_13_083700_create_client_types_table.php 0 → 100644
1 + <?php
2 +
3 + use App\Models\ClientType;
4 + use Illuminate\Database\Migrations\Migration;
5 + use Illuminate\Database\Schema\Blueprint;
6 + use Illuminate\Support\Facades\Schema;
7 +
8 + class CreateClientTypesTable extends Migration
9 +{
10 + /**
11 + * Run the migrations.
12 + *
13 + * @return void
14 + */
15 + public function up()
16 + {
17 + Schema::create('client_types', function (Blueprint $table) {
18 + $table->id();
19 + $table->string('name');
20 + $table->string('description');
21 + $table->timestamps();
22 + });
23 +
24 + ClientType::create([
25 + 'name' => 'institution',
26 + 'description' => 'Institución Educativa'
27 + ]);
28 +
29 + ClientType::create([
30 + 'name' => 'personal',
31 + 'description' => 'Cuenta personal o familiar'
32 + ]);
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 5/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
33 + }
34 +
35 + /**
36 + * Reverse the migrations.
37 + *
38 + * @return void
39 + */
40 + public function down()
41 + {
42 + Schema::dropIfExists('client_types');
43 + }
44 +}
database/migrations/2020_07_13_083743_create_clients_table.php 0 → 100644
1 + <?php
2 +
3 + use App\Models\Client;
4 + use Illuminate\Database\Migrations\Migration;
5 + use Illuminate\Database\Schema\Blueprint;
6 + use Illuminate\Support\Facades\Schema;
7 +
8 + class CreateClientsTable extends Migration
9 +{
10 + /**
11 + * Run the migrations.
12 + *
13 + * @return void
14 + */
15 + public function up()
16 + {
17 + Schema::create('clients', function (Blueprint $table) {
18 + $table->id();
19 + $table->string('name');
20 + $table->string('email');
21 + $table->string('phone')->nullable();
22 + $table->string('address')->nullable();
23 + $table->string('city')->nullable();
24 + $table->string('country_code')->default('CO');
25 + $table->string('image')->default(asset('images/school.jpg'));
26 + $table->foreignId('client_type_id');
27 + $table->foreignId('plan_id');
28 + $table->boolean('active')->default(true);
29 + $table->timestamps();
30 + });
31 +
32 + Client::create([
33 + 'name' => 'Fundación Alberto Merani',
34 + 'email' => 'gerencia@albertomerani.org',
35 + 'phone' => '+57(1)1111111',
36 + 'address' => 'Calle 1 Carrera 1 # 1',
37 + 'city' => 'Bogotá D.C.',
38 + 'country_code' => 'CO',
39 + 'client_type_id' => 1,
40 + 'plan_id' => 1,
41 + ]);
42 + }
43 +
44 + /**
45 + * Reverse the migrations.
46 + *
47 + * @return void
48 + */
49 + public function down()
50 + {
51 + Schema::dropIfExists('clients');
52 + }
53 +}
database/migrations/2014_10_12_000000_create_users_table.php → database/migrations/2020_07_13_084000_create_user…
... ... @@ -19,6 +19,7 @@ class CreateUsersTable extends Migration
19 19 $table->string('email')->unique();
20 20 $table->timestamp('email_verified_at')->nullable();
21 21 $table->string('password');
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 6/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
22 + $table->foreignId('client_id');
22 23 $table->rememberToken();
23 24 $table->timestamps();
24 25 });
... ... @@ -27,6 +28,7 @@ class CreateUsersTable extends Migration
27 28 'name' => 'Super Administrador',
28 29 'email' => 'superadmin@merani.com',
29 30 'password' => Hash::make('secret'),
31 + 'client_id' => 1,
30 32 'created_at' => now(),
31 33 'updated_at' => now()
32 34 ]);
... ...
database/migrations/2020_07_13_094639_create_bouncer_tables.php
... ... @@ -80,40 +80,27 @@ class CreateBouncerTables extends Migration
80 80
81 81
82 82 // Asignación de roles y permisos iniciales
83 - $superadmin = Bouncer::role()->firstOrCreate([
84 - 'name' => \Roles::SUPERADMIN,
85 - 'title' => 'Superadministrador del Sistema',
86 - ]);
87 -
88 - $admin = Bouncer::role()->firstOrCreate([
89 - 'name' => \Roles::ADMIN,
90 - 'title' => 'Administrador de Institución Educativa o de Cuenta Familiar',
91 - ]);
92 -
93 - $user = Bouncer::role()->firstOrCreate([
94 - 'name' => \Roles::USUARIO,
95 - 'title' => 'Usuario Docente, Familiar o Estudiante',
96 - ]);
97 -
98 - $adminInstitution = Bouncer::ability()->firstOrCreate([
99 - 'name' => \Abilities::ADMIN_INSTITUTION,
100 - 'title' => 'Administrar Institución',
101 - ]);
102 -
103 - $adminFamilyAccount = Bouncer::ability()->firstOrCreate([
104 - 'name' => \Abilities::ADMIN_FAMILY_ACCOUNT,
105 - 'title' => 'Administrar Cuentas Familiares',
106 - ]);
107 -
108 - $doTest = Bouncer::ability()->firstOrCreate([
109 - 'name' => \Abilities::DO_TEST,
110 - 'title' => 'Realizar Pruebas',
111 - ]);
112 -
113 - Bouncer::assign($superadmin)->to(1);
114 - Bouncer::allow($admin)->to($adminInstitution);
115 - Bouncer::allow($admin)->to($adminFamilyAccount);
116 - Bouncer::allow($user)->to($doTest);
83 + $roles = [];
84 + foreach(Roles::getConstants() as $rol) {
85 + $roles[$rol['name']] = Bouncer::role()->firstOrCreate($rol);
86 + }
87 +
88 + $abilities = [];
89 + foreach(Abilities::getConstants() as $ability) {
90 + $abilities[$ability['name']] = Bouncer::ability()->firstOrCreate($ability);
91 + }
92 +
93 + // Asignar superadmin a usuario 1
94 + Bouncer::assign($roles[Roles::SUPERADMIN['name']])->to(1);
95 +
96 + // Permitir a Admin administrar institucion
97 + Bouncer::allow($roles[Roles::ADMIN['name']])-
>to($abilities[Abilities::MANAGE_INSTITUTIONS['name']]);
98 +
99 + // Permitir a Admin administrar cta. personal
100 + Bouncer::allow($roles[Roles::ADMIN['name']])-
>to($abilities[Abilities::MANAGE_PERSONAL_ACCOUNTS['name']]);
101 +
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 7/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
database/seeds/BouncerSeeder.php
... ... @@ -11,10 +11,10 @@ class BouncerSeeder extends Seeder
11 11 */
12 12 public function run()
13 13 {
14 - Bouncer::assign(\Roles::ADMIN)->to(2);
15 - Bouncer::assign(\Roles::USUARIO)->to(3);
16 - Bouncer::assign(\Roles::USUARIO)->to(4);
17 - Bouncer::assign(\Roles::USUARIO)->to(5);
18 - Bouncer::assign(\Roles::USUARIO)->to(6);
14 + Bouncer::assign(\Roles::ADMIN['name'])->to(2);
15 + Bouncer::assign(\Roles::USER['name'])->to(3);
16 + Bouncer::assign(\Roles::USER['name'])->to(4);
17 + Bouncer::assign(\Roles::USER['name'])->to(5);
18 + Bouncer::assign(\Roles::USER['name'])->to(6);
19 19 }
20 20 }
database/seeds/ClientSeeder.php 0 → 100644
1 + <?php
2 +
3 + use App\Models\Client;
4 + use Illuminate\Database\Seeder;
5 +
6 + class ClientSeeder extends Seeder
7 +{
8 + /**
9 + * Run the database seeds.
10 + *
11 + * @return void
12 + */
13 + public function run()
14 + {
15 + Client::create([
16 + 'name' => 'Instituto Educativo Maria Gutierrez',
17 + 'email' => 'gerencia@magutierrez.edu.co',
18 + 'phone' => '+57(1)1111111',
19 + 'address' => 'Calle 1 Carrera 1 # 1',
20 + 'city' => 'Bogotá D.C.',
21 + 'country_code' => 'CO',
22 + 'client_type_id' => 1,
23 + 'plan_id' => 2,
24 + ]);
25 +
26 + Client::create([
27 + 'name' => 'Roberto Bolaños',
28 + 'email' => 'roberto@gmail.com',
29 + 'phone' => '+57(1)1111111',
30 + 'address' => 'Calle 1 Carrera 1 # 1',
31 + 'city' => 'Bogotá D.C.',
32 + 'country_code' => 'CO',
33 + 'client_type_id' => 2,
34 + 'plan_id' => 3,
35 + ]);
36 + }
37 +}
database/seeds/ClientSeederexit.php 0 → 100644
1 + <?php
2 +
3 + use Illuminate\Database\Seeder;
4 +
5 + class ClientSeederexit extends Seeder
6 +{
7 + /**
8 + * Run the database seeds.
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 8/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
9 + *
10 + * @return void
11 + */
12 + public function run()
13 + {
14 + //
15 + }
16 +}
database/seeds/DatabaseSeeder.php
... ... @@ -13,5 +13,7 @@ class DatabaseSeeder extends Seeder
13 13 {
14 14 $this->call([UsersTableSeeder::class]);
15 15 $this->call([BouncerSeeder::class]);
16 + $this->call([PlanSeeder::class]);
17 + $this->call([ClientSeeder::class]);
16 18 }
17 19 }
database/seeds/PlanSeeder.php 0 → 100644
1 + <?php
2 +
3 + use App\Models\Plan;
4 + use Illuminate\Database\Seeder;
5 +
6 + class PlanSeeder extends Seeder
7 +{
8 + /**
9 + * Run the database seeds.
10 + *
11 + * @return void
12 + */
13 + public function run()
14 + {
15 + Plan::create([
16 + 'name' => 'institucion_basico',
17 + 'description' => 'Plan Básico para Instituciones'
18 + ]);
19 +
20 + Plan::create([
21 + 'name' => 'personal_basico',
22 + 'description' => 'Plan Básico para cuentas personales y familiares'
23 + ]);
24 +
25 + }
26 +}
database/seeds/UsersTableSeeder.php
... ... @@ -18,6 +18,7 @@ class UsersTableSeeder extends Seeder
18 18 'email' => 'admin@merani.com',
19 19 'email_verified_at' => now(),
20 20 'password' => Hash::make('secret'),
21 + 'client_id' => 2,
21 22 'created_at' => now(),
22 23 'updated_at' => now()
23 24 ]);
... ... @@ -27,6 +28,7 @@ class UsersTableSeeder extends Seeder
27 28 'email' => 'docente@merani.com',
28 29 'email_verified_at' => now(),
29 30 'password' => Hash::make('secret'),
31 + 'client_id' => 2,
30 32 'created_at' => now(),
31 33 'updated_at' => now()
32 34 ]);
... ... @@ -36,6 +38,7 @@ class UsersTableSeeder extends Seeder
36 38 'email' => 'familiar@merani.com',
37 39 'email_verified_at' => now(),
38 40 'password' => Hash::make('secret'),
41 + 'client_id' => 2,
39 42 'created_at' => now(),
40 43 'updated_at' => now()
41 44 ]);
... ... @@ -45,6 +48,7 @@ class UsersTableSeeder extends Seeder
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 9/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
public/images/logos-colored.png 0 → 100644
149 KB
public/images/school.jpg 0 → 100644
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 10/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
105 KB
resources/views/_includes/dashboard/admin.blade.php 0 → 100644
1 + admin dashboard
resources/views/_includes/dashboard/superadmin.blade.php 0 → 100644
1 + superadmin dashboard
resources/views/_includes/dashboard/user.blade.php 0 → 100644
1 +
2 + <div class="row">
3 + <div class="col-md-4 mt-2">
4 + <x-stat :color="'success'" :icon="'clipboard-check'">
5 + <x-slot name="text">PRUEBAS REALIZADAS</x-slot>
6 + 220
7 + </x-stat>
8 + </div>
9 + <div class="col-md-4 mt-2">
10 + <x-stat :color="'warning'" :icon="'clipboard'">
11 + <x-slot name="text">PRUEBAS PENDIENTES</x-slot>
12 + 2
13 + </x-stat>
14 + </div>
15 + <div class="col-md-4 mt-2">
16 + <x-stat :color="'primary'" :icon="'clipboard-list'">
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 11/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
resources/views/admin/institutions/create.blade.php
1 1 @extends('layouts.app', ['title' => 'Crear Institución Educativa'])
2 - @section('title')
3 - CREAR INSTITUCIÓN EDUCATIVA
4 - @endsection
5 2 @section('content')
6 3 <div class="container">
7 4 <form action="{{route('admin.institutions.store')}}" method="post" class="w-75 mx-auto">
... ...
resources/views/admin/institutions/index.blade.php
1 - @extends('layouts.app', ['title' => 'Administrar Instituciones'])
2 - @section('title')
3 - ADMINISTRAR INSTITUCIONES EDUCATIVAS
4 - @endsection
1 + @extends('layouts.app', ['title' => 'Administrar Instituciones Educativas'])
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 12/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
5 2 @section('content')
6 3 <div class="container">
7 4 <div class="row mb-3">
... ...
resources/views/admin/institutions/show.blade.php
1 - @extends('layouts.app', ['title' => 'Administrar Instituciones'])
2 - @section('title')
3 - COLEGIO SAN PABLO SEXTO
4 - @endsection
1 + @extends('layouts.app', ['title' => 'Colegio San Pablo Sexto'])
5 2 @section('content')
6 3 <div class="container">
7 4
... ...
resources/views/admin/roles/index.blade.php
1 1 @extends('layouts.app', ['title' => 'Administrar Roles y Permisos'])
2 - @section('title')
3 - ADMINISTRAR ROLES Y PERMISOS
4 - @endsection
5 2 @section('content')
6 3 <div class="container" id="roles">
7 4
... ...
resources/views/admin/roles/show.blade.php
46 - id: '{{$ability->id}}',
47 - name: '{{$ability->name}}',
48 - title: '{{$ability->title}}'
49 - })">
50 - <i class="fa fa-edit"></i>
51 - </a>
52 - <a href="#"
53 - class="btn btn-sm btn-outline-danger py-1 px-2 mr-1"
54 - title="Eliminar"
55 - @click.prevent="destroy('{{$ability->id}}')">
56 - <i class="fa fa-trash"></i>
57 - </a>
58 - <form action="{{route('admin.abilities.destroy', $ability)}}"
59 - method="post"
60 - id="destroy-{{$ability->id}}"
61 - class="d-none">
62 - @csrf @method('delete')
63 - </form>
64 - </td>
65 - </tr>
66 - @endforeach
67 - </tbody>
68 - </table>
69 - </x-table>
70 -
71 - <div class="modal fade" id="actionModal" tabindex="-1" ability="dialog" aria-
labelledby="actionModalLabel" aria-hidden="true">
72 - <div class="modal-dialog" ability="document">
73 - <div class="modal-content">
74 - <div class="modal-header">
75 - <h5 class="modal-title" id="actionModalLabel">
76 - @{{ createMode ? 'Crear Habilidad' : 'Editar Habilidad: ' + entity.name }}
77 - </h5>
78 - <button type="button" class="close" data-dismiss="modal" aria-label="Close">
79 - <span aria-hidden="true">×</span>
80 - </button>
81 - </div>
82 - <div class="modal-body">
83 - <form :action="createMode ? '{{route('admin.roles.store')}}'
84 - : '/admin/roles/'+entity.id+''" method="post">
85 - @csrf
86 - <template v-if="!createMode">@method('put')</template>
5 + <p><span><b>Descripción del rol: </b></span> <br> {{$role->title}}</p>
87 6
88 - <div class="form-group">
89 - <label for="">Nombre</label>
90 - <input class="form-control"
91 - type="text"
92 - name="name"
93 - required
94 - v-model="entity.name">
95 - </div>
7 + <form action="{{route('admin.roles.sync-abilities', $role)}}" method="post">
8 + @csrf
96 9
97 - <div class="form-group">
98 - <label for="">Título</label>
99 - <input class="form-control"
100 - type="text"
101 - name="title"
102 - required
103 - v-model="entity.title">
104 - </div>
10 + <p>Seleccione las habilidades para este rol:</p>
105 11
106 - <button type="submit" id="submit" class="d-none"></button>
107 - </form>
12 + <div class="d-flex flex-wrap mb-3">
13 + @forelse($abilities as $ability)
14 + <div class="form-group mx-5">
15 + <input type="checkbox"
16 + name="abilities[]"
17 + value="{{$ability->id}}"
18 + id="ability-{{$ability->id}}"
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 14/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
resources/views/auth/passwords/reset.blade.php
resources/views/dashboard.blade.php
1 1 @extends('layouts.app', ['title' => 'Tablero'])
2 - @section('title')
3 - @docente()
4 - LISTADO DE INSTRUMENTOS
5 - @enddocente
6 - @endsection
7 2 @section('content')
8 3
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 15/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
9 4 <div class="container-fluid">
10 5
11 - @docente()
12 - <div class="row">
13 - <div class="col-md-4 mt-2">
14 - <x-stat :color="'success'" :icon="'clipboard-check'">
15 - <x-slot name="text">PRUEBAS REALIZADAS</x-slot>
16 - 220
17 - </x-stat>
18 - </div>
19 - <div class="col-md-4 mt-2">
20 - <x-stat :color="'warning'" :icon="'clipboard'">
21 - <x-slot name="text">PRUEBAS PENDIENTES</x-slot>
22 - 2
23 - </x-stat>
24 - </div>
25 - <div class="col-md-4 mt-2">
26 - <x-stat :color="'primary'" :icon="'clipboard-list'">
27 - <x-slot name="text">PROMEDIO DE LAS PRUEBAS</x-slot>
28 - 290
29 - </x-stat>
30 - </div>
31 - </div>
6 + @user
7 + @include('_includes.dashboard.user')
8 + @enduser
32 9
33 - <div style="overflow-x: scroll;">
34 - <table class="table mt-5">
35 - <thead>
36 - <th>ID</th>
37 - <th>INSTRUMENTO</th>
38 - <th># DOCUMENTO</th>
39 - <th>ESTUDIANTE</th>
40 - <th>ESTADO</th>
41 - <th></th>
42 - </thead>
43 - <tbody>
44 - <tr>
45 - <td>1</td>
46 - <td>NIÑAS Y NIÑOS DE 4 A 7 AÑOS</td>
47 - <td>1010034950</td>
48 - <td>JUAN ALFONSO MORA A</td>
49 - <td><span class="badge badge-success">Realizada</span></td>
50 - </tr>
51 - <tr>
52 - <td>2</td>
53 - <td>NIÑAS Y NIÑOS DE 4 A 7 AÑOS</td>
54 - <td>1220984574</td>
55 - <td>YIRA MEDINA CASTRO</td>
56 - <td><span class="badge badge-success">Realizada</span></td>
57 - </tr>
58 - <tr>
59 - <td>3</td>
60 - <td>NIÑAS Y NIÑOS DE 8 A 11 AÑOS</td>
61 - <td>1129874578</td>
62 - <td>CARLOS MENDOZA LOZ</td>
63 - <td><span class="badge badge-light">Inactiva</span></td>
64 - </tr>
65 - <tr>
66 - <td>4</td>
67 - <td>NIÑAS Y NIÑOS DE 8 A 11 AÑOS</td>
68 - <td>1118984586</td>
69 - <td>ESTUDIANTE</td>
70 - <td><span class="badge badge-warning">Pendiente</span></td>
71 - </tr>
72 - <tr>
73 - <td>5</td>
74 - <td>NIÑAS Y NIÑOS DE 8 A 11 AÑOS</td>
75 - <td>1127893765</td>
76 - <td>ESTUDIANTE</td>
77 - <td><span class="badge badge-warning">Pendiente</span></td>
78 - </tr>
79 - </tbody>
80 - </table>
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 16/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
81 - </div>
82 - @enddocente
10 + @admin
11 + @include('_includes.dashboard.admin')
12 + @endadmin
83 13
14 + @superadmin
15 + @include('_includes.dashboard.superadmin')
16 + @endsuperadmin
84 17
85 18
86 19 {{-- @include('layouts.footers.auth') --}}
... ...
resources/views/layouts/app.blade.php
... ... @@ -43,10 +43,9 @@
43 43 <div class="main-content">
44 44 @include('layouts.navbars.navbar')
45 45 @include('layouts.headers.cards')
46 - @auth
47 - @include('layouts.headers.title')
48 - @endauth
49 - @yield('content')
46 + <div class="my-3">
47 + @yield('content')
48 + </div>
50 49 </div>
51 50
52 51 @guest()
... ...
resources/views/layouts/navbars/navs/auth.blade.php
... ... @@ -2,9 +2,9 @@
2 2 <nav class="navbar navbar-top navbar-expand-md navbar-dark" id="navbar-main">
3 3 <div class="container-fluid">
4 4 <!-- Brand -->
5 - <a class="h4 mb-0 text-white text-uppercase d-none d-lg-inline-block" href="{{ route('home') }}">
6 - {{-- {{$title ?? ''}} --}}
7 - </a>
5 + <p class="h1 mb-0 text-white text-uppercase d-none d-lg-inline-block">
6 + {{$title ?? ''}}
7 + </p>
8 8 <!-- Form -->
9 9 <form class="navbar-search navbar-search-dark form-inline mr-3 d-none d-md-flex ml-lg-auto">
10 10 <!-- <div class="form-group mb-0"> -->
... ... @@ -25,11 +25,8 @@
25 25 <img alt="Image placeholder" src="{{ asset('argon') }}/img/theme/team-4-
800x800.jpg">
26 26 </span>
27 27 <div class="media-body text-left ml-2 d-none d-lg-block">
28 - <span class="mb-0 text-sm font-weight-bold">{{ auth()->user()->name }}</span>
29 - <br>
30 - <small>
31 - {{ucfirst(strtolower(@substr(\Auth::user()->roles[0]->name,1)))}}
32 - </small>
28 + <p class="mb--1 text-sm font-weight-bold">{{ auth()->user()->name }}</p>
29 + <small>{{ucfirst(strtolower(\Auth::user()->roles[0]->title))}}</small>
33 30 </div>
34 31 </div>
35 32 </a>
... ...
resources/views/layouts/navbars/sidebar.blade.php
... ... @@ -6,13 +6,7 @@
6 6 </button>
7 7 <!-- Brand -->
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 17/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 18/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
resources/views/tests/index.blade.php
1 - @extends('layouts.app', ['title' => 'Realizar Prueba'])
2 - @section('title')
3 - OBSERVADOR DEL POTENCIAL DE APRENDIZAJE
4 - @endsection
1 + @extends('layouts.app', ['title' => 'Observador del Potencial de Aprendizaje'])
5 2 @section('content')
6 - <div class="container px-4">
3 + <div class="container px-5 py-3">
7 4
8 5 <h3>NIÑAS Y NIÑOS DE 4 A 7 AÑOS</h3>
9 6 <p>Estimado/a docente:</p>
... ...
resources/views/tests/result.blade.php
resources/views/tests/show.blade.php
1 - @extends('layouts.app', ['title' => 'Realizar Prueba'])
2 - @section('title')
3 - <b>EL INTERÉS</b> - OBSERVADOR DEL POTENCIAL DE APRENDIZAJE
4 - @endsection
1 + @extends('layouts.app', ['title' => 'El Interés - Observador del Potencial de Aprendizaje'])
5 2 @section('content')
6 3 <div class="container mb-5">
7 4 <div class="card mb-3">
... ...
routes/web.php
... ... @@ -19,9 +19,6 @@ Route::get('/', function () {
19 19
20 20 Auth::routes();
21 21
22 - Route::get('/home', 'HomeController@index')->name('home');
23 - Auth::routes();
24 -
25 22 Route::get('/home', 'HomeController@index')->name('home');
26 23
27 24 Route::group(['middleware' => 'auth'], function () {
... ... @@ -31,16 +28,29 @@ Route::group(['middleware' => 'auth'], function () {
31 28 Route::put('profile/password', ['as' => 'profile.password', 'uses' =>
'ProfileController@password']);
32 29 });
33 30
34 - Route::get('tests', 'TestController@index')->name('tests.index');
35 - Route::get('tests/{test}', 'TestController@show')->name('tests.show');
36 - Route::post('tests', 'TestController@result')->name('tests.result');
31 + Route::group([
32 + 'prefix' => 'tests',
33 + 'as' => 'tests.',
34 + 'middleware' => ['can:'.ability('DO_TESTS')],
35 + ], function() {
36 + Route::get('', 'TestController@index')->name('index');
37 + Route::get('{test}', 'TestController@show')->name('show');
38 + Route::post('', 'TestController@result')->name('result');
39 + });
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 19/20
1/8/2020 Termina administrar roles y permisos y requerimientos de Autorizacion y Autenticacion (e40c183c) · Commits · Guillermo Agudelo / apptalento · GitLab
37 40
38 41 Route::group([
39 42 'prefix' => 'admin',
40 43 'as' => 'admin.',
41 - 'namespace' => 'Admin'
44 + 'namespace' => 'Admin',
42 45 ], function() {
43 - Route::resource('institutions', 'InstitutionController');
44 - Route::resource('roles', 'RoleController')->except(['create', 'edit']);
45 - Route::resource('abilities', 'AbilityController')->only(['store', 'update', 'destroy']); //TODO:
Terminar esto
46 + Route::resource('institutions', 'InstitutionController')
47 + ->middleware(['can:'.ability('MANAGE_INSTITUTIONS')]);
48 +
49 + Route::post('roles/{role}/sync-abilities', 'RoleController@syncAbilities')
50 + ->name('roles.sync-abilities')
51 + ->middleware(['can:'.ability('MANAGE_ROLES')]);
52 +
53 + Route::resource('roles', 'RoleController')
54 + ->except(['create', 'edit'])
55 + ->middleware(['can:'.ability('MANAGE_ROLES')]);
46 56 });
https://gitlab.com/guille.agudelo/apptalento/-/commit/e40c183cc98e8368765ce70bb4b6668f28f4ae54 20/20