Welcome Guest, Not a member yet? Register   Sign In
How to root permissions effectively? (CI 3.11)
#1

Hello,

for the sake of practice to get better and better I plan a login script.

I want to share my idea and need some feedback.


tables:
user
-id (primary)
-name
-email
-role_id (Foreignkey)
-some_user_infos
-...

roles
-id (primary)
-allow_blog_entries_write
-allow_blog_entries_edit
-allow_some_property
-...

Okay, the database structure is clear.

My plan is to create first following classes:

class CommonController extends CI_Controller
-for some basic methodsĀ 

class UserController extends CommonController
-for methods like change_some_profile_setting()

class ModController extends UserController
-for methods like edit_entry($id, $table, ...)

class AdminController extends ModController
-for methods like delete_post($id, $table, ...)

This should give an small overview.

Lets assume I create a controller for a page called "blog"

controller Blog extends (WHICH_ONE_SHOULD_I_CHOOSE)
-method article($slug) //show article with $slug


If something like this is possible, how can I manage this?
What is a typical approach to do something like this?

What about this way?

class My_Controller extends CI_Controller

class Blog extends My_Controller

in construct() do something like:

check permission of user and load a library, where the methods of the library are edit, delete, what ever.

Or should I walk another way?

Thanks for helping.
Reply


Messages In This Thread
How to root permissions effectively? (CI 3.11) - by hobbyci - 01-08-2021, 08:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB