Project

General

Profile

Actions

Bug #7341

closed

Login blocking does not function with custom usergroups

Added by krileon over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Start date:
06 November 2018
Due date:
% Done:

100%

Estimated time:

Description

If you've a custom usergroup under Registered and the user logs in with an expired subscription while free subscriptions are not allowed it will not block their login. It will if they are assigned to Registered usergroup though. Example structure as follows.

Public
- Registered
- - Custom

Registered works for this functionality while Custom does not.

https://www.joomlapolis.com/forum/277-cb-paid-subscriptions-support/240018-user-with-expired-subscription-still-able-to-login?start=12

Actions #1

Updated by krileon over 5 years ago

If the user has both Registered AND Custom the functionality also appears to fail. It only works if they have ONLY Registered.

Actions #2

Updated by beat over 5 years ago

  • Status changed from New to Assigned
  • Assignee set to beat

Issue is as follows:

It all happens in cbpaidsubscriptions::onDuringLogin() at begin calling $paidsubsManager->checkExpireMe() that calls checkUserSubscriptions().

If a user belongs to other groups that are not managed by CBSubs in a plan that is accessible to the user, then the user will be blocked (see below), but not presented with possible upgrade plans (that is a bug) because (in cbpaidUserExtension::checkUserSubscriptions() line 296):

if ( ( ! self::_allValuesOfArrayInArray( (array) $user->gids, $oldPotentialPlansGids ) )
    || in_array( $_CB_framework->acl->mapGroupNamesToValues( 'Superadministrator' ), (array) $user->gids ) )
{
    // Do not block a user that has a gid in his gids that is not controlled by a plan that was accessible to him after downgrade:
    // This avoids blocking e.g. super admins if there is no super-admin plan.
    // But also if there is a Super-admin plan by configuration error, it still should not get blocked:
    $block                                    =    0;
}

If a user does not belong to any group managed by CBSubs, it won't be blocked because in cbpaidUserExtension::checkUserSubscriptions() calling cbpaidUserExtension::_adjustUserAclBlock() checks:

if ( self::_anyValueOfArrayInArray( (array) $user->gids, $oldChldGids ) ) {

to block anything. But if "Registered" is not in the gids of the user, he will not get blocked there (and then of course with the issue above, not be presented with upgrade plans possibilites, which is expected in this case.

Actions #3

Updated by beat over 5 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Fixed in commit commit 6436fbca5eb82d148bf070b5b9c069eefbef92f3

Actions #4

Updated by beat over 5 years ago

  • Project changed from 2 to CB Paid Subscriptions
Actions #5

Updated by beat over 5 years ago

  • Target version changed from CbSubs 4.4.1 to 4.3.1
Actions

Also available in: Atom PDF