Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Custom Administrator Permissions
Andreas
Join Date: Jan 2004
Posts: 6,860

I am still alive ... unfortunately.

Germany
by Andreas Andreas is offline 09 Sep 2005

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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

In your ACP Navigation XML Files, add the Parameter permissions to your Navgroup:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

In order to display Text in the Admin Permissions Editor, you must create a Phrase in Phrasegroup Permissions:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Make sure that it is attached to your Product and inserted into GLOBAL Language!

As the Permissions Editor only takes care of standard Permissions, you must create 4 Plugins:

admin_permissions_form

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

customadminperms[canadminmyhack] must the Name of the Bit(field) you want to use, $vbulletin->bf_misc_customadminperms['canadminmyhack'] the Value of the Bit

You must also create a Plugin for the Administrator Datamanager
admindata_start

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now we need a Plugin to save our Permission setting after editing it:

admin_permissions_process

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now, finally, we need a Plugin to actually check this Permission

can_administer

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Here again, $vbulletin->bf_misc_customadminperms['canadminmyhack'] must be the Value of your Bit.

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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And this Uninstall-Code

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Bitfield Usage customadminperms (this will be updated if other Authors use it too)
1 - KirbyDE

Last edited by Andreas; 02 Mar 2008 at 12:59.. Reason: Example Code cleanup (assuming nobody is interested in vBulletin 3.5.0 code anymore ;))
Views: 25084
Reply With Quote
Comments
  #2  
Old 10 Sep 2005, 23:55
fly fly is offline
 
Join Date: Oct 2003
Wow. Thanks man!

I may try doing this when I have a few hours. :P
Reply With Quote
  #3  
Old 12 Sep 2005, 09:30
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Real name: Lucius Hunk
Thanks Kirby !

now do you know how to add permissions for customs categories ?

Like, in vb3.0 I use


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

in vb3.5 what should I do to use $_CATEGORYOPTIONS['cancontainthreads'] in my code ?

thanks for any help.
Reply With Quote
  #4  
Old 18 Sep 2005, 07:03
Alan @ CIT Alan @ CIT is offline
 
Join Date: Nov 2004
Location: South UK
Real name: Alan
Thanks Kirby, this will be very handy.
__________________
IMPORTANT: I'm afraid that I no longer develop software / modifications for vBulletin. However, thank you to everyone who installed / supported my modifications!
Reply With Quote
  #5  
Old 18 Sep 2005, 09:41
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
@deathemperor
I don't know what you are talking about; $_CATEGORYOPTIONS does not seem to exist in any standard vBulletin 3.0 file.
Reply With Quote
  #6  
Old 19 Sep 2005, 17:58
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Real name: Lucius Hunk
Originally Posted by KirbyDE
I don't know what you are talking about; $_CATEGORYOPTIONS does not seem to exist in any standard vBulletin 3.0 file.
you're right, it's not vbulletin default. and I was asking for a custom permissions for custom categories system (like v3article or vbadvanced gallery).

I'm thinking if a bitfield_something.xml file would do the trick.
Reply With Quote
  #7  
Old 19 Sep 2005, 22:30
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Real name: Fillip

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Should perhaps be something more like

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

eh?
Also, can you please explain what you mean by "Bitfield Usage customadminperms (this will be updated if other Authors use it too)"?

TIA
Reply With Quote
  #8  
Old 20 Sep 2005, 00:18
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
Yep, the ; is missing.

Well "Bitfield Usage customadminperms" just describes how this Bitfield is used, eg. what the Bits stand for
Reply With Quote
  #9  
Old 22 Sep 2005, 03:48
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Real name: Lucius Hunk
so Kirby, is there any solution for my question ?
Reply With Quote
  #10  
Old 22 Sep 2005, 07:06
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
Yes, Bitfield XMLs are the way to go.
Reply With Quote
  #11  
Old 22 Sep 2005, 17:48
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Real name: Lucius Hunk
thanks, glad to hear that, I'll try it
Reply With Quote
  #12  
Old 23 Sep 2005, 02:52
Alan @ CIT Alan @ CIT is offline
 
Join Date: Nov 2004
Location: South UK
Real name: Alan
Hi Kirby, just 1 quick question if I may.

To use it, create an appropriate Bitfield XML File.
What is an "appropriate Bitfield XML file"? Do you have a template of what one should look like?

Thanks,
Alan.
__________________
IMPORTANT: I'm afraid that I no longer develop software / modifications for vBulletin. However, thank you to everyone who installed / supported my modifications!
Reply With Quote
  #13  
Old 03 Oct 2005, 19:18
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Real name: Bob
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

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Lastly TABLE_PREFIX is no longer needed...

Last edited by Dark_Wizard; 03 Oct 2005 at 19:21.
Reply With Quote
  #14  
Old 04 Jan 2006, 18:57
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Real name: Andrew Harmor
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?
Reply With Quote
  #15  
Old 09 Feb 2006, 23:22
Kurisu Kurisu is offline
 
Join Date: Aug 2002
Originally Posted by harmor19
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".
Yes, same problem for me...
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 02:04.

Layout Options | Width: Wide Color: