Coder Social home page Coder Social logo

lv-permissions's People

Contributors

kduma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lv-permissions's Issues

[Insight] Commented code should not be commited - in PermissionsServiceProvider.php, line 47

in PermissionsServiceProvider.php, line 47

Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

        $this->app->singleton('permissions.adderhelper', function()
        {
            return new PermissionsAdderHelper();
        });
//
//      $this->commands('command.config.env');
    }

    /**
     * Get the services provided by the provider.
     *

Posted from SensioLabsInsight

[Insight] PHP code should follow PSR-1 basic coding standard - in Helpers/PermissionsAdderHelper.php, line 82

in Helpers/PermissionsAdderHelper.php, line 82

Method names should be declared in camelCase. You should rename this class to comply with PSR-1.

    /**
     * @param $roles
     * @param $permissions
     * @return array
     */
    protected function _getIDList($roles, $permissions)
    {
        $roles_id_list = [];
        if (is_array($roles)) {
            foreach ($roles as $role) {
                $roles_id_list[] = $this->_getIDListHelper($role, true);

Posted from SensioLabsInsight

Declaration method

Laravel: 5.2
Declaration of KDuma\Permissions\Permissions::can() should be compatible with Illuminate\Foundation\Auth\User::can($ability, $arguments = Array)

[Insight] Commented code should not be commited - in Helpers/PermissionsAdderHelper.php, line 28

in Helpers/PermissionsAdderHelper.php, line 28

Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    function createRole($str, $name){
        $role = Role::firstOrNew(['str_id' => $str]);
        $role->name = $name;
        $role->save();
        return $role;
//        $this->roles[$str] = $name;
    }

    function deleteRole($str){
        Role::where('str_id', $str)->delete();
        return true;

Posted from SensioLabsInsight

[Insight] Commented code should not be commited - in Models/Role.php, line 21

in Models/Role.php, line 21

Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

        return $this->belongsToMany(config('permissions.models.Permission'))->withTimestamps();
    }

//    public function members()
//    {
//        return $this->hasMany('\App\Member');
//    }
}

Posted from SensioLabsInsight

[Insight] Unused use statement should be avoided - in …/0000_00_00_000005_create_and_assign_roles_and_permissions.php, line 3

in Migrations/0000_00_00_000005_create_and_assign_roles_and_permissions.php, line 3

The class Illuminate\Database\Schema\Blueprint is declared but never used. You should remove the use statement.

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAndAssignRolesAndPermissions extends Migration {

    /**

Posted from SensioLabsInsight

[Insight] Unused use statement should be avoided - in …/0000_00_00_000006_create_administrator_account.php, line 4

in Migrations/0000_00_00_000006_create_administrator_account.php, line 4

The class Illuminate\Database\Schema\Blueprint is declared but never used. You should remove the use statement.

<?php

use App\User;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use KDuma\Permissions\Models\Role;

class CreateAdministratorAccount extends Migration {

Posted from SensioLabsInsight

[Insight] Commented code should not be commited - in Helpers/PermissionsAdderHelper.php, line 34

in Helpers/PermissionsAdderHelper.php, line 34

Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    }

    function deleteRole($str){
        Role::where('str_id', $str)->delete();
        return true;
//        unset($this->roles[$str]);
    }

    function createPermission($str, $name){
        $permission = Permission::firstOrNew(['str_id' => $str]);
        $permission->name = $name;

Posted from SensioLabsInsight

[Insight] Commented code should not be commited - in Helpers/PermissionsAdderHelper.php, line 43

in Helpers/PermissionsAdderHelper.php, line 43

Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

        $permission = Permission::firstOrNew(['str_id' => $str]);
        $permission->name = $name;
        $permission->save();
        return $permission;
//        $this->permissions[$str] = $name;
//        unset($this->permissions[$str]);
    }
    function deletePermission($str){
        Permission::where('str_id', $str)->delete();
        return true;
    }

Posted from SensioLabsInsight

[Insight] Boolean should be compared strictly - in Permissions.php, line 18

in Permissions.php, line 18

With booleans, only strict comparison (with === operator) should be used to lower bug risks and to improve performances.

    {
        return $this->belongsToMany(config('permissions.models.Role'))->withTimestamps();
    }

    protected function fetchPermissions(){
        if($this->permissions_fetched == false) {
            $cache_time = config('permissions.cache_time', 60);

            $user = $this;
            $getCallback = function() use ($user)
            {

Posted from SensioLabsInsight

[Insight] Commented code should not be commited - in Helpers/PermissionsAdderHelper.php, line 42

in Helpers/PermissionsAdderHelper.php, line 42

Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    function createPermission($str, $name){
        $permission = Permission::firstOrNew(['str_id' => $str]);
        $permission->name = $name;
        $permission->save();
        return $permission;
//        $this->permissions[$str] = $name;
//        unset($this->permissions[$str]);
    }
    function deletePermission($str){
        Permission::where('str_id', $str)->delete();
        return true;

Posted from SensioLabsInsight

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.