D
D
Denis Prikhodko2014-01-15 14:06:54
PHP
Denis Prikhodko, 2014-01-15 14:06:54

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

6 answer(s)
A
Alexander Kuzmin, 2014-01-15
@Windler

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 'У вас нету прав создать тему!';
?>

C
Chromium58, 2014-01-15
@Chromium58

I think this description fits the usual wiki. In particular, look at MediaWiki , it is written in php.

C
Codebaker, 2014-01-15
@Codebaker

Have you worked with frameworks? Check out the CodeIgniter wiki for a great example!

T
TekVanDo, 2014-01-15
@TekVanDo

As an example, look at the extension for yii - rights. It has the same functionality as described.

R
Reistlin, 2014-01-15
@iznaur

see how it's done in Kohana Framework

S
spelych, 2015-07-14
@spelych

Mutyda.com solves this problem perfectly after small localizations

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question