Raised This Month: $51 Target: $400
 12% 

An other thing about access checking...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kulfaangaren!
Junior Member
Join Date: May 2004
Location: Stockholm, Sweden
Old 03-04-2005 , 13:17   An other thing about access checking...
Reply With Quote #1

BAH ! Ment to put this post in this (http://forums.alliedmods.net/showthread.php?t=37306) thread...

When reading this thread (http://forums.alliedmods.net/showthr...?t=37367#10781) I got this idea, it might be as crazy as my group based access system but I like it

Basically what I would like is for the access system to have not only the ability to check access against a static file or database but forward the access checking to a plugin or rather chain in a plugin to handle the checking.

I would like to be able to add the following to the configuration file:

Code:
LoadAccessPlugin AP1 "/my/plugin/dir/LoginHandling.sm"
ChainAccessPlugin SM_USER_LOGIN AP1
The fields of the LoadAccessPlugin would be...
  • 1. Tag (AP1) - Just a name to use when refering to the plugin.
    2. Plugin "binary" ("/my/plugin/dir/LoginHandling.sm") - Self explanatory ?
The fields of the ChainAccessPlugin would be...
  • 1. Access token (SM_USER_LOGIN) - The access token to forward access requests for.
    2. Tag (AP1) - Refering to the tag given to the function on the LoadAccessPlugin line.
The plugins access function would be required to follow three simple rules...
  • 1. The plugin must contain a function named handleAccess().
    2. The access function should take three parameters, steamid, ip and name...in that order
    3. The return values should be: Access granted (1), Access denied (-1), Unhandled (0).
The Unhandled (0) return value would allow us to (in this case) fall back to the default access checking and the 1 or -1 values would tell us to terminate and either grant or deny access.
The above would allow a server admin to easily write an access plugin to handle anything including the functionality requested in the thread mentioned at the top of this post but it doesn't stop there...
Imagine the following configuration...
Code:
LoadAccessPlugin IPBASED_AP "/mydir/ipBasedGenericAccessPlugin.sm"
LoadAccessPlugin CLANBASED_AP "/mydir/clanBasedGenericAccessPlugin.sm"
LoadAccessPlugin GEOIPBASED_AP "/mydir/geoIPBasedPlugin.sm"

ChainAccessPlugin SM_USER_LOGIN IPBASED_AP
ChainAccessPlugin SM_USER_LOGIN CLANBASED_AP
ChainAccessPlugin SM_USER_LOGIN GEOIPBASED_AP

ChainAccessPlugin KULF_GREET_CLAN CLANBASED_AP
As you can see from the crazyness above it would allow us to write generic handler plugins that could be reused with different access tokens and combined to allow more complex access rules.

The above config would check if a user is allowed to log in...first based on his/her/its IP and then if the IP handler returned Unhandled (0) it would also check through the clan based access plugin and if it is still unhandled through the GeoIP access module and if it is still unhandled then against the default. The clanbased access plugin would also be reused for access to commands using the KULF_GREET_CLAN access token.

Soo...what's the verdict ? Am I officially wierd/crazy ?

// Fredrik
kulfaangaren! is offline
Send a message via MSN to kulfaangaren!
Reply



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


All times are GMT -4. The time now is 16:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode