The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
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"?> <navgroups product="myhack"> <navgroup phrase="myhack_settings" hr="true" permissions="canadminmyhack"> <navoption> <phrase>demohack_foo</phrase> <link>demohack.php?do=foo</link> </navoption> <navoption> <phrase>demohack_modcp</phrase> <link>../{$vbulletin->config[Misc][modcpdir]}/foobar.php</link> </navoption> </navgroup> </navgroups> Code:
Varname: can_administer_myhack Text: 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 |
#12
|
||||
|
||||
thanks, glad to hear that, I'll try it
|
#13
|
|||
|
|||
Hi Kirby, just 1 quick question if I may.
Quote:
Thanks, Alan. |
#14
|
|||
|
|||
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:
|
#15
|
|||
|
|||
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? |
#16
|
|||
|
|||
Quote:
|
#17
|
||||
|
||||
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. |
#18
|
||||
|
||||
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. |
#19
|
||||
|
||||
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 |
#20
|
||||
|
||||
Well ... as of vBulletin 3.5.4 $admin is there by default
The following code might work cross-version? PHP Code:
|
#21
|
||||
|
||||
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 |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|