Posts: 661
Threads: 52
Joined: Feb 2011
2011-04-10, 12:04:58
(This post was last modified: 2011-12-16, 13:07:53 by OOuineur.)
Multi User plugin
Click Here To Download From Extend
View GitHub Repos.
It has the following functionality:
Edit User:
You are able to edit all the options for each user, including permissions.
Add User:
You are able to add a new user and set permissions
Permissions:
You can block certain features and areas for each individual user.
This includes removing the items from the navigation, as well as blocking access to the area/item if the user tries to access it directly.
The Following Areas Can Be Blocked Using The Permissions:- Pages
- Files
- Theme
- Plugins
- Backups
- Settings
- Support
- Edit
For Plugin Developers:
I created a function, which other plugins can use, that will add a permissions checkbox onto the manage users page. Example below:
Code: <?php add_mu_permission('blogsettings', 'Blog Settings'); ?>
The above code (placed in my GS Blog plugin) will add a checkbox on the manage users page with the label of Blog Settings. It will save it to the users xml file in the node "blogsettings".
Below is a screenshot of the effect of adding that function and a few other permissions:
Now that the data is stored in the users xml file, the plugin author can access that by manually loading the xml file or by using a function the multi user plugin provides. Example Below:
Code: <?php check_user_permission($username, $permission_node); ?>
<?php check_user_permissions($username); ?>
The above (check_user_permission()) will return false if the page is blocked or true if the page is not blocked or the node is missing from the users xml file.
The above (check_user_permissions()) function will return an array of all permissions in the following format:
'permissionname'=>bool
Plugin Screenshots Below:
User Management Screen:
Edit User:
Add User:
Changes & Versions:
Version 1.1 (4/11/2011)
- Links in Admin Panel footer will now be hidden based on permissions set
- Added 'Disable Admin Access' Checkbox:
- If Checked, the user will not be able to manage users or access the 'user management' screen.
- Added 'Custom Landing Page' dropdown:
- The ability to select an alternate landing page the user will land on after login (useful if 'pages' is disabled)
- Language files installed will automatically show up in the 'Language' dropdown
- Cleaned up jquery using Chris's suggestion
Important Change To Note:
I have rearranged the xml file (Taking Chris's Suggestion) by putting all of the permissions in <permissions></permissions>
This means that if you have already used the multi user plugin, and you installed version 1.1, you will need to reset the permissions by editing the users.
Version 1.4 (12/15/2011)
- Fixed "Manage User" Form In All Versions Of IE - Previously clicking the "Edit" link for a user crashed IE
- Fixed Occasional Error That Occurred When Resetting Password From Front End
- Re-Coded Entire Plugin For Easier Future Updating & Community Collaboration
- Added "Update This Plugin" Button Which Will Update The Plugin To The Newest Version In Extend
- Fixed Problem With Settings Page
Previously changing the password from the settings page would overwrite permissions.
Click Here To Learn More About This Fix
- Various Other Changes And Improvements
Version 1.5 (2012-03-27)- Removed "no" text being which was displaying if the settings page was blocked.
Version 1.6 (2012-06-01)- Added localization. Includes en_US and en_IT language files
- Fixed bug where clicking update updated the plugin regardless of if "cancel" was pressed or not.
Version 1.7 (2012-06-01)- Added ability to give users names and bios.
- Allows users to change their own bio and display name from settings page
TAKE NOTE:
For some reason Get Simple does not use the SimpleXMLExtended class and instead uses SimpleXMLElement to save the user file.
Because of this the CDATA is removed from the bio node in the users xml file if a user save data from the settings page. This might be a problem if certain special characters are used in the editor. We shall see.
Version 1.8.2 (9-21-2012)- Added check_user_permissions() function - This function returns all
permissions in an array for the provided user
- Fixed issue with custom permissions being reset if admin settings form
is submitted
This was my first plugin so let me know if anyone catches any bugs or mistakes.
Posts: 1,108
Threads: 70
Joined: Aug 2009
Hey Mike,
Great job on the plugin...
There is a problem with the user-managment-add.php register plugin function, your missing the "author URL"
which is preventing new user being created.
Otherwise works a treat.....
Posts: 63
Threads: 5
Joined: Mar 2011
great-great plugin!
I try it and when I created one user and save settings, the page has been empty, have not loaded any section..
Also, in the user settings, don't show the default language that I have configured in GS (Spanish).
repeat: great plugin!
Posts: 661
Threads: 52
Joined: Feb 2011
n00dles101 Wrote:Hey Mike,
Great job on the plugin...
There is a problem with the user-managment-add.php register plugin function, your missing the "author URL"
which is preventing new user being created.
Otherwise works a treat.....
Thanks for the heads up.
I added the url and re-uploaded it to extend & this post.
Posts: 661
Threads: 52
Joined: Feb 2011
singulae Wrote:great-great plugin!
I try it and when I created one user and save settings, the page has been empty, have not loaded any section..
Also, in the user settings, don't show the default language that I have configured in GS (Spanish).
repeat: great plugin!
I am aware of the language issue.
I do not know what function I can use to automatically populate the language select box with the languages a user has installed. If anyone can help me out with that it would be appreciated.
Posts: 1,848
Threads: 86
Joined: Aug 2009
Wow mike. Great looking plugin. I'll give it a test drive tomorrow sometime.
- Chris
Thanks for using GetSimple! - Download
Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Posts: 346
Threads: 27
Joined: Sep 2010
2011-04-10, 16:42:52
(This post was last modified: 2011-04-10, 16:43:30 by logonsf.)
Works perfectly as promised and will be really benefitial for GS users with larger sites
Here are where some 'snags' may come in (depending on what a client might expect):
- If the 'Pages' page is disabled, a user basically can't access the back end (because this is the page they are directed to upon logging in). Now this may seem redundant because disabling that page for users may be a singular occurance, but if someone is tasked as the Web Developer or Web Designer but the client doesn't want that person to access/change what is on the pages? It would make sense in that instance is they could be redirected to the next tab available (either Files or Theme), but you could argue that it would be a mugs game to disable the 'Pages' page. So perhaps make an option for a 'Starting Page' redirection in the absense of access to the 'Pages' tab.
- For plugin developers like juliancc who've made their own tabs for specific plugins (like the GSGallery), there isn't a way to disable access to those tabs. Might be desireable to find a way around this.
- This is probably the biggest snag, and it is that the right side panel for links is gone for added users. So if you had someone registered as a Journalist for example, they can't actually access the 'Create New Page' page or any News plugin to be able to start producing content - they can only edit what is already there.
Otherwise, what you have at the moment works and it isn't a case of things bugging out - simply refining your plugin's functionality to the best it can achieve Awesome stuff indeed *two thumbs up*
Posts: 423
Threads: 15
Joined: Mar 2011
Fantastic news! This feature will open up many new applications.
mikeh Wrote:I added the url and re-uploaded it to extend & this post.
Just one request: please use a different version number, even for the smallest of changes, otherwise it will come back to bite someone, sooner or later. I'd suggest only having one download point, too (Extend section, rather than this thread).
--
Nick.
Posts: 661
Threads: 52
Joined: Feb 2011
Angryboy Wrote:Works perfectly as promised and will be really benefitial for GS users with larger sites
Here are where some 'snags' may come in (depending on what a client might expect):
- If the 'Pages' page is disabled, a user basically can't access the back end (because this is the page they are directed to upon logging in). Now this may seem redundant because disabling that page for users may be a singular occurance, but if someone is tasked as the Web Developer or Web Designer but the client doesn't want that person to access/change what is on the pages? It would make sense in that instance is they could be redirected to the next tab available (either Files or Theme), but you could argue that it would be a mugs game to disable the 'Pages' page. So perhaps make an option for a 'Starting Page' redirection in the absense of access to the 'Pages' tab.
- For plugin developers like juliancc who've made their own tabs for specific plugins (like the GSGallery), there isn't a way to disable access to those tabs. Might be desireable to find a way around this.
- This is probably the biggest snag, and it is that the right side panel for links is gone for added users. So if you had someone registered as a Journalist for example, they can't actually access the 'Create New Page' page or any News plugin to be able to start producing content - they can only edit what is already there.
Otherwise, what you have at the moment works and it isn't a case of things bugging out - simply refining your plugin's functionality to the best it can achieve Awesome stuff indeed *two thumbs up*
Appreciate the feedback..
I will definitely add the ability to set an alternate starting page, and look into your other suggestions
Posts: 524
Threads: 48
Joined: Mar 2011
mikeh,
this is a fantastic addition to GS, you rock! I personally don't have any immediate use for it, but, as others said, this'll open up new great possibilities.
Keep up the good work, mate!
Posts: 1,848
Threads: 86
Joined: Aug 2009
Wow, i must say Mike - this is a great job. A few things that I noticed:
1. you hide the top nav links, but the bottom footer links do not hide. I am thinking of adding a class to each one as I have for the top nav links so when you hide ".theme" you hide both. However, this obviously wont be until 3.1 gets released.
2. if you do not have "all" the permissions, you shouldn't be allowed to edit your own permissions. i am assuming that if you have all permissions - you are an administrator.
3. i think to make the user.xml file cleaner - you should make the format like this:
Code: $xml = new SimpleXMLElement('<item></item>');
$xml->addChild('USR', $NUSR);
$xml->addChild('PWD', $NPASSWD);
$xml->addChild('EMAIL', $NEMAIL );
$xml->addChild('HTMLEDITOR', $NHTMLEDITOR);
$xml->addChild('TIMEZONE', $NTIMEZONE);
$xml->addChild('LANG', $NLANG);
$perm = $xml->addChild('PERMISSIONS');
$perm->addChild('PAGES', $NPAGES);
$perm->addChild('FILES', $NFILES);
$perm->addChild('THEME', $NTHEME);
$perm->addChild('PLUGINS', $NPLUGINS);
$perm->addChild('BACKUPS', $NBACKUPS);
$perm->addChild('SETTINGS', $NSETTINGS);
$perm->addChild('SUPPORT', $NSUPPORT);
$perm->addChild('EDIT', $NEDIT);
4. Why didnt you reuse the timezone <select> code from settings.php? Check out Line 222 in settings.php
5. To read the system's available languages, you can rip the code from settings.php as well: Line 153
6. .show("slow") and .hide("slow") make the page look sluggish when it really isnt. i would personally prefer just to use the default speed or change it to .slideDown() and .slideUp() respectively
overall - very very nice plugin Mike. I also think that you should add some type of disclaimer within the Extend section explaining that permissions only "hide functionality" not actually "disable functionality" from the end user.
- Chris
Thanks for using GetSimple! - Download
Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Posts: 1,922
Threads: 87
Joined: Apr 2010
after adding a user attempts to log me appears
Code: You Do Not Have Permissions To Access This Page
Posts: 15
Threads: 2
Joined: Nov 2009
Simple - great plugin. I'm sure will be one of the most used. Great thank you!
Oleg, you may have checked the wrong checkbox - "pages" for example.
Posts: 1,922
Threads: 87
Joined: Apr 2010
2011-04-11, 01:41:31
(This post was last modified: 2011-04-11, 02:12:32 by jhondavis.)
Yes, the plugin is very useful, thanks.
and the language file will be?
Posts: 661
Threads: 52
Joined: Feb 2011
2011-04-11, 02:40:38
(This post was last modified: 2011-04-11, 08:32:03 by OOuineur.)
ccagle8 Wrote:Wow, i must say Mike - this is a great job. A few things that I noticed:
1. you hide the top nav links, but the bottom footer links do not hide. I am thinking of adding a class to each one as I have for the top nav links so when you hide ".theme" you hide both. However, this obviously wont be until 3.1 gets released.
2. if you do not have "all" the permissions, you shouldn't be allowed to edit your own permissions. i am assuming that if you have all permissions - you are an administrator.
3. i think to make the user.xml file cleaner - you should make the format like this:
Code: $xml = new SimpleXMLElement('<item></item>');
$xml->addChild('USR', $NUSR);
$xml->addChild('PWD', $NPASSWD);
$xml->addChild('EMAIL', $NEMAIL );
$xml->addChild('HTMLEDITOR', $NHTMLEDITOR);
$xml->addChild('TIMEZONE', $NTIMEZONE);
$xml->addChild('LANG', $NLANG);
$perm = $xml->addChild('PERMISSIONS');
$perm->addChild('PAGES', $NPAGES);
$perm->addChild('FILES', $NFILES);
$perm->addChild('THEME', $NTHEME);
$perm->addChild('PLUGINS', $NPLUGINS);
$perm->addChild('BACKUPS', $NBACKUPS);
$perm->addChild('SETTINGS', $NSETTINGS);
$perm->addChild('SUPPORT', $NSUPPORT);
$perm->addChild('EDIT', $NEDIT);
4. Why didnt you reuse the timezone <select> code from settings.php? Check out Line 222 in settings.php
5. To read the system's available languages, you can rip the code from settings.php as well: Line 153
6. .show("slow") and .hide("slow") make the page look sluggish when it really isnt. i would personally prefer just to use the default speed or change it to .slideDown() and .slideUp() respectively
overall - very very nice plugin Mike. I also think that you should add some type of disclaimer within the Extend section explaining that permissions only "hide functionality" not actually "disable functionality" from the end user.
Hello Chris,
Thanks for the feedback.
One thing I want to note is that permissions hide the functionality and kill the page if they try to access it directly. They do not only remove the menu items.
I will definitely make the changes you mentioned in #2,3,4,5,6. I will try and use jQuery to hide the bottom links as well.
Posts: 661
Threads: 52
Joined: Feb 2011
2011-04-11, 02:41:41
(This post was last modified: 2011-04-11, 02:42:33 by OOuineur.)
Oleg06 Wrote:after adding a user attempts to log me appears
Code: You Do Not Have Permissions To Access This Page
It looks like you disabled the 'pages' page for the user you created.
This will block them from accessing the page, I should have the ability to choose an alternate starting page complete this evening.
I will also add the language files this evening.
Posts: 1,922
Threads: 87
Joined: Apr 2010
Yes, I already knew, and I welcome the development of language files
Posts: 423
Threads: 15
Joined: Mar 2011
Blocking access to 'Theme' is never saved because of a typo in user-managment.php, line 77: Code: --- if (isset($_POST['Theme']) && $_POST['Files'] == 'no') {
+++ if (isset($_POST['Theme']) && $_POST['Theme'] == 'no') {
--
Nick.
Posts: 661
Threads: 52
Joined: Feb 2011
I have successfully removed the links in the footer and the 'create new page' in the sidebar (without removing the entire sidebar).
Now I will add the field for a alternate starting page.
Does anyone have suggestions for which pages should be allowed as a starting page?
Or should I take Angryboy's suggestion and redirect to the next available nav tab?
Posts: 3
Threads: 0
Joined: Apr 2011
When adding a file user-managment.php to the plugin folder
Admin page Unable to load XML file!
What should i do?
Posts: 661
Threads: 52
Joined: Feb 2011
JustSaint Wrote:When adding a file user-managment.php to the plugin folder
Admin page Unable to load XML file!
What should i do? What version getsimple are you using?
Posts: 1,848
Threads: 86
Joined: Aug 2009
mikeh Wrote:One thing I want to note is that permissions hide the functionality and kill the page if they try to access it directly. They do not only remove the menu items. Ha, I didnt realize this because when I tested the plugin - i ran into this bug
- Chris
Thanks for using GetSimple! - Download
Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Posts: 661
Threads: 52
Joined: Feb 2011
2011-04-12, 04:05:36
(This post was last modified: 2011-04-12, 04:45:52 by OOuineur.)
I have uploaded version 1.1 to extend:
Changes Include:
- Links in Admin Panel footer will now be hidden based on permissions set
- Added 'Disable Admin Access' Checkbox:
- If Checked, the user will not be able to manage users or access the 'user management' screen.
- Added 'Custom Landing Page' dropdown:
- The ability to select an alternate landing page the user will land on after login (useful if 'pages' is disabled)
- Language files installed will automatically show up in the 'Language' dropdown
- Cleaned up jquery using Chris's suggestion
Important Change To Note:
I have rearranged the xml file (Taking Chris's Suggestion) by putting all of the permissions in <permissions></permissions>
This means that if you have already used the multi user plugin, and you upgrade to v1.1, you will need to reset the permissions by editing the users.
Posts: 346
Threads: 27
Joined: Sep 2010
Mighty fast improvements there, mikeh! With that speed, all the bugs will be ironed out in no-time!
As I'm sure you're working with the feedback everyone has dished out at the moment, I won't add anything else (in fact there really isn't anything else, to be honest). Of what you have updated, things are all gravy and functional. All I can really say is keep at it and this'll be something people will want for the core of the next big update of GS
Posts: 1,848
Threads: 86
Joined: Aug 2009
Angryboy Wrote:this'll be something people will want for the core of the next big update of GS i can already hear the calls for it now... haha
- Chris
Thanks for using GetSimple! - Download
Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
|