예제 #1
0
파일: Context.php 프로젝트: rjsmelo/tiki
 public static function setPermissionList($allperms)
 {
     $permissionList = array_keys($allperms);
     $shortPermList = array_map(function ($name) {
         return substr($name, 7);
     }, $permissionList);
     self::$permissionList = $shortPermList;
 }
예제 #2
0
파일: perms.php 프로젝트: rjsmelo/tiki
                        $smarty->assign('filename', $aFileInfos['name']);
                    }
                    $smarty->assign('email_token', $detailtoken['email']);
                    $txt = $smarty->fetch('mail/user_watch_token.tpl');
                    $mail->setHTML($txt);
                    $mailsent = $mail->send(array($not['email']));
                }
            }
        }
        if (empty($notificationPage)) {
            $notificationPage = preg_replace('/[\\?&]TOKEN=' . $token . '/', '', $_SERVER['REQUEST_URI']);
        }
        // Log each token access
        $logslib->add_log('token', $detailtoken['email'] . ' ' . tra('has accessed the following shared content:') . ' ' . $notificationPage);
    } else {
        // Error Token expired
        $token_error = tra('Your access to this page has expired');
    }
}
$allperms = $userlib->get_enabled_permissions();
Perms_Context::setPermissionList($allperms);
$builder = new Perms_Builder();
$perms = $builder->withCategories($prefs['feature_categories'] == 'y')->withDefinitions($allperms)->build();
Perms::set($perms);
$_permissionContext = new Perms_Context($user, false);
if ($groupList) {
    $_permissionContext->overrideGroups($groupList);
}
$_permissionContext->activate(true);
unset($allperms);
unset($tokenParams);
예제 #3
0
 /**
  * @return bool
  */
 function http_auth()
 {
     global $tikidomain, $user;
     $userlib = TikiLib::lib('user');
     $smarty = TikiLib::lib('smarty');
     if (!$tikidomain) {
         $tikidomain = "Default";
     }
     if (!isset($_SERVER['PHP_AUTH_USER'])) {
         header('WWW-Authenticate: Basic realm="' . $tikidomain . '"');
         header('HTTP/1.0 401 Unauthorized');
         exit;
     }
     $attempt = $_SERVER['PHP_AUTH_USER'];
     $pass = $_SERVER['PHP_AUTH_PW'];
     list($res, $rest) = $userlib->validate_user_tiki($attempt, $pass, false, false);
     if ($res == USER_VALID) {
         global $_permissionContext;
         $_permissionContext = new Perms_Context($attempt, false);
         $_permissionContext->activate(true);
         return true;
     } else {
         header('WWW-Authenticate: Basic realm="' . $tikidomain . '"');
         header('HTTP/1.0 401 Unauthorized');
         return false;
     }
 }