portapipe / Login-GroceryCrud

A Login/Logout system for GroceryCrud (codeigniter).
32 stars 26 forks source link

joining users in groups #5

Closed ghost closed 7 years ago

ghost commented 7 years ago

Congrats for this fine piece of software !

I'm developing and application using Grocery_Crud. Users are a must, and this code is great. We will have quite a lot of users, and they have to be putted together into groups. Besides, the members of a group don't have to do exactly the same. There are a few roles. For example a member of a group could add, modify al delete any record of the group (reviewer). Other members (authors) just add and modify their own records.

I have in mind two possible ways.

a) quick way.

Not use the Table Permission Management for your users (https://github.com/portapipe/Login-GroceryCrud/wiki/Table-Permission-Management-(GRID))

In the user the permissions field of to store a pair group , rol In this scenario the login_model.php need two new functions getGroup and getRol

As there is json encode and I have no idea. How those two functions have to be?

b) nice and complicated way.

Add in the crud_users table a new field called idgroup (for example) Add a new table called (for example) crud_group which contains (idgroup, groupname) With another set-relation is possible to link a user with a group In this scenario, the Table Permission Management is perfect because, indeed, it defines roles. So the user, the group and the role are linked. Again, the login_model.php need a few new functions for the group.

Thanks.

      Miquel.
portapipe commented 7 years ago

Thanks =D

c) Add a 'groupID' field in the crud_users db table and manage it from the users page (based on the crud_users of course), retrieving the value with the getField($field) function.

With GC you can manage which data to show and you can add a $crud->where() row that will show the data to the user based on his group (you can choose to not check the "onlyID" option for the reviewer group but check for the 'group' field instead.

The getField() function was made for this particular needs.

ghost commented 7 years ago

Perfect !! Thanks a lot.

portapipe commented 7 years ago

Glad this will help you with your project 😉