Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-16-2012, 06:18 AM
sz1 sz1 is offline
 
Join Date: Feb 2012
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Problems with setting permissions of a mod

Hello Community!

I have a distinct problem with the Mod DownloadsII. Before someone points me to the page of the Mod: The problem has been addressed several times in the comments and never been answered.


As I imagined


The mod has a feature to allow or prohibit specific usergroups to access selected categories of the download area (see picture). The primary user group is for all users "Registered Users" (ID 2). But when they register, users are classified further into at least one (but no more than two) additional user groups.
The group "Registered Users" has a very limited access in the DL-area. The appropriately chosen additional user groups should extend these privileges.


What the problem is


Apart of the following the mod works fine. However, the permissions are not expanded by the additional user groups. Instead, only the permissions of the primary user group (registered users) are applied. If the primary group is allowed to see category 1 and the secondary group category 2, then users who are members of both groups only see category 1.

I don?t want to avoid the problem by juggling with primary and secondary groups. The arrangement should remain as it is. However additional groups should simply expand the permissions of the primary group. A setting error is also excluded - I've checked it all several times.

I don?t know where the problem is, so I just show you the code.

CLASS_DOWNLOADSII.php
PHP Code:
[...]
function 
exclude_cat()
    {
        global 
$permissions$vbulletin;

        
// check for category permissions
        
if ($permissions['excludecatlist'] != '')
        {
            if (
$permissions['downloads2extrapermissions'] & $vbulletin->bf_ugp['downloads2extrapermissions']['excludecats'])
            if (
$permissions['downloads2permissions'] & $vbulletin->bf_ugp['downloads2permissions']['canaccessdownloads2'] = true)
            {
                
$catexclude "`id` IN (".$permissions['excludecatlist'].") AND";
            }
            else
            {
                
$catexclude "`id` NOT IN (".$permissions['excludecatlist'].") AND";
            }
        }
        else
        {
            
$catexclude '';
        }

        return 
$catexclude;
    }

    function 
exclude_files($multiple false)
    {
        global 
$permissions$vbulletin;

        
// check for category permissions
        
if ($permissions['excludecatlist'] != '')
        {
            if (
$permissions['downloads2extrapermissions'] & $vbulletin->bf_ugp['downloads2extrapermissions']['excludecats'])
            {
                
$multiply = ($multiple) ? TABLE_PREFIX 'dl2_files.' '' ;
                
$filesexclude "" $multiply "category IN (".$permissions['excludecatlist'].") AND";
            }
            else
            {
                
$multiply = ($multiple) ? TABLE_PREFIX 'dl2_files.' '' ;
                
$filesexclude "" $multiply "category NOT IN (".$permissions['excludecatlist'].") AND";
            }
        }
        else
        {
            
$filesexclude '';
        }

        return 
$filesexclude;
    }

    function 
build_cat_nav($id)
    {
        if (
$id 0)
        {
            global 
$db$vbulletin;
            
$catexclude $this->exclude_cat();
            
$cat $db->query_first("SELECT `name`, `id`, `parent` FROM " TABLE_PREFIX "dl2_categories WHERE $catexclude `id` = " $db->sql_prepare($id));
            return 
$this->build_cat_nav($cat['parent']) + array('downloads.php?' $vbulletin->session->vars['sessionurl'] . "do=cat&id=$cat[id]=> htmlspecialchars_uni($cat['name']));
        }
        else
        {
            return array();
        }
    }
[...] 

BITFIELD_DOWNLOADSII.xml
PHP Code:
[...]
<
group name="downloads2extrapermissions">
                <
bitfield name="excludecats" group="downloads2extrapermissions" phrase="dl2_exclude_cats">1</bitfield>
                <
bitfield intperm="true" name="excludecatlist" group="downloads2extrapermissions" phrase="dl2_exclude_cats_list">1</bitfield>
                <
bitfield intperm="true" name="downloadsmaxuploadtotal" group="downloads2extrapermissions" phrase="dl2_max_upload_total">1</bitfield>
                <
bitfield intperm="true" name="downloadsmaxdailydl" group="downloads2extrapermissions" phrase="dl2_max_dialydl">1</bitfield>
                <
bitfield intperm="true" name="downloadsmaxdailyfiles" group="downloads2extrapermissions" phrase="dl2_max_dl_files">1</bitfield>
                <
bitfield name="dailylimits" group="downloads2extrapermissions" phrase="dl2_daily_limits">2</bitfield>
                <
bitfield intperm="true" name="downloaddelaygrp" group="downloads2extrapermissions" phrase="dl2_delay">1</bitfield>
            </
group>
[...] 
I really hope someone can help me. It's pretty important for me that I can split the visibility and the access rights for categories of the download area.

Regards
SZ

I?m really sorry for my english ;(
Attached Images
File Type: jpg permissions.jpg (102.1 KB, 0 views)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:43 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.04481 seconds
  • Memory Usage 2,214KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete