How to manage rights in a plugin
I want to assign certain rights in a plugin specified users. Such as eg. the edit, delete and add.
what is the best way to manage this?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- PHPDevShell Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- TitanKing
- Solved:
- 2011-11-02
- Last query:
- 2011-11-02
- Last reply:
- 2011-11-02
TitanKing (titan-phpdevshell) said : | #1 |
Hi Jahweh,
This is achieved by groups; You will have to create groups with certain rights... create 3 groups for instance, Edit, Delete, Add, now assign the users with permissions to either one, two or three all of the three groups.
From here it is now simple:
<?php
// IF false it will look up current logged in user.
$logged_in_user_id = false;
// The id of the edit group you create, 10 is just an example.
$edit_group_id = 10;
if ($this-
// Can edit code and add edit buttons etc...
}
?>
Adrian Liechti (jahweh) said : | #2 |
Ok, so far so good.
But how can predetermine the group that she is wearing exactly this ID?
example:
install the plugin ..
-> Install menu ..
-> Install groups (with the correct id's)??
...
|
#3 |
You cant in 3.0.4, in 3.0.5 (soon to be released) on the other hand it will allow you to call a group by alias meaning you give the group an alias and do this for instance...
// IF false it will look up current logged in user.
$logged_in_user_id = false;
// The id of the edit group you create, 10 is just an example.
$edit_group_id = null;
$edit_group_alias = 'edit';
if ($this-
// Can edit code and add edit buttons etc...
}
TitanKing (titan-phpdevshell) said : | #4 |
If you want to I can give you the code you need to change to allow this, if you are in a hurry.
Adrian Liechti (jahweh) said : | #5 |
ja genau das meinte ich.
ist schon gut so, ich kann auch auf das update warten.
danke dir
Adrian Liechti (jahweh) said : | #6 |
sorry, german^^ cant edit the answer =)
yes that's what I meant.
is already good, I can also wait for the update.
thank you
Adrian Liechti (jahweh) said : | #7 |
Thanks TitanKing, that solved my question.