Bug #59813

[usergroup] BE condition in TSconfig not working

Added by Martin Wiederkehr almost 5 years ago. Updated 8 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
Start date:
2014-06-23
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

Having troubles with the [usergroup] BE condition in TSconfig as it's not working at all. I have analyzed the code a bit and found out that the $groupList string in the ConditionMatcher.php is always empty, therefore the if clause is never true

typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php

$groupList = $this->getGroupList(); return "" (Line 63)

Nevertheless, [usergroup = *] is still working as it's no releated to $groupList (Line 66)

A bit of more debuging shows, that the $this->userGroupsUID array is already empty

typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php

$this->groupList = implode(',', $this->userGroupsUID); (Line 1425)

I quit analyzing there as the whole fetchGroupData function is really complex.

Associated revisions

Revision d7a2a8ac (diff)
Added by Markus Klein almost 5 years ago

[BUGFIX] Fix usergroup condition in user TSconfig

usergroup conditions in user TSconfig are currently failing as
the list of groups the user is part of, is not yet compiled when
the TSconfig is evaluated.

This can be fixed by moving the group evaluation some lines upwards,
as this does not influence the remaining code.

Resolves: #59813
Releases: 6.3, 6.2, 6.1
Change-Id: Id3189ea5cd31936bdf538e2bb163ecc2d46ed6a0
Reviewed-on: https://review.typo3.org/31114
Reviewed-by: Martin Wiederkehr
Tested-by: Martin Wiederkehr
Reviewed-by: Christoph Buchli
Tested-by: Christoph Buchli
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters

Revision 43ee6f86 (diff)
Added by Markus Klein almost 5 years ago

[BUGFIX] Fix usergroup condition in user TSconfig

usergroup conditions in user TSconfig are currently failing as
the list of groups the user is part of, is not yet compiled when
the TSconfig is evaluated.

This can be fixed by moving the group evaluation some lines upwards,
as this does not influence the remaining code.

Resolves: #59813
Releases: 6.3, 6.2, 6.1
Change-Id: Id3189ea5cd31936bdf538e2bb163ecc2d46ed6a0
Reviewed-on: https://review.typo3.org/31151
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters

Revision 5adc991b (diff)
Added by Markus Klein almost 5 years ago

[BUGFIX] Fix usergroup condition in user TSconfig

usergroup conditions in user TSconfig are currently failing as
the list of groups the user is part of, is not yet compiled when
the TSconfig is evaluated.

This can be fixed by moving the group evaluation some lines upwards,
as this does not influence the remaining code.

Resolves: #59813
Releases: 6.3, 6.2, 6.1
Change-Id: Id3189ea5cd31936bdf538e2bb163ecc2d46ed6a0
Reviewed-on: https://review.typo3.org/31152
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters

History

#1 Updated by Markus Klein almost 5 years ago

Hi!

Can you please post some sample TSconfig you've been using?

#2 Updated by Markus Klein almost 5 years ago

And can you maybe debug once more and have a look at line 1355 (on current master)

$grList = $this->db->cleanIntList($this->user[$this->usergroup_column]);

What is the value of $this->usergroup_column and $this->user?

#3 Updated by Martin Wiederkehr almost 5 years ago

Hi Markus

Hopefully this helps. Switched to master: commit 143c274496c566f80e3481050bcd54408e3fba58

UserTS in file, added with ExtensionManagementUtility::addUserTSConfig. I also checked the condition directly in the record (even it doesn't make any sence there) => same behaviour. There are more userTS values in the end, but I checked it with that sample.

options {
    clearCache {
        system = 1
    }
}

    # adminUser = 0 works fine
//[adminUser = 0]
[usergroup = 4]
options {
    clearCache {
        system = 0
    }
}
[global]

User CM [uid1]
- Default Group [uid4]
--> Subgroup 1 [uid1]
--> Subgroup 2 [uid2]

typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php: 1355

this->usergroup_column = "usergroup" 
this->user => usergroup = "4" 
this->user => usergroup_cached_list = "1,2,4" 
$grList = "4" 

typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php: 1412

this->userGroupsUID => 0 = 1; 1 = 2; 2 = 4
this->groupList = "1,2,4" 
DB: usergroup_cached_list = "1,2,4" 

typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php: 50

$string = "usergroup = 4" 
$key = "usergroup" 
$value = 4
$groupList = "" 

#4 Updated by Markus Klein almost 5 years ago

I found the reason.

The userTSconfig is evaluated before the groups are evaluated.
Evaluating now, if we can change that without side effect.

#5 Updated by Markus Klein almost 5 years ago

  • Status changed from New to Accepted
  • Complexity set to medium

#6 Updated by Gerrit Code Review almost 5 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31114

#7 Updated by Gerrit Code Review almost 5 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31151

#8 Updated by Gerrit Code Review almost 5 years ago

Patch set 1 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31152

#9 Updated by Markus Klein almost 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#10 Updated by Benni Mack 8 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF