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
Suggested new function in US_helpers.php
#1
The current definition of
Code:
checkPermissions()
is somewhat special-purpose and (perhaps) obsolete.

I am suggesting a new function called
Code:
hasPermission()
which is a little more general-purpose and will change the definition of
Code:
checkPermissions()
to simply call
Code:
hasPermission()
with the appropriate parameter.

I will confess I am happy with the stability of
Code:
hasPermission()
(I have tested it) whereas I don't use
Code:
checkPermissions()
at all and so I haven't tested whether my change is backward compatible. [honesty strikes] OK, I haven't tested my definition of
Code:
checkPermission()
at all - I just typed it into the pastebin. Phew, conscience relieved. :-)

http://pastebin.com/cexD5maq

This provides a more generic way to check if a user (either the current user or someone else) has a given permission/group.
  Reply
#2
I like that. The old permission names and even what they do was somewhat setup like that for backwards compatibility, but I like having the more generic function.

Btw, technically you can still patch a usercake 2.0 project (from 2010 or something) all the way up to 4.1.4 if you're willing to do a little fiddling.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)