Ulysses Stuff > Releases

ULib MySQL Authentication

(1/5) > >>

MrPresident:
What This Is
This is a replacement for ULib's UCL storage system. The current system saves and reads all stored users and their accesses from a single text file. This works fine, unless you have multiple servers or a LOT of information in that file.

What This Does
This overrides the Save and Load functions in UCL. Instead of loading and saving your users to the users.txt file, it will instead load and save them from a database.


What This Doesn't Do
This only handles users. It doesn't store groups or group permissions. Those are still going to be stored in the groups.txt
This doesn't handle banning. There are plenty of MySQL banning modules out there.

What Is Modified
You will need to *replace* your ucl.lua file in addons\ULib\lua\ulib\server\ucl.lua
We typically NEVER recommend that you replace any of our stock files as this could cause issues or the changes will be reverted the next time you update ULib.. However, due to the nature of this kind of modification simply writing it into an addon wouldn't work because of the way modules are loaded. If you choose to install this, I HIGHLY recommend making a backup of your ULib addon first.
Inside the ucl.lua file I added some MySQL functions. I also modified the SaveFile function as well as completely commented out the LoadFromFile function. I also slightly modified addUser and removeUser functions.

How To Install
1. Install the MySQLoo module. If you don't know where/how to get this I suggest Google.
2. Download the copy of ucl.lua from this post (YOU NEED TO BE LOGGED IN TO SEE IT)
3. Replace Addons\ULib\lua\server\ucl.lua with the one I provided.
4. Create a database in your MySQL called 'ulibsql' and set up a user to have permissions for it. (Don't create any tables inside of it, my code will handle that)
5. Edit the information at the top of the file to suit your MySQL database.
6. To be sure the table generated: run 'lua_run ULib_SQL_CreateTable()' from your server console.
7. From your server console or in game (if you are a superadmin) run ulib_loadlegacy to load your users from your users.txt and load them into your database.

WARNING/CAUTION
This is ONLY for people who know how to use the MySQLOO module. I will not provide support for getting that installed or configured.
This is not for server owners who do not know enough about lua or modifying files to at least edit the SQL configuration at the top of the file.
If you update ULib this modification will be lost and you'll have to reinstall it.
This comes as-is and while I did to testing, there is no way for me to know if it'll work in every situation. Please make a backup of your ULib files before installing this.

Help/Support
I am not going to help you install MySQLOO.
If you have MySQLOO installed and configured properly and are having trouble with this modification, please feel free to post here and I will try and assist you the best I can.



Please let me know how this works for you. :)

JamminR:
But But but, couldn't you use our current ULib hooks for pre/post translate commands to hook into ucl change, prevent the original function, perform yours, and not have to overwrite our original ucl file?
*sniffle*

(I say 'our' because you are 'us' now that we've assimilated you) :)

MrPresident:
No, because all of this stuff happens so far into the background of UCL that it isn't hooked. I could have done it with the Add and Remove user, but the rest I couldn't. I had to override the function entirely and in my experience, addons have a weird way of loading in different orders each time so there really isn't a good way to write a module to do that.

I've talked to Megiddo about redoing how our modules are loaded to allow for something like this. I believe it's on our list of things for the next big ULX/ULib rewrite.

Zaddion:
I was really hoping I could get this to work without having to ask for help. I have MYSQLOO installed (another addon that I use requires it), I made a database for the addon, I filled out the sql information at the top of the ucl file, and I overwrote the file. I restarted my server and I tried running the command, I waited, waited longer, it didn't say if it was successful or anything, so I waited a couple of minutes and checked my database, nothing happened? Is it an overtime thing? It'd be nice if it told me if the command worked if it did work. I double checked my sql information and made sure it was all correct. Not sure what I did wrong.

MrPresident:
If you did it correctly, it should generate a table inside of your database when you first start your server.
Make sure you have permissions assigned for the database correctly.

Do you get any messages in console while ULX is loading?

Navigation

[0] Message Index

[#] Next page

Go to full version