Skip to content

Commit

Permalink
[Surrey] Treat surreycpt user as if it were surreycc
Browse files Browse the repository at this point in the history
The 'surreycpt' user was experience problems because it was
the only user that didn't have a matching entry in the body
table and the OPTION_SITE_NAME config.
This caused SQL problems with offline petitions, in that
the false value being returned from cobrand_admin_is_site_user
was being treated as a string in the SQL query. Adding
surreycpt to the OPTION_SITE_NAME resolved this, but still
didn't allow offline petitions to be created because there
was no body to attach them to.

This commit fixes the problem by hardcoding a special case
that treats the surreycpt as if it were the surreycc user
within cobrand_admin_is_site_user.
  • Loading branch information
davea committed May 24, 2016
1 parent 1d52d61 commit c7c2454
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions phplib/cobrand.php
Expand Up @@ -816,8 +816,12 @@ function cobrand_rejected_petition_timeout() {
}

function cobrand_admin_is_site_user() {
global $site_group;
$sites = explode(',', OPTION_SITE_NAME);
$user = http_auth_user();
if ($site_group == 'surreycc' && $user == 'surreycpt') {
$user = 'surreycc';
}
if (preg_match('#@([^.]*)\.#', $user, $m))
$user = $m[1];
if (in_array($user, $sites))
Expand Down

0 comments on commit c7c2454

Please sign in to comment.