Custom Administrator Permissions
Your Hack has an Admin Backend?
Then you should consider protecting it with custom Admin Permissions - not every Admin has to be able to control everything. First of all, you have to decide on a uniqe Key for your Admin Permission, just like your Product ID. In this example I will use canadminmyhack. Go to your ACP File(s) and place the following Code below the Back-End requirement: PHP Code:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?> Code:
Varname: can_administer_myhack As the Permissions Editor only takes care of standard Permissions, you must create 4 Plugins: admin_permissions_form PHP Code:
You must also create a Plugin for the Administrator Datamanager admindata_start PHP Code:
admin_permissions_process PHP Code:
can_administer PHP Code:
As you can see, I used customadminperms as the Bitfield. This is the Bitfield I will use for my Hacks, Bit 1 is already in use. If others want to use it too (to avoid having to create there own (Bit)fields) - feel free to do so. But please, first post here and state which Bit you are going to use and wait for an Okay so there won't be conflicts. To use it, create an appropriate Bitfield XML File. The following Install Code should be used then: PHP Code:
PHP Code:
1 - KirbyDE |
Wow. Thanks man!
I may try doing this when I have a few hours. :P |
Thanks Kirby !
now do you know how to add permissions for customs categories ? Like, in vb3.0 I use PHP Code:
thanks for any help. |
Thanks Kirby, this will be very handy.
|
@deathemperor
I don't know what you are talking about; $_CATEGORYOPTIONS does not seem to exist in any standard vBulletin 3.0 file. |
Quote:
I'm thinking if a bitfield_something.xml file would do the trick. |
PHP Code:
PHP Code:
Also, can you please explain what you mean by "Bitfield Usage customadminperms (this will be updated if other Authors use it too)"? TIA :) |
Yep, the ; is missing.
Well "Bitfield Usage customadminperms" just describes how this Bitfield is used, eg. what the Bits stand for :) |
so Kirby, is there any solution for my question ?
|
Yes, Bitfield XMLs are the way to go.
|
thanks, glad to hear that, I'll try it
|
Hi Kirby, just 1 quick question if I may.
Quote:
Thanks, Alan. |
Therer was an apparent restructuring of the file class_dbalter.php changing the class and functions used in Kirby's uninstall example.
fetch_table_info has now changed to fetchTableInfo and drop_field has changed to dropField and lastly table_field_data has changed to fetchFieldInfo. new coding PHP Code:
|
I did everything the tutorial said and I can see the radio button in the admin permissions but when I click "yes" and save it, it goes back to "no".
Do I change customadminperms? |
Quote:
|
This thing doesn't actually work. (3.5.3)
After the first check of permissions, the static $adminpermissions; takes over, to which the custom permissions are not added. Therefore an alternative solution is required. I will look deeper into it tomorrow. |
You're right. Must have missed that issue as I only had one custom navgroup - and it was the first one.
I tweaked the code a bit to get around this. |
Allow me to point out two facts:
EDIT: This randomly doesn't seem to work for OLD administrators, and only in the ACP menu. In my custom menu it works fine, it just doesn't work in the cpnav_ menu. EDIT #2: I fixed it now. Made it so it doesn't query unless for some reason it didn't fetch the permissions properly. Also I replaced the * in the query for a slight load decrease =P |
Well ... as of vBulletin 3.5.4 $admin is there by default :)
The following code might work cross-version? PHP Code:
|
It might, but due to the fact that I don't actually use the $admin variable, I don't know if I need to change the code.
I don't really see how changing the variable name would help in solving the original problem, though. I just tested the new plugin with some slight alterations and it works. I cba to "remake" it into your "customadminperms" format so Ill just give it like I use it: PHP Code:
I think that's a pretty efficient way of doing it, as it only runs 1 additional query for ONE admin (out of the ~10 I tested it on, non-superadmins that is). So yeah, tis odd, but meh =P |
Yeah, that should work without causing any additional queries in 3.5.4 as $admin contains the full row.
|
Edit: didnt see your edit :p
|
So, that means? :)
|
That means its all good, lol.
Not only will that not cause any extra queries on 3.5.4 in general, it will only cause one extra query for the rare occurrence where for some reason it won't work without re-querying :) Thanks for going through this with me and for releasing 3.5.4 4h after I had spent ages testing the old code you see in a few posts back (*kicks*) ;) //peace |
Nice!
You look like you know your stuff :p would you be able to make a guide on [How-To] create custom admin or mod type of usergroups so that we can like make a seperate moderator usergroup that is used for the moderators that are only moderators by forums, and not by usergroup.. and so on? |
Hi, does anyone know how you can have better control over the AdminCP functions for users that are co-admins? For example I want to disable them from the User Ranks area but there is no option for this in Adminstrator Permissions table.
|
how can i make a new bitfield xml file?
|
Install and Uninstall for the product code?
|
I'm sorry but I don't understand this:
Quote:
Nevermind, I'll just wait around for a guide made for a newbie. |
can_administer I can't seem to find in my hooks for vB 3.5.4! What header is it under?
|
It is at the bottom of "vBulletin : General Administration"
Thanks, Alan. |
I'm getting frustrated because I can't get it to work.
This is for vBulletin 3.6.0 RC 3 Install Code PHP Code:
PHP Code:
admindata_start PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
I have this in my custom XML file - the canadminnetwork option works fine, however the canadminrankings part (using your code) returns a value of 2 when Yes, or 0 when No.
Code:
<bitfielddefs> |
Quote:
|
Yes, but how do I put that into a print_yes_no_row for use in adminpermissions.php
|
I have no idea. I need help with it as well.
|
This is somewhat unrelated, but where can I get info on how to give my plugin an admincp back-end? I'm working on a small plugin for my forum and this would be very useful.
|
Hello, Andreas, I've a problem: The permissions are not stored. When I click save and return to the Permission Overview, The Right i snot saved. (No is ever selected)
I dont know, where the problem is. Thanks for Help !!! Surviver Because of my bed English: http://surviver.bokuv.de/ablage/admi...dminperms.html :D //All ok, thanx Andreas :) |
Same problem here.
First, Does this works with 3.6.0? If so what are the right steps to make it work. Second, Any particular reason why doesnt save the permissions? it just don't do it, I have try in so many ways, but it appears vbulletin for some reason doesnt store the changes. I am using vbulletin 3.6.0+ Also could you make this hack works with more than one custom permissions? Thanks on advance. |
Quote:
Example: Code:
<?xml version="1.0" encoding="ISO-8859-1"?> |
All times are GMT. The time now is 01:09 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|