Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the efficient way to make a permission system?

Currently I'm just using something like this in the DB Table:

access: home,register,login

And then in each page:

if(!Functions::has_rights('content'))
{
     Functions::noAccess();
}

is there more efficient way to do it with php & MySQL? I may want to gain access even to several parts a page, for example, user can read a page, but doesn't comments to it, and I don't want to build a separate system to each module.

like image 434
WEBProject Avatar asked Jun 12 '10 07:06

WEBProject


People also ask

What is permission system?

Definitions of promotion system. a system for advancing participants to higher-status positions. type of: system. a procedure or process for obtaining an objective.

What are the types of permissions?

Android categorizes permissions into different types, including install-time permissions, runtime permissions, and special permissions.


1 Answers

I believe what you are looking for is Access Control List where you model your problem into two things: objects and roles.

Incomplete list of examples one may use, or be inspired from if writing a custom one from scratch:

  • Zend provides Zend_Acl
  • Symphony 3.x has ACL, for Symphony 4.x you can use ACL Bundle and the Voters.
  • The CakePHP has an ACL plugin
like image 182
bakkal Avatar answered Oct 09 '22 12:10

bakkal