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
US4 Include Classes
#22
I know that this is kind of sacrilegious because I spent all this time building UserSpice but sometimes it's easier to NOT use the built in permission system when you're making a ton of pages.

Sometimes you want to base whether or not someone can access a page based on some sort of weird parameter. Like, for instance, on the project I'm working on, I'm passing a get variable to edit a student's profile. I want to check if the student belongs to that actual teacher's class before I let them edit it, so I do a little check like...

Code:
<?php if($class != $student->class){die("Sorry, this student is not yours! You can't edit this profile!");} ?>

In that case, there's no reason to even have the UserSpice permissions in there because I'm getting $class by
Code:
$class = $user->data()->id;
from UserSpice.

So, in other words, if that teacher's id doesn't match the one on the student, they're not editing that profile no matter what. Basically I'm using UserSpice, but skipping all the other permission stuff and locking that entire group of students to that one teacher id and you can forget page permissions and user groups entirely.
  Reply


Messages In This Thread
US4 Include Classes - by brian - 02-24-2016, 09:44 PM
US4 Include Classes - by brian - 02-24-2016, 10:10 PM
US4 Include Classes - by mudmin - 02-24-2016, 11:09 PM
US4 Include Classes - by brian - 02-25-2016, 01:23 PM
US4 Include Classes - by brian - 02-25-2016, 01:27 PM
US4 Include Classes - by mudmin - 02-25-2016, 02:13 PM
US4 Include Classes - by brian - 02-25-2016, 02:43 PM
US4 Include Classes - by mudmin - 02-25-2016, 04:02 PM
US4 Include Classes - by brian - 02-25-2016, 04:22 PM
US4 Include Classes - by mudmin - 02-25-2016, 04:56 PM
US4 Include Classes - by mudmin - 02-25-2016, 05:27 PM
US4 Include Classes - by brian - 02-25-2016, 05:58 PM
US4 Include Classes - by mudmin - 02-25-2016, 06:14 PM
US4 Include Classes - by mudmin - 02-25-2016, 11:09 PM
US4 Include Classes - by brian - 02-26-2016, 01:20 PM
US4 Include Classes - by brian - 02-26-2016, 01:41 PM
US4 Include Classes - by mudmin - 02-26-2016, 01:57 PM
US4 Include Classes - by brian - 02-26-2016, 02:05 PM
US4 Include Classes - by brian - 02-26-2016, 02:12 PM
US4 Include Classes - by mudmin - 02-26-2016, 05:54 PM
US4 Include Classes - by brian - 02-26-2016, 05:56 PM
US4 Include Classes - by mudmin - 02-26-2016, 06:42 PM
US4 Include Classes - by brian - 02-26-2016, 06:48 PM
US4 Include Classes - by Popkultur - 04-22-2017, 11:17 AM
US4 Include Classes - by mudmin - 04-23-2017, 01:53 PM
US4 Include Classes - by bladerunner - 12-14-2017, 11:57 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)