Skip to content
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

Logged file #172

Open
wants to merge 5 commits into
base: 1.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function getAllTypes()
public static function addNewType($description)
{
// firing event for permission handling
Event::fire('customprofile.creating');
Event::dispatch('customprofile.creating');
$profile_field_type = ProfileFieldType::create(["description" => $description]);

return $profile_field_type;
Expand All @@ -37,7 +37,7 @@ public static function addNewType($description)
public static function deleteType($id)
{
// firing event for permission handling
Event::fire('customprofile.deleting');
Event::dispatch('customprofile.deleting');
$success = ProfileFieldType::findOrFail($id)->delete();

return $success;
Expand Down
8 changes: 4 additions & 4 deletions app/Authentication/Classes/SentryAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function check()
*/
public function authenticate(array $credentials, $remember = false)
{
Event::fire('service.authenticating', [$credentials, $remember]);
Event::dispatch('service.authenticating', [$credentials, $remember]);

try
{
Expand Down Expand Up @@ -70,7 +70,7 @@ public function authenticate(array $credentials, $remember = false)

if(!$this->errors->isEmpty()) throw new AuthenticationErrorException;

Event::fire('service.authenticated', [$credentials, $remember, $user]);
Event::dispatch('service.authenticated', [$credentials, $remember, $user]);
}

/**
Expand Down Expand Up @@ -115,9 +115,9 @@ public function loginById($id, $remember = false)
*/
public function logout()
{
Event::fire('service.delogging');
Event::dispatch('service.delogging');
$this->sentry->logout();
Event::fire('service.delogged');
Event::dispatch('service.delogged');
}

/**
Expand Down
5 changes: 5 additions & 0 deletions app/Authentication/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ public function fire()

$this->info('## Laravel Authentication ACL Installed successfully ##');
}

public function handle()
{
$this->fire();
}
}
4 changes: 2 additions & 2 deletions app/Authentication/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function postClientLogin(Request $request)

/**
* Logout utente
*
*
* @return string
*/
public function getLogout()
Expand Down Expand Up @@ -154,4 +154,4 @@ private function getLoginInput(Request $request)

return array($email, $password, $remember);
}
}
}
4 changes: 2 additions & 2 deletions app/Authentication/Repository/SentryGroupRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function create(array $data)
public function update($id, array $data)
{
$obj = $this->find($id);
Event::fire('repository.updating', [$obj]);
Event::dispatch('repository.updating', [$obj]);
$obj->update($data);
return $obj;
}
Expand All @@ -61,7 +61,7 @@ public function update($id, array $data)
public function delete($id)
{
$obj = $this->find($id);
Event::fire('repository.deleting', [$obj]);
Event::dispatch('repository.deleting', [$obj]);
return $obj->delete();
}

Expand Down
2 changes: 1 addition & 1 deletion app/Authentication/Repository/SentryUserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function update($id, array $data)
{
$this->ClearEmptyPassword($data);
$obj = $this->find($id);
Event::fire('repository.updating', [$obj]);
Event::dispatch('repository.updating', [$obj]);
$obj->update($data);
return $obj;
}
Expand Down
6 changes: 3 additions & 3 deletions app/Authentication/Services/UserRegisterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ public function __construct(UserSignupValidator $v = null)
*/
public function register(array $input)
{
Event::fire('service.registering', [$input]);
Event::dispatch('service.registering', [$input]);
$this->validateInput($input);

$input['activated'] = $this->getDefaultActivatedState();
$user = $this->saveDbData($input);

$this->sendRegistrationMailToClient($input);

Event::fire('service.registered', [$input, $user]);
Event::dispatch('service.registered', [$input, $user]);

return $user;
}
Expand Down Expand Up @@ -173,7 +173,7 @@ public function checkUserActivationCode($email, $token)
}

$this->user_repository->activate($email);
Event::fire('service.activated', $user);
Event::dispatch('service.activated', $user);
}

public function getErrors()
Expand Down
19 changes: 19 additions & 0 deletions app/Http/Middleware/Logged.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php namespace LaravelAcl\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\App;

/*
* Check that the current user is logged and active and redirect to client login or
* to custom url if given
*/
class Logged {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you elaborate why this is needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be it is not required here, but for my system to work this file is required. So, in case some needs this.


public function handle($request, Closure $next, $custom_url = null)
{
$redirect_url = $custom_url ?: '/login';
if(!App::make('authenticator')->check()) return redirect($redirect_url);

return $next($request);
}
}
10 changes: 5 additions & 5 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
]);
Route::post('/login', [
"uses" => 'LaravelAcl\Authentication\Controllers\AuthController@postClientLogin',
"as" => "user.login"
"as" => "user.login.post"
]);

/**
Expand Down Expand Up @@ -124,7 +124,7 @@
'uses' => 'LaravelAcl\Authentication\Controllers\UserController@editUser'
]);
Route::post('/admin/users/edit', [
'as' => 'users.edit',
'as' => 'users.edit.post',
'uses' => 'LaravelAcl\Authentication\Controllers\UserController@postEditUser'
]);
Route::get('/admin/users/delete', [
Expand All @@ -148,7 +148,7 @@
'uses' => 'LaravelAcl\Authentication\Controllers\UserController@editProfile'
]);
Route::post('/admin/users/profile/edit', [
'as' => 'users.profile.edit',
'as' => 'users.profile.edit.post',
'uses' => 'LaravelAcl\Authentication\Controllers\UserController@postEditProfile'
]);
Route::post('/admin/users/profile/addField', [
Expand Down Expand Up @@ -180,7 +180,7 @@
'uses' => 'LaravelAcl\Authentication\Controllers\GroupController@editGroup'
]);
Route::post('/admin/groups/edit', [
'as' => 'groups.edit',
'as' => 'groups.edit.post',
'uses' => 'LaravelAcl\Authentication\Controllers\GroupController@postEditGroup'
]);
Route::get('/admin/groups/delete', [
Expand All @@ -204,7 +204,7 @@
'uses' => 'LaravelAcl\Authentication\Controllers\PermissionController@editPermission'
]);
Route::post('/admin/permissions/edit', [
'as' => 'permission.edit',
'as' => 'permission.edit.post',
'uses' => 'LaravelAcl\Authentication\Controllers\PermissionController@postEditPermission'
]);
Route::get('/admin/permissions/delete', [
Expand Down
3 changes: 2 additions & 1 deletion app/Library/Form/FormModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use LaravelAcl\Library\Exceptions\NotFoundException;
use LaravelAcl\Authentication\Exceptions\PermissionException;
use Event;
use LaravelAcl\Library\Form\FormInterface as FormInterface;

class FormModel implements FormInterface{

Expand Down Expand Up @@ -52,7 +53,7 @@ public function process(array $input)
{
if($this->v->validate($input))
{
Event::fire("form.processing", array($input));
Event::dispatch("form.processing", array($input));
return $this->callRepository($input);
}
else
Expand Down
4 changes: 2 additions & 2 deletions app/Library/Repository/EloquentBaseRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function create(array $data)
public function update($id, array $data)
{
$obj = $this->find($id);
Event::fire('repository.updating', [$obj]);
Event::dispatch('repository.updating', [$obj]);
$obj->update($data);
return $obj;
}
Expand All @@ -57,7 +57,7 @@ public function update($id, array $data)
public function delete($id)
{
$obj = $this->find($id);
Event::fire('repository.deleting', [$obj]);
Event::dispatch('repository.deleting', [$obj]);
return $obj->delete();
}

Expand Down
2 changes: 1 addition & 1 deletion app/Library/Validators/AbstractValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abstract class AbstractValidator implements ValidatorInterface

public function validate($input)
{
Event::fire('validating', [$input]);
Event::dispatch('validating', [$input]);
static::$messages = static::$messages ? static::$messages : [];
$validator = V::make($input, static::$rules, static::$messages);

Expand Down
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.4.*",
"laravelcollective/html" : "5.4.*",
"laravel/framework": ">=8.0.0",
"laravelcollective/html": ">=5.5.0",
"intervention/image": "2.*",
"jacopo/authentication-sentry": "3.0.7",
"jacopo/authentication-sentry": "4.0.0",
"gregwar/captcha": "1.1.1"
},
"require-dev": {
Expand Down Expand Up @@ -61,5 +61,11 @@
"minimum-stability": "dev",
"config": {
"preferred-install": "dist"
}
},
"repositories":[
{
"type": "vcs",
"url": "https://github.com/newsbytesapp/sentry"
}
]
}
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
laravel-authentication-acl
==========================

[![Build Status](https://travis-ci.org/intrip/laravel-authentication-acl.svg?branch=1.3)](https://travis-ci.org/intrip/laravel-authentication-acl)
[![Build Status](https://travis-ci.org/intrip/laravel-authentication-acl.svg?branch=1.5)](https://travis-ci.org/intrip/laravel-authentication-acl)
[![Total Downloads](https://poser.pugx.org/jacopo/laravel-authentication-acl/d/total.svg)](https://packagist.org/packages/jacopo/laravel-authentication-acl)

# We are looking for someone to take ownership of this project. Sadly I don't have enough time to maintain it anymore, please get in touch /w me if you are interested.

## This is the Laravel 5.4 Version, for Laravel 5.3 use the version 1.3.*, for Laravel 5.2 use the version 1.3.15, for Laravel 5.1/5.0 use the version 1.3.11, for Laravel4 version use the 1.2 branch
## This is the Laravel 8.0 Version, for Laravel 5.5 use the version 1.5.*, for Laravel 5.4 use the version 1.4.*, for Laravel 5.3 use the version 1.3.*, for Laravel 5.2 use the version 1.3.15, for Laravel 5.1/5.0 use the version 1.3.11, for Laravel4 version use the 1.2 branch
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this changes allow using the package with laravel 8?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I have upgraded my system from Laravel 5 to Laravel 8 and so made changes accordingly to work with Laravel 8.0


Laravel Authentication ACL is a Laravel 5 package, based on <a href="https://github.com/cartalyst/sentry" target="_blank">sentry2</a>. <br/>
Laravel Authentication ACL is a Laravel 5+ package, based on <a href="https://github.com/cartalyst/sentry" target="_blank">sentry2</a>. <br/>
This package is made with the purpose of helping other developers to set-up
a fully featured admin panel with an ACL using Laravel framework.

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/EloquentPermissionRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function ifAssociatedToUserThrowsException()
public function validateThatPermissionIsNotAssociatedToAnyGroupAndAnyUser_OnRepositoryUpdate()
{
$false_stub = new FalseGetterStub;
Event::fire('repository.updating', [$false_stub]);
Event::dispatch('repository.updating', [$false_stub]);
}

/**
Expand All @@ -86,7 +86,7 @@ public function validateThatPermissionIsNotAssociatedToAnyGroupAndAnyUser_OnRepo
public function validateThatPermissionIsNotAssociatedToAnyGroupAndAnyUser_OnRepositoryDelete()
{
$false_stub = new FalseGetterStub;
Event::fire('repository.deleting', [$false_stub]);
Event::dispatch('repository.deleting', [$false_stub]);
}

protected function getModelGroupStub()
Expand Down