Multiple User Support
\n\nOne of the biggest draw backs to Ghost right now is the obvious lack of multi-user support. Though let me be one of the first to tell you that is only in the front-end interface and completely can be accomplished with as little as 10 minutes sitting at a terminal window. That is the beauty of OpenSource software, everything about the software and how it stores data is in the open for you to discover and hack with. That is what I have done this afternoon / evening. After finding out where the user information is stored it was simply a matter of generating new data for a second user (my wife) and updating the existing data accordingly. Boom... multi-user support!\n\nThe only thing lacking now is a front-end presentation layer to the data that powers the users and related ACL tables regarding roles and permissions. Though since it is just the two of us once it is set up there isn't much more I need to do. \n\n###Commandline to the Rescue\n\n
\n\nAs always if you have access to a command terminal you can always get done what you want. Here are the SQL Queries that need to be run on the /data/ghost.db file in order to create a second user.\n\n####Create a New User\n\n
prettyprint lang-sh\nsqlite3 ./ghost.db \"INSERT into \"users\" (uuid, slug, name, email, password, created_at, created_by) VALUES ('<uuid>', '<slug>', '<name>', '<email>', '<random>', <seconds-from-epoch>, 1);\"\n\n\nWhere is a unique UUID (generate one here); is a unique URL slug (usually first-last); is the name of the user (as displayed at the bottom of the posts); is the email of the user; can just be anything as you will want to reset the password via "Forgot Password" anyways; and is the creation time of the entry in seconds from epoch. The last 1 that is in the list of values is the Database ID of the user that created this user entry (in this case 1, the original administrator).\n\n####Link the "Admin" role to the newly created User\n\n
prettyprint lang-sh\nsqlite3 ./ghost.db \"INSERT into \"roles_users\" (role_id, user_id) VALUES (1,2);\"\n\n\nIf you are running Ghost v0.3.1 or earlier you will need to also modify every post that you want attributed to this new user (both existing and future created). This is because as of v0.3.1 Ghost (proper) doesn't officially support multiple users in the front end. Multiple user support is coming in a future version as per RoadMap.\n\n####Update all posts for that user\n\n
prettyprint lang-sh\nsqlite 3 ./ghost.db \"UPDATE 'posts' set author_id = <id-of-user> where id IN (<id-of-post>, <id-of-another-post>, ...);\"\n\n\nWe haven't updated to version 0.4 yet, which just got announced yesterday. Hopefully the create a new post issue pointed out above is corrected. I haven't looked around in the code since version 0.3.1 so not sure if this particular bug has been fixed, though I would guess not as it isn't high on their list as officially there is no multi-user support yet. Though yet again this is where Open Source technology wins I can just spend a little time, create the bug in their tracking system (github) and correct the problem myself. I don't need to wait for the "official" team to work at their pace. If something bothers me or there is a feature I need I can just fork away.\n\nNow start your forking!