Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Adams committed Mar 15, 2017
2 parents 81ac6b2 + 9079a26 commit 8650a3c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions modules/base/classes/serviceUser.php
Expand Up @@ -300,8 +300,8 @@ public function isAdmin() {
}

public function isAnonymousUser() {
$role = $this->getRole();
if ( ! $this->user->get('user_id') && $this->getRole() === 'everyone') {

if ( ! $this->user->get('user_id') || $this->getRole() === 'everyone') {
return true;
} else {
return false;
Expand Down
4 changes: 1 addition & 3 deletions owa_controller.php
Expand Up @@ -570,15 +570,13 @@ protected function getSitesAllowedForCurrentUser() {
owa_coreAPI::debug('get Sites Allowed for user');
$currentUser = owa_coreAPI::getCurrentUser();

if ( $currentUser->isAnonymousUser() || $currentUser->isAdmin() ) {
if ( $currentUser->isAnonymousUser() || $currentUser->isAdmin() ) {
$result = array();
$relations = owa_coreAPI::getSitesList();

foreach ($relations as $siteRow) {

$site = owa_coreAPI::entityFactory('base.site');
owa_coreAPI::debug('getSitesAllowedforuser');

$site->load($siteRow['id']);
$result[$siteRow['site_id']] = $site;
}
Expand Down
6 changes: 4 additions & 2 deletions owa_coreAPI.php
Expand Up @@ -1336,8 +1336,10 @@ public static function createNonce($action) {

$time = owa_coreAPI::getNonceTimeInterval();
$cu = owa_coreAPI::getCurrentUser();
$user_id = $cu->getUserData( 'user_id' );
$user_id = $cu->getUserData( 'user_id' );

$full_nonce = $time . $action . $user_id . 'owa_nonce';

$nonce = substr( owa_coreAPI::saltedHash($full_nonce, 'nonce'), -12, 10);

return $nonce;
Expand Down Expand Up @@ -1372,7 +1374,7 @@ public static function getSalt( $scheme ) {
continue;
} else {

$cached_salts[ $scheme.'_'.$s ] = constant("$const");
$cached_salts[ $f.'_'.$s ] = constant("$const");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion owa_template.php
Expand Up @@ -493,7 +493,7 @@ function makeLink($params = array(), $add_state = false, $url = '', $xml = false
}

// add nonce if called for
if ($add_nonce) {
if ($add_nonce) {
if ( array_key_exists('do', $all_params) ) {
$action = $all_params['do'];
} elseif ( array_key_exists('action', $all_params) ) {
Expand Down

0 comments on commit 8650a3c

Please sign in to comment.