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

View Poll Results: Should I port the plugins that came with Sourcemod (ex.: Slap) to interact with PSM?
Yes 15 35.71%
No 10 23.81%
I don't care, do what you want 17 40.48%
Voters: 42. You may not vote on this poll

[Any] PermissionsSM - Node-Based Permission Management (v1.0.1, 2014-08-30)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Wolvan
Senior Member
Join Date: Jul 2014
Location: Tyrol, Austria
Plugin ID:
4332
Plugin Version:
1.0.1
Plugin Category:
Server Management
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Easy Permission Management with Permission Nodes and completely command based
    Old 08-29-2014 , 18:53   [Any] PermissionsSM - Node-Based Permission Management (v1.0.1, 2014-08-30)
    Reply With Quote #1

    If you guys are running my Plugin on a server, I would love to know the IP and check it!

    About
    I never really liked the way Sourcemod handles Permissions, call me a spoiled brat but that's my opinion. Anyways, I used to own a minecraft server and that is where I got this idea from. Node-based Permissions! All by itself it's pretty useless, so I hope people begin adopting the idea and my plugin and start using node-based permissions. I will update my plugins to use PSM later, so these will probably be the first 2 which you can use together with this.

    Features
    1.) Easy to use: Just drag the .smx file into your plugins folder and you're set
    2.) Entirely command based: You can modify both groups and users completly using commands. You can also edit the Users.txt and Groups.txt Files found in Sourcemod\gamedata\PermissionsSM
    3.) Easy for developers to hook into: Use the natives PsmHasPermission and PsmCanTarget for Permission checking

    Commands
    permissionssm - Command that gives you access to all the other commands (permissionssm help)
    psm - Alias for permissionssm
    sm_permissionssm - Command that gives you access to all the other commands
    sm_psm - Alias for permissionssm

    Permission Nodes
    Basically, PermissionsSM.[subcommand]. For example PermissionsSM.addperm for the user/group addperm command
    Or PermissionsSM.admin for access to all commands


    ConVars
    permissionssm_version (1.0) - Just an ordinary version ConVar

    Installation instructions
    1.) Download .smx file below and put it in your plugins folder
    2.) Load it with sm plugins load PermissionsSM or by restarting your server
    3.) Set Users and Groups the way you want

    Dependencies
    None

    Plugins that use PermissionsSM
    None

    Bugs
    None so far

    Planned Features
    - Build a metrics System (+SM Extension) and hook this Plugin into it
    - Add Adminmenu Integration
    - Make Superpermissions (Pluginname.*) possible
    - Override CheckCommandAccess maybe?
    - Write Documentation for Usage
    Anything else you guys might wanna see being added?

    For Developers
    I will build an example plugin later that you can check out, for now, just download the permissionssm.inc and check the usage in there
    If you wrote a Plugin, please send me a link, I will link it here in the Post as well

    Special thanks
    PermissionsEX for giving me the idea

    Servers with my Plugin
    Spoiler


    Media
    Spoiler

    If you have any kind of media related to this, I'd love to add it here.

    Changelog
    Spoiler
    Attached Files
    File Type: sp Get Plugin or Get Source (PermissionsSM.sp - 1040 views - 45.5 KB)
    File Type: inc permissionssm.inc (1.1 KB, 594 views)
    File Type: txt Groups.txt (611 Bytes, 630 views)
    File Type: txt Users.txt (119 Bytes, 396 views)
    __________________

    Last edited by Wolvan; 09-02-2014 at 09:39. Reason: Forgot to add example Users.txt and Groups.txt
    Wolvan is offline
    Send a message via Skype™ to Wolvan
    Drixevel
    AlliedModders Donor
    Join Date: Sep 2009
    Location: Somewhere headbangin'
    Old 08-29-2014 , 19:29   Re: [Any] PermissionsSM - Node-Based Permission Management (v1.0, 2014-08-30)
    Reply With Quote #2

    Tip:

    Code:
    		new String:ErrorMsg[] = "[PSM] Missing arguments, use <psm help> for commands";
    		if (client == 0) { PrintToConsole(client, ErrorMsg); } else { PrintToChat(client, ErrorMsg); }
    Switch this to...

    Code:
    ReplyToCommand(client, "[PSM] Missing arguments, use <psm help> for commands");
    It will do the same thing based on what it's replying to.
    Drixevel is offline
    Wolvan
    Senior Member
    Join Date: Jul 2014
    Location: Tyrol, Austria
    Old 08-29-2014 , 19:31   Re: [Any] PermissionsSM - Node-Based Permission Management (v1.0, 2014-08-30)
    Reply With Quote #3

    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    Tip:

    Code:
    		new String:ErrorMsg[] = "[PSM] Missing arguments, use <psm help> for commands";
    		if (client == 0) { PrintToConsole(client, ErrorMsg); } else { PrintToChat(client, ErrorMsg); }
    Switch this to...

    Code:
    ReplyToCommand(client, "[PSM] Missing arguments, use <psm help> for commands");
    It will do the same thing based on what it's replying to.
    God dangit, I wish I would have known of this A LOT sooner, dang. Thanks, will put it in asap. Otherwise any feedback you wanna give?
    __________________
    Wolvan is offline
    Send a message via Skype™ to Wolvan
    Drixevel
    AlliedModders Donor
    Join Date: Sep 2009
    Location: Somewhere headbangin'
    Old 08-29-2014 , 22:29   Re: [Any] PermissionsSM - Node-Based Permission Management (v1.0, 2014-08-30)
    Reply With Quote #4

    Change the following up: (You generally do this when you're working with file/folder paths)

    Code:
    decl String:filename[512];
    Code:
    decl String:filename[PLATFORM_MAX_PATH];
    This is done to allow your plugin to be future proof if the amount changes with the engine.

    ---

    Code:
    	if (tmpHandle == INVALID_HANDLE) { PrintToServer("An Error occured while cloning the GroupsKV Handle."); return false; }
    Errors with handles such as this should use the function 'LogError' because it's an error. You can also make your own configuration file but that's up to you. (probably be cleaner to use error logs)

    ---
    This might be just how the Bukkit works for Minecraft (or whatever plugin system you use) but It'd probably be easier if you set the following values to 0 for false and 1 for true?

    Code:
    if (!negated) { KvSetString(GroupsKV, Parent, "true"); } else {KvSetString(GroupsKV, Parent, "false"); }
    Not really a bug but a suggestion.

    ---
    You should probably check first if the handles are running, might lead to errors.

    Code:
    	CloseHandle(ConfigKV);
    	ConfigKV = INVALID_HANDLE;
    	CloseHandle(UsersKV);
    	UsersKV = INVALID_HANDLE;
    	CloseHandle(GroupsKV);
    	GroupsKV = INVALID_HANDLE;
    Code:
    if (ConfigKV != INVALID_HANDLE)
    {
    //Close handle/Set to Invalid.
    }
    ---
    Add an 'sm_' before all commands you make or make a replica of the command with the prefix instead. Sourcemod uses functionality to allow users to type '!permissionssm' into chat and have it execute in the client's console if the command set in the plugin is 'sm_permissionssm'.

    Code:
    	RegConsoleCmd("permissionssm", Command_PermissionsSM, "Permissions SM Base Command.")
    	RegConsoleCmd("sm_permissionssm", Command_PermissionsSM, "Permissions SM Base Command.")
    	RegConsoleCmd("psm", Command_PermissionsSM, "Alias for permissionssm.")
    	RegConsoleCmd("sm_psm", Command_PermissionsSM, "Alias for permissionssm.")
    ---
    This is unnecessary, you don't need to check if the ConVar for version control is there, just create the version ConVar and execute the config after IF you have more than 1 ConVar. In this case, just remove this line entirely since you don't need a configuration file made for 1 ConVar which is the version.

    Code:
    if (FindConVar("permissionssm_version") == INVALID_HANDLE) { AutoExecConfig(true); }
    ---
    One more suggestion (not a bug): Add MoreColors and/or Colors support to make the text specific colors.

    https://forums.alliedmods.net/showthread.php?t=185016

    Last edited by Drixevel; 08-29-2014 at 22:43.
    Drixevel is offline
    iGANGNAM
    AlliedModders Donor
    Join Date: Sep 2012
    Location: Lithuania
    Old 08-30-2014 , 03:27   Re: [Any] PermissionsSM - Node-Based Permission Management (v1.0, 2014-08-30)
    Reply With Quote #5

    Sounds cool, but it would take too much to recreate whole stuff
    + does it support mysql?

    Last edited by iGANGNAM; 08-30-2014 at 03:28.
    iGANGNAM is offline
    Drixevel
    AlliedModders Donor
    Join Date: Sep 2009
    Location: Somewhere headbangin'
    Old 08-30-2014 , 05:44   Re: [Any] PermissionsSM - Node-Based Permission Management (v1.0, 2014-08-30)
    Reply With Quote #6

    Quote:
    Originally Posted by iGANGNAM View Post
    Sounds cool, but it would take too much to recreate whole stuff
    + does it support mysql?
    This might be useful to give server operators who have/are operated/operating Minecraft servers to have a bit easier of a time with Sourcemod, etc.
    Drixevel is offline
    iGANGNAM
    AlliedModders Donor
    Join Date: Sep 2012
    Location: Lithuania
    Old 08-30-2014 , 08:13   Re: [Any] PermissionsSM - Node-Based Permission Management (v1.0, 2014-08-30)
    Reply With Quote #7

    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    This might be useful to give server operators who have/are operated/operating Minecraft servers to have a bit easier of a time with Sourcemod, etc.
    I know that plugin on bukkit, I have used it too... But I think it's enought to play with sourcemod flags (There are enought of them)
    iGANGNAM is offline
    Wolvan
    Senior Member
    Join Date: Jul 2014
    Location: Tyrol, Austria
    Old 08-30-2014 , 15:28   Re: [Any] PermissionsSM - Node-Based Permission Management (v1.0, 2014-08-30)
    Reply With Quote #8

    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    Change the following up: (You generally do this when you're working with file/folder paths)

    Code:
    decl String:filename[512];
    Code:
    decl String:filename[PLATFORM_MAX_PATH];
    This is done to allow your plugin to be future proof if the amount changes with the engine.
    Done, thanks for telling me about that Constant ^^


    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    Code:
    	if (tmpHandle == INVALID_HANDLE) { PrintToServer("An Error occured while cloning the GroupsKV Handle."); return false; }
    Errors with handles such as this should use the function 'LogError' because it's an error. You can also make your own configuration file but that's up to you. (probably be cleaner to use error logs)
    I changed it so it uses LogError now, another function I didn't know about :D. Thanks for pointing that out
    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    This might be just how the Bukkit works for Minecraft (or whatever plugin system you use) but It'd probably be easier if you set the following values to 0 for false and 1 for true?

    Code:
    if (!negated) { KvSetString(GroupsKV, Parent, "true"); } else {KvSetString(GroupsKV, Parent, "false"); }
    Not really a bug but a suggestion.
    That's kinda something I decided on the go, probably gonna change that yeah.

    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    You should probably check first if the handles are running, might lead to errors.

    Code:
    	CloseHandle(ConfigKV);
    	ConfigKV = INVALID_HANDLE;
    	CloseHandle(UsersKV);
    	UsersKV = INVALID_HANDLE;
    	CloseHandle(GroupsKV);
    	GroupsKV = INVALID_HANDLE;
    Code:
    if (ConfigKV != INVALID_HANDLE)
    {
    //Close handle/Set to Invalid.
    }
    Dang, I wanted to add that but forgot xD

    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    Add an 'sm_' before all commands you make or make a replica of the command with the prefix instead. Sourcemod uses functionality to allow users to type '!permissionssm' into chat and have it execute in the client's console if the command set in the plugin is 'sm_permissionssm'.

    Code:
    	RegConsoleCmd("permissionssm", Command_PermissionsSM, "Permissions SM Base Command.")
    	RegConsoleCmd("sm_permissionssm", Command_PermissionsSM, "Permissions SM Base Command.")
    	RegConsoleCmd("psm", Command_PermissionsSM, "Alias for permissionssm.")
    	RegConsoleCmd("sm_psm", Command_PermissionsSM, "Alias for permissionssm.")
    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    This is unnecessary, you don't need to check if the ConVar for version control is there, just create the version ConVar and execute the config after IF you have more than 1 ConVar. In this case, just remove this line entirely since you don't need a configuration file made for 1 ConVar which is the version.

    Code:
    if (FindConVar("permissionssm_version") == INVALID_HANDLE) { AutoExecConfig(true); }
    I did the sm_ commands as duplicates so you can still use permissionssm and psm from the console

    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    One more suggestion (not a bug): Add MoreColors and/or Colors support to make the text specific colors.

    https://forums.alliedmods.net/showthread.php?t=185016
    I see what I can do, and which text are you referring to?

    Quote:
    Originally Posted by iGANGNAM View Post
    Sounds cool, but it would take too much to recreate whole stuff :|
    + does it support mysql?
    Not yet, would you like to see MySQL Support?
    __________________
    Wolvan is offline
    Send a message via Skype™ to Wolvan
    Drixevel
    AlliedModders Donor
    Join Date: Sep 2009
    Location: Somewhere headbangin'
    Old 08-30-2014 , 15:44   Re: [Any] PermissionsSM - Node-Based Permission Management (v1.0, 2014-08-30)
    Reply With Quote #9

    Quote:
    Originally Posted by Wolvan View Post
    I see what I can do, and which text are you referring to?
    All prints in chat for clients. (PrintToChat, PrintToChatAll, ReplyToCommand, ShowActivity...)

    There's a function inside of that include called 'CReplyToCommand', use that to add color tags.

    It would also be beneficial if you added translation support to the plugin as well.

    Last edited by Drixevel; 08-30-2014 at 15:44.
    Drixevel is offline
    Wolvan
    Senior Member
    Join Date: Jul 2014
    Location: Tyrol, Austria
    Old 08-30-2014 , 15:50   Re: [Any] PermissionsSM - Node-Based Permission Management (v1.0, 2014-08-30)
    Reply With Quote #10

    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    All prints in chat for clients. (PrintToChat, PrintToChatAll, ReplyToCommand, ShowActivity...)

    There's a function inside of that include called 'CReplyToCommand', use that to add color tags.

    It would also be beneficial if you added translation support to the plugin as well.
    I must confess, I haven't worked with translations yet, How do?

    About the colors, I am gonna think about it ^^
    __________________
    Wolvan is offline
    Send a message via Skype™ to Wolvan
    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 05:23.


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