TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 01, 2024, 05:47:31 PM

Login with username, password and session length
Members
  • Total Members: 3,881
  • Latest: fords8
Stats
  • Total Posts: 195,080
  • Total Topics: 21,209
  • Online today: 84
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 83
  • Total: 83

A few questions

Started by [chrisB], January 03, 2023, 09:05:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tino

Quote from: @rjen on January 28, 2023, 07:32:04 PM
@tino, did I formulate this correctly?

QuoteOk, coming back to the original question....

As it seems there is a small bug with the 'Admin can see all blocks' setting in 2.2.2 that we will address in 2.3.0.

BUT, the fix will NOT do what you want exactly: it will make the setting 'Admin can see all bocks' behave consistently for all blocks, the way it was originally designed.

The expected behaviour is this:

If a user has de Administrator as primary membergroup, this user will by default see ALL active TinyPortal blocks. The setting 'Admin can see all blocks' in TinyPortal can be used to suppress ALL blocks completely to Administrators.

If you have the requirement to have an administrator user see only the blocks assigned to a certain membergroup, you will have to maintain the member permissions differently:
1. Assign the user to a primary membergroup that is NOT administrator,
2. Assign the user to the administrator as an additional membergroup, and any additional membergroups that you find applicable
3. Then disable the 'admin can see all blocks' setting

With this setup you will achieve what you desired: a user with administrator priviliges that will not see alle blocks, but only those that are visisible to his own membergroup(s).

Expected behaviour is;

Admin can see all blocks (Set) - See All Blocks
Admin can see all blocks (Not-Set) - See Blocks if you are part of another member group which can see the block.

The other change is now if you are part of a member group which can see the block even if your primary membergroup can't you will still see the blocks.

@rjen

With this setting I get...

43344444444444444443344444

Mind you: I have many more blocks active, that I was not testing with. Now with only 6 blocks (3 in front panel, and 3 left)

433433
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Ok, the output from this please


public function getBlockPermissions( ) {{{
        global $context, $user_info;

        $blocks = array();
        $user   = $user_info['groups'];
        $activeBlocks = $this->getActiveBlocks();
        foreach($activeBlocks as $block) {
            // Check group access
            if(allowedTo('tp_blocks') && (!empty($context['TPortal']['admin_showblocks']) || !isset($context['TPortal']['admin_showblocks']))) {
                echo '1';
            }
            else if(!isset($block['access'])) {
                echo '2';
                continue;
            }
            else if(isset($block['access']) && (strpos($block['access'],',') === false) && (empty(array_intersect(array($block['access']), $user))) ) {
                echo '3';
var_dump($user);
var_dump($block['access']);
                continue;
            }
            else if(empty(array_intersect($user, explode(',', $block['access'])))) {
                echo '4';
var_dump($user);
var_dump($block['access']);
                continue;
            }

            // check page settings
            $display = explode(',', $block['display']);
            if( $this->checkDisplayBlock( $display ) !== TRUE ) {
                echo '5';
                continue;
            }

            $blocks[] = $block;
        }

        return $blocks;

    }}}

@rjen

#63
4 array(2) { [0]=> int(1) [1]=> int(10) } string(42) "-1,0,3,11,12,13,14,15,16,17,18,19,20,21,22"

3 array(2) { [0]=> int(1) [1]=> int(10) } string(1) "0"
3 array(2) { [0]=> int(1) [1]=> int(10) } string(0) ""
4 array(2) { [0]=> int(1) [1]=> int(10) } string(42) "-1,0,3,11,12,13,14,15,16,17,18,19,20,21,22"

3 array(2) { [0]=> int(1) [1]=> int(10) } string(1) "0"
3 array(2) { [0]=> int(1) [1]=> int(10) } string(0) ""

Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Edited your block so I could see it easier.

That's working correctly as your user isn't part of group 0 for some reason. I don't know what your group 10 is, but that seems to be the secondary group.

@rjen

Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

The primary group is 1 (administrator)

No additional groups..

Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Quote from: @rjen on January 28, 2023, 08:22:49 PM
The primary group is 1 (administrator)

No additional groups..

You have post ranking set don't you? As I have just changed my post count for my admin user and it's no longer 0 as the secondary group.

@rjen

That is active, yes.

10 is the post-based group.

Mind you: the post based groups are not part of the block permissions, so they should not really play a part here, right?
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Then this is working as expected. As the primary group is admin 1, the secondary is a post based group, it also mirrors for me how the front panel works.