GithubHelp home page GithubHelp logo

Comments (9)

rappasoft avatar rappasoft commented on May 3, 2024

This is fixed in the upcoming 5.1 release. But you can fix it by going to EloquentRoleRepository.php to the update method and replacing it with this:

public function update($id, $input, $permissions) {
        $role = $this->findOrThrowException($id);

        //Validate
        if (strlen($input['name']) == 0)
            throw new GeneralException('You must specify the role name.');

        //See if the role must contain a permission as per config
        if (config('access.roles.role_must_contain_permission') && count($permissions['role_permissions']) == 0)
            throw new GeneralException('You must select at least one permission for this role.');

        $role->name = $input['name'];

        if ($role->save()) {
            //Remove all permissions
            $role->detachPermissions($role->permissions);

            //Attach permissions, if any
            if (count($permissions['role_permissions']) > 0)
                $role->attachPermissions($permissions['role_permissions']);

            return true;
        }

        throw new GeneralException('There was a problem updating this role. Please try again.');
    }

from laravel-boilerplate.

rappasoft avatar rappasoft commented on May 3, 2024

Delete that role and clear the permissions from it in the database as well to make sure its working properly.

from laravel-boilerplate.

hawkefly avatar hawkefly commented on May 3, 2024

Yes , it works perfect now, thank you.

from laravel-boilerplate.

rappasoft avatar rappasoft commented on May 3, 2024

No problem sorry meant to make a hotfix but was in the middle of the 5.1 conversion and didn't want to lose track of where I was.

from laravel-boilerplate.

rappasoft avatar rappasoft commented on May 3, 2024

Weird, it could be something to do with the way firefox handles sessions.

from laravel-boilerplate.

rappasoft avatar rappasoft commented on May 3, 2024

Though Laravel has been known to have Token exceptions on rapid refresh, just like on multiple AJAX calls at the same time. I don't know if there is a solution. But why are you refreshing several times on the dashboard?

from laravel-boilerplate.

dhb52 avatar dhb52 commented on May 3, 2024

Another fatal problem to me, it seems with Firefox form submit fails more often than never.

from laravel-boilerplate.

dhb52 avatar dhb52 commented on May 3, 2024

I removed 'App\Http\Middleware\VerifyCsrfToken' middleware, it still broken.
Sorry for the OT above.

Why not use Role::savePermissions for patch of this issue?

from laravel-boilerplate.

rappasoft avatar rappasoft commented on May 3, 2024

Good question, that's a better solution. Good call, i'll commit it.

from laravel-boilerplate.

Related Issues (20)

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.