Answer the question
In order to leave comments, you need to log in
How to implement authorization with group access rights?
Hello.
How to implement authorization of users with access rights?
For example: there are certain groups of users, each group can view all the data, but only the group that is allowed to view it in detail, download attached files and perform any actions can.
How can this be done using php and mysql databases? Or at least tell me similar scripts or solutions.
Thank you.
Answer the question
In order to leave comments, you need to log in
I would create a table like `group_access` with two columns:
In `group_access`.`group` - store the group name, or identifier.
Well, in `group_access`.`key` - the key.
Well, for example:
<?php
$group = 'Группа администраторов';
$req = mysql_query("SELECT * FROM `group_access` WHERE `group`='$group' AND `key`='create_topic'");
if (mysql_num_rows($req)) echo 'Вы можете создать тему!
else echo 'У вас нету прав создать тему!';
?>
I think this description fits the usual wiki. In particular, look at MediaWiki , it is written in php.
Have you worked with frameworks? Check out the CodeIgniter wiki for a great example!
As an example, look at the extension for yii - rights. It has the same functionality as described.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question