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
Common Modifications
#24
I think any kind of implicit authority on the basis of ID number goes against the fact that they are arbitrary ID #s.

I can give my $0.02 on how it could be implemented...

In the front end you have to change
Code:
admin_permission.php
to allow for groups to be chosen as members of the group being edited. (Currently only users can be chosen)

Then in the database you
(1) add a column
Code:
user_is_group
to
Code:
User_Permission_Matches
(2) create a view which is simply a join of the
Code:
User_Permission_Matches
table N levels deep - something like this:

CREATE VIEW flattened_user_permission_matches
SELECT upm.user_id, upm.permission_id
FROM User_Permission_Matches upm
WHERE user_is_group = 0
UNION
SELECT upm.user_id, upm2.permission_id
FROM User_Permission_Matches upm
LEFT JOIN User_Permissions_Matches upm2 ON (upm.user_is_group = 0 AND upm2.user_is_group = 1 AND upm.permission_id = upm2.user_id)
UNION
SELECT upm.user_id, upm3.permission_id
FROM User_Permission_Matches upm
LEFT JOIN User_Permissions_Matches upm2 ON (upm.user_is_group = 0 AND upm2.user_is_group = 1 AND upm.permission_id = upm2.user_id)
LEFT JOIN User_Permissions_Matches upm3 ON (upm3.user_is_group = 1 AND upm2.permission_id = upm3.user_id)

And now whenever you want to look up what
Code:
permissions_id
have been assigned to a user you look in
Code:
flattened_user_permission_matches
. What I've got above takes the nesting to 3 levels (user within group within group within group) (I think - I get confused on this stuff - I may only have 2 levels there) but it could easily be extended to N levels just by giving myself a headache for a little bit longer...

Obviously the SQL code above is just conceptual - I'm sure I've got typos throughout and I may have missed important conditions. If you decide to go this way I can look up that old project and copy/paste since it's already working fine there.

If it is easier to change the front end and leave the back-end (the functions that look up permissions) unchanged then you could easily change the name of the existing
Code:
user_permission_matches
to
Code:
fred
and then name the view
Code:
user_permission_matches
. You might be able to come up with a better name than
Code:
fred
... :-) (Oh, wait! We could call it
Code:
user_group_matches
! Actually, no, that probably just complicates the semantics to use both names for the same meaning...)
  Reply


Messages In This Thread
Common Modifications - by brian - 09-15-2016, 04:31 PM
Common Modifications - by plb - 09-19-2016, 05:45 PM
Common Modifications - by mudmin - 09-19-2016, 06:00 PM
Common Modifications - by brian - 09-19-2016, 06:24 PM
Common Modifications - by plb - 09-19-2016, 07:15 PM
Common Modifications - by brian - 09-19-2016, 07:33 PM
Common Modifications - by plb - 09-20-2016, 02:47 AM
Common Modifications - by brian - 09-20-2016, 12:31 PM
Common Modifications - by brian - 09-22-2016, 05:59 PM
Common Modifications - by plb - 09-22-2016, 07:52 PM
Common Modifications - by brian - 09-22-2016, 08:09 PM
Common Modifications - by plb - 09-23-2016, 10:57 AM
Common Modifications - by brian - 09-23-2016, 11:01 AM
Common Modifications - by plb - 09-23-2016, 11:22 AM
Common Modifications - by brian - 09-23-2016, 11:26 AM
Common Modifications - by plb - 09-27-2016, 05:50 AM
Common Modifications - by plb - 09-27-2016, 05:54 AM
Common Modifications - by brian - 09-27-2016, 11:26 AM
Common Modifications - by brian - 09-27-2016, 11:28 AM
Common Modifications - by mudmin - 09-27-2016, 11:40 AM
Common Modifications - by plb - 09-27-2016, 11:57 AM
Common Modifications - by brian - 09-27-2016, 11:59 AM
Common Modifications - by mudmin - 09-27-2016, 12:01 PM
Common Modifications - by plb - 09-27-2016, 12:22 PM
Common Modifications - by mudmin - 09-27-2016, 02:14 PM
Common Modifications - by mudmin - 09-27-2016, 02:14 PM
Common Modifications - by mudmin - 09-27-2016, 02:14 PM
Common Modifications - by smugwimp - 10-10-2016, 08:48 AM
Common Modifications - by mudmin - 10-10-2016, 03:18 PM
Common Modifications - by Trioxin - 01-21-2017, 09:45 AM
Common Modifications - by plb - 01-22-2017, 09:30 AM
Common Modifications - by Gandoff - 10-19-2017, 10:42 AM
Common Modifications - by Brandin - 10-21-2017, 04:25 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)