Code Monkey home page Code Monkey logo

roles's People

Contributors

bbashy avatar branchzero avatar greggilbert avatar interphased avatar kyslik avatar lucasmichot avatar lucidlemon avatar mul14 avatar niknetniko avatar paweldmochowskidrast avatar ricky-rick avatar romanbican avatar sniper7kills avatar tflori avatar unrulynatives avatar williamoliveira avatar yangwendaxia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

roles's Issues

Middleware VerifyPermission always returns true

Hello, I saw that the VerifyPermission is not working properly. Basically it's always returning true event if the user doesn't have the permission.
For example I have two types of roles, the one is admin who has permission on roles route and the client who doesn't have access to role route. Route:

Route::get('/users/roles', ['as' => 'admin.users.roles', 'middleware' => 'permission:edit.roles', 'uses' => 'UsersController@roles']);

If I access the route with the admin is working fine. If I access the route with client it supposed to throw an error but it doesn't, loads the page.

So I did dd($this->auth->user()->userPermissions); to see the permissions of the client and the permission:edit.roles wasn't in his list.

So I fix it like this

	/**
	 * Handle an incoming request.
	 *
	 * @param Request $request
	 * @param \Closure $next
	 * @param int|string $permission
	 * @return mixed
	 * @throws \Ultraware\Roles\Exceptions\PermissionDeniedException
	 */
	public function handle($request, Closure $next, $permission) {
		$permissionsList = $this->auth->user()->userPermissions->pluck('slug')->toArray();
		if ($this->auth->check() && in_array($permission, $permissionsList)) {
			return $next($request);
		}

		throw new PermissionDeniedException($permission);
	}

Laravel 5.6 Released

Any chance of an update?

Your requirements could not be resolved to an installable set of packages.

Problem 1
- ultraware/roles 5.5.0 requires laravel/framework 5.5.* -> satisfiable by laravel/framework[5.5.x-dev, v5.5.0, v5.5.1, v5.5.10, v5.5.11, v5.5.12, v5.5.13, v5.5.14, v5.5.15, v5.5.16, v5.5.17, v5.5.18, v5.5.19, v5.5.2, v5.5.20, v5.5.21, v5.5.22, v5.5.23, v5.5.24, v5.5.25, v5.5.26, v5.5.27, v5.5.28, v5.5.29, v5.5.3, v5.5.30, v5.5.31, v5.5.32, v5.5.33, v5.5.34, v5.5.4, v5.5.5, v5.5.6, v5.5.7, v5.5.8, v5.5.9] but these conflict with your requirements or minimum-stability.
- ultraware/roles 5.5.0 requires laravel/framework 5.5.* -> satisfiable by laravel/framework[5.5.x-dev, v5.5.0, v5.5.1, v5.5.10, v5.5.11, v5.5.12, v5.5.13, v5.5.14, v5.5.15, v5.5.16, v5.5.17, v5.5.18, v5.5.19, v5.5.2, v5.5.20, v5.5.21, v5.5.22, v5.5.23, v5.5.24, v5.5.25, v5.5.26, v5.5.27, v5.5.28, v5.5.29, v5.5.3, v5.5.30, v5.5.31, v5.5.32, v5.5.33, v5.5.34, v5.5.4, v5.5.5, v5.5.6, v5.5.7, v5.5.8, v5.5.9] but these conflict with your requirements or minimum-stability.
- Installation request for ultraware/roles ^5.5 -> satisfiable by ultraware/roles[5.5.0].

how to show different login pages?

for example, i need user levels:
1 -> user -> user login (default laravel)
2 -> seller -> seller login (new one for that)
3 -> owner -> web owner login page (another new one for this one too)

and i need all successful redirects to access that login, logout and ect.
lets say:

  • in my web is comming guest. he can just see information.
  • when comming user, he press login button and see Hello USER, please login (views/auth/login.user.blade.php) [url = domain.com/login].
  • when comming seller and press button seller login, he need to see Hello SELLER, please login (views/auth/login.seller.blade.php) [url = domain.com/seller].
  • when owner is comming - he just enter url (ex. domain.com/adminLTE) and see Welcome back, ADMIN, enter your details (views/auth/login.admin.blade.php) [url = domain.com/adminLTE].

thanks for help, 'cause i'm new in Laravel and don't understand.

edit:
i have created roles for that with slug and level, but just need different logins.
btw ->

  • owner can see all stuff of seller and user
  • seller can see user stuff
  • user can see just guest stuff + a little bit new features from guest (comment and ect)
    [here i understand - i need to use levels (i hope so)] ๐Ÿ‘ฏโ€โ™‚๏ธ

Allow more settings in Route middleware

For exemple, actually we can do :

'middleware' => [
    'permission:access.site'
]

But what about something like that :

'middleware' => [
    'permission:access.site,level:4,role:admin'
]

Convert this to :

IF the user has the permission access.site OR has the level >= 4 OR has the role admin
    The user is authorized
ELSE
    The user is not authorized

Of course that is just an exemple. But i think we can use that to do complexe permissions without being hard to understand and code.
We can also use the variadic syntax (PHP >= 5.6) to get the parameters ...$permission and it will return and array :

[
    "access.site"
    "level:4"
    "role:admin"
]

I have thinked about that when i needed to allow guest to access to a page but not certain logged in users releated to a group. (So i have made a custom middleware for that)

Show permissions

Hi, it is possible to add some permissions to a role, and then assign the role to the user.
However, is it possible to disable some of the permissions on the role only for one particular user?

It sounds like a really awesome package.

Is this package support auto-discovery in Laravel 5.5+

It is a powerful package for handling roles and permissions in Laravel 5. You really did a good job.
From the composer.json file, it seems that this package doesn't support auto-discovery in Laravel 5.5+, is there any plan to add this feature ?

Laravel 5.7?

New Laravel 5.7 was released. Any plans for a version bump? :)

Error on validate permission

I have a problem, and it is that in my case I do not use the slug, but of uuid and it is manual, I do not use a package, by which when validating it tells me that I do not have permission which is incorrect

$row->name = 'access-admin';
$row->uuid = '79091018328db1b20b89ce6c46ce16ac';

And in the validation tarot look for a defined slug

line 278 of HasRoleAndPermission

public function checkPermission($permission)
{
return $this->getPermissions()->contains(function ($value) use ($permission) {
return $permission == $value->id || Str::is($permission, $value->slug);
});
}
i change the $value->slug for $value->uuid

The problem is that when updating the package will change the "uuid" by the "slug",as it would in this particular case?

Laravel 5.5 Blade directives

I seem to have the Blade directives @ROLE() etc rendered as text in laravel 5.5 after switching from romanbicans last version.

I have checked the source files for both RolesServiceProvider's registerBladeExtensions function and they are near identical apart from the directory location.

I have migrated from a laravel 5.2 application to 5.5 and upgraded from romanbican's 2.1 version to ultraware's 5.5 version

Foreign Key problem

Schema::create('role_user', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->integer('role_id')->unsigned()->index();
            $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
            $table->integer('user_id')->unsigned()->index();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->timestamps();
  Schema::create('permission_role', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->integer('permission_id')->unsigned()->index();
            $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade');
            $table->integer('role_id')->unsigned()->index();
            $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
            $table->timestamps();
        });
Schema::create('permission_user', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->integer('permission_id')->unsigned()->index();
            $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade');
            $table->integer('user_id')->unsigned()->index();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->timestamps();
        });

  • problem
         @if (!empty($user->permissions))
              @foreach ($user->permissions as $key => $user_perm)
                <label class="label label-success">{{ $user_perm->name }}</label>
              @endforeach
            @endif

no output this

Laravel 5.4 released

i think we need an update ๐Ÿ˜„

ultraware/roles 5.3.0 requires illuminate/support 5.3.* -> satisfiable by laravel/framework[v5.3.28], illuminate/support[v5.3.0, v5.3.16, v5.3.23, v5.3.4].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.