The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
User Management Changes
#1
Hello,

I have made changes to my system that will allow you to designate User Management personnel who can safely and securely work with users in your system without having the risk of breaking things.

Moving the add user form to its own page:
https://hastebin.com/ivaxusayak.xml (save as adduser.php in usersc)

Note that this adduser.php page does not have the permission selector, because my system is based on levels allowing access to specific pages, e.g. everyone has the default level of "1" (User), if you are a User Manager, you have access to certain pages, System Admin, Database Admin, etc. So this add page will auto-assign the user to Level 1.

Remove the delete buttons from the admin_users.php page and modify the columns, remove the adduser form:
https://hastebin.com/ijebodiwil.xml (save as admin_users.php in usesrc)

Add the delete button to admin_user.php, and only allow user to add or remove permissions THEY have, for example:
Bob has Users Level 1, 2 and 4.
Editor has Users Level 1, 3 and 4.
The System has User Levels 1, 2, 3, 4 and 5.

The Editor can only see Levels 1 and 4 on Bob's profile in the remove section, and Level 3 in the Add Section since those are the permissions they have assigned to themselves.

https://hastebin.com/liwelegiti.sm (save as admin_user.php in usersc).

This calls for a custom function:
https://hastebin.com/fotiyagiga.php

I hope these changes work for some of you Smile
  Reply
#2
I've done further updates to my User Management.

Current structure for admin_users.php has the add form back on this page with a modal to do the addition.

I removed the the delete checkboxes as I did before, added ID in its place, took out join date and logins, and also added a verified checkmark that only shows if email verification is turned on. It has jqwerty built in so you can use the esc key to get out of the modal quickly. When you create a new user it will redirect you to the admin_user.php page for them. You can disable this be commenting line ~ 147 that calls the redirect.

Code:
admin_users.php
http://pasted.co/8058d387

The new admin_user.php page is my favorite of all. Here is a screenshot of it:
http://screencloud.net/v/38PRd

I added tons of features and movement in this page so it is easier to read, and not everything is in one view. If email verification is enabled, in the top left you will see "Email Verified" or if the user is not verified, a checkbox with the value of "Verify Email" so you can manually verify a user.

On the right we have the protected profile value. This is controlled from the
Code:
protectedprof
value determined around line 347. Basically, if you belong to the master account array, or you do not but your
Code:
protected
value in the users table is 1 AND (to both conditions) the userId you are looking at does not belong to you, the value is 1, which disables all editing to the profile. Otherwise, the
Code:
protectedprof
value is 0.

Here is what a protected profile being accessed by a user who is not within a master account looks like:
http://screencloud.net/v/AtJsA

However, if you belong to the master account array, you can set protected profiles, and instead, a checkbox (checked or unchecked) will show up based on the users protected value in the table. Check this, the profile is protected, uncheck and it is not!

On the splash page you can modify the username, email or name. However, you must click the modal to do anything with the password, system settings, permission settings, misc settings, etc. The System Settings for me is used for disabling/enabling settings, I am leaving that in there as a blank modal so you can play with it and add stuff if you want. These modals can make it easier for you to disable/hide these functions from certain personnel (based on access level) if you wish.

I incorporated my permission modifications as above to not allow a user to add/remove permissions that do not have access to. Instead of them just not showing, they show as a disabled checkbox now Smile

Code:
admin_user.php
http://pasted.co/e70ff5e5

JS:
Code:
jqwerty.js
https://pastebin.com/ngMRCMBd

All of my custom functions, you will need some of these:
https://pastebin.com/zbjXYgjt

And all of my languages key in a SQL as you will probably need them:
https://pastebin.com/meEZpGEK

I can't think of anything else you'll need with this but let me know if you run into problems!
  Reply
#3
I'm always forgetting something!

You need to add protected int 1 default value 0 to your users table Smile

Here's my users table structure in case I missed anything else:
http://pasted.co/fab5992b
  Reply
#4
Yep. This is on my list! Thank you!
  Reply
#5
You're welcome - I hope you like this - tried my best to make it as good lookin as I could Smile
  Reply
#6
It looks great. The only issue with it right now is it doesn't allow you to create a username for that person...and we've lost the ability to assign a user permission level to them.

Thoughts?
  Reply
#7
I'm also getting an unexpected end of file for admin_user.php

Thoughts?
  Reply
#8
The username thing yes...that is my fault as I auto-assign my users usernames. We will need to add that back in to the function. However, the file I provided you with will auto-assign based on the users first name and last name.

You can read more about that here:
https://userspice.com/forums/topic/auto-...-username/

The user permission level might be an issue. See the way I do my levels is no 2 levels share the same page access. Only one level can have that page. So I have CSR, User Management, Admin. My CSRs have access to base pages, User Management to the user management stuff, admin everything else. I am assigned all permission levels. My user management will be assigned CSR and User Management. You can revert that section of code back to the fault if you want, would just be a couple lines within that permission modal.
  Reply
#9
That could have been when I removed my logger stuff. When I get back from Lunch I'll work with it and send you an updated one.
  Reply
#10
Ok. We'll get it. Thanks for the great point in the right direction. I'm about to call it a day.
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)