GithubHelp home page GithubHelp logo

oc-backendusertree's Introduction

Backend User Tree

Adds SimpleTree trait functionality to backend users (administrators) thought a Proxy model.

Why?

You will be able, for example, to create levels of administrators like Chief Editors and Editors to your RainLab.Blog where Chief Editors can create Editors and see their posts as their childrens posts, but without seeing their siblings posts or siblings Editors posts.

This can be used for whatever Model you want. Just applying the following code to listExtendQueryBefore hook:

$query->whereIn('user_id', $this->user->getAllChildrenIdList());

Where user_id is the foreign key on the model to represent the user who created it. This can be archived using beforeSave hook, adding the current logged in user to the model:

$model->user = BackendAuth::getUser();
// or
$model->user = $this->user;

Don't forget to add user to belongsTo property equals to Backend\Models\User in the models that needs ownership. It's a basic Eloquent relation.

Permissions

Users will be able to define permissions to their children based on their own permissions.

oc-backendusertree's People

Contributors

leocavalcante avatar wilirius avatar vinicius-romero avatar

Stargazers

Johnny avatar  avatar Bayram Ali avatar Bhargav avatar  avatar

Watchers

James Cloos avatar Bayram Ali avatar  avatar

oc-backendusertree's Issues

error on clean install

Trying to get property of non-object
/home/vagrant/projects/hostpedia/plugins/leocavalcante/backendusertree/behaviors/User.php line 21

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.