Announcement

Collapse
No announcement yet.

Problems with setting permissions of a mod

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lynne
    replied
    Help with modifications is only given in the modification thread.

    Leave a comment:


  • sz1
    started a topic Problems with setting permissions of a mod

    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.

    Click image for larger version

Name:	permissions.jpg
Views:	1
Size:	81.4 KB
ID:	3723185


    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 ;(
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X