vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Permission for specific Usergroup (https://vborg.vbsupport.ru/showthread.php?t=319424)

TheAdminMarket 07-10-2015 02:10 PM

Permission for specific Usergroup
 
Hello,

Does anybody knows the syntax to get a specific permission for a specific usergroup (not for the active user).

eg the code below returns True/False for the Permission "Vote" in "Gallery" for the active user.
PHP Code:

if ($permissions['gallery'] & $vbulletin->bf_ugp['gallery']['vote'])
{
     echo 
'Yes';
} else {
     echo 
'No';


I want the same but (eg) for Usergroupid 12

Thank you

MarkFL 07-10-2015 02:28 PM

Have you tried looking at the array:

PHP Code:

$vbulletin->usergroupcache[12


TheAdminMarket 07-10-2015 02:46 PM

Quote:

Originally Posted by MarkFL (Post 2549849)
Have you tried looking at the array:

PHP Code:

$vbulletin->usergroupcache[12


Yes but it show the same value that I can retrieve from the database eg gallery => 3
I think that is something about "unserialize" but don't remember it. Have used it 5 years ago. Long time to remember it.

MarkFL 07-10-2015 02:54 PM

Quote:

Originally Posted by NickTheGreek (Post 2549855)
Yes but it show the same value that I can retrieve from the database eg gallery => 3
I think that is something about "unserialize" but don't remember it. Have used it 5 years ago. Long time to remember it.

Ah, okay...I wish I could help further but I have never "unserialized" the numeric permissions values to get a particular sub-permission.

Hopefully someone here knows, as I would also be interested in knowing how that works. :D

TheAdminMarket 07-10-2015 03:03 PM

Quote:

Originally Posted by MarkFL (Post 2549857)
Ah, okay...I wish I could help further but I have never "unserialized" the numeric permissions values to get a particular sub-permission.

Hopefully someone here knows, as I would also be interested in knowing how that works. :D

Anyway thank you :)

kh99 07-10-2015 06:25 PM

They're bitfields, not serialized values, so if you have the permission number for a group (and it could very well be 3), then you can check it by using
PHP Code:

if ($vbulletin->usergroupcache[12]['gallery'] & $vbulletin->bf_ugp['gallery']['vote'])
{
   
// they have vote permission



I don't know if $vbulletin->usergroupcache[12]['gallery'] is right or not. It's not clear from what's posted above.

TheAdminMarket 07-10-2015 06:35 PM

Quote:

Originally Posted by kh99 (Post 2549874)
They're bitfields, not serialized values, so if you have the permission number for a group (and it could very well be 3), then you can check it by using
PHP Code:

if ($vbulletin->usergroupcache[12]['gallery'] & $vbulletin->bf_ugp['gallery']['vote'])
{
   
// they have vote permission



I don't know if $vbulletin->usergroupcache[12]['gallery'] is right or not. It's not clear from what's posted above.

Works !! Thank you.


All times are GMT. The time now is 06:00 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01110 seconds
  • Memory Usage 1,736KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete