oscar-broman / PAWN-Boilerplate

(discontinued) Solid core for a big SA-MP server script.
http://sa-mp.com/
24 stars 13 forks source link

Add support for restricted classes #14

Open oscar-broman opened 12 years ago

oscar-broman commented 12 years ago

I.e. only GROUP_ADMIN can spawn with the chicken skin.

jte commented 12 years ago

I suggest you, if you have time to implement it, to rename this to Acess Control List, it does exactly what you said but covers whole class of problems.

oscar-broman commented 12 years ago

What do you mean? Create some generic permission system? I'm up for ideas!

jte commented 12 years ago

Something like that, yes. Have a look at Multi Theft Auto's Access Control List. In my opinion it's exactly what you are looking, with some modifications, of course, for example, renaming their concept of 'resource' to yours 'module' will fit perfectly. All in all, i see Access Control List as the best and most flexible solution to this problem.

Y-Less commented 12 years ago

y_groups...

oscar-broman commented 12 years ago

Yeah, kinda leaning towards just going with y_groups. Though the one thing missing is inheritance.

Y-Less commented 12 years ago

Easy enough to add really, and would address an issue several people have had.

Y-Less commented 12 years ago

I just remembered something. The way y_groups is designed is such that it can be used to set group permissions on any library with "Library_SetPlayer" and "Library_GetPlayer" functions - so if you have your own and have those two functions you can define "Library" and the max number of items in your library, include "y_groups", and now have group permissions.

I mention this for one reason, something I realised was technically possible a while ago but never tried it. One library with this "Get"/"Set" interface is "y_groups" itself! Meaning you can have groups of groups so that when a player gets added to a group, they will get added to all the groups under that group. So really, y_groups DOES have inheritance if you do this (or something like this):

#include <YSI\y_groups>
#define GROUP_LIBRARY_NAME<%0...%1> %0Group%1
#define GROUP_LIBRARY_SIZE MAX_GROUPS
#include <YSI\y_groups>

#undef GROUP_LIBRARY_NAME
#undef GROUP_LIBRARY_SIZE
#undef _GROUP_MAKE_NAME
#undef _GROUP_MAKE_LIMIT 

Then you will have such lovely functions as "Group_SetGroup" and "Group_SetGlobalGroupDefault", the former making a given group a member of another group, the latter making every group a member of every other group (or no groups members of any groups - I suggest you do the latter as a default, also for "Group_SetGroupDefault").

Jameskmonger commented 12 years ago

This has been added, surely?

oscar-broman commented 12 years ago

Only per-player, not for groups.

Jameskmonger commented 11 years ago

https://github.com/oscar-broman/PAWN-Boilerplate/commit/c6546241f82250ef689f1e3f6cea458a80200d30