本文整理汇总了PHP中AuthManager类的典型用法代码示例。如果您正苦于以下问题:PHP AuthManager类的具体用法?PHP AuthManager怎么用?PHP AuthManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AuthManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createInfoPage
function createInfoPage($title, $federation = -1)
{
$infopage = $this->myWriter->getCurrentSheet();
$name = _utf("Information");
$infopage->setName($this->normalizeSheetName($name));
// titulo
$this->myWriter->addRowsWithStyle([[$title], [""]], $this->titleStyle);
// en caso de estar definido, informacion de Prueba, jornada, y en su caso federacion
if ($this->prueba != null) {
$this->myWriter->addRowWithStyle([_utf("Contest") . ":", $this->prueba['Nombre']], $this->rowHeaderStyle);
}
if ($this->jornada != null) {
$this->myWriter->addRowWithStyle([_utf("Journey") . ":", $this->jornada['Nombre']], $this->rowHeaderStyle);
}
if ($federation >= 0) {
$fed = Federations::getFederation(intval($federation));
if ($fed == null) {
$this->myLogger->trace("Invalid federation ID:{$federation}");
} else {
$this->myWriter->addRowWithStyle([_utf("Federation") . ":", $fed->get('Name')], $this->rowHeaderStyle);
$this->federation = $fed;
}
}
// informacion de la aplicacion
$this->myWriter->addRows([[""], [_utf("Program info")], ["Application: ", $this->myConfig->getEnv("program_name")], ["Version:", $this->myConfig->getEnv("version_name")], ["Revision:", $this->myConfig->getEnv("version_date")]]);
// informacion de licencia
$am = new AuthManager($this->myFile);
$ainfo = $am->getRegistrationInfo();
$this->myWriter->addRows([[""], [_utf("License Info")], ["Serial Number:", $ainfo["Serial"]], ["User:", $ainfo["User"]], ["Club:", $ainfo["Club"]]]);
}
开发者ID:nedy13,项目名称:AgilityContest,代码行数:30,代码来源:common_writer.php
示例2: reset
/**
* Метод сбрасывает информацию по пользователю (вызывается после изменения пользователя).
*/
public final function reset($userId)
{
$userId = AuthManager::validateUserId($userId);
$this->CACHE->set($userId, null);
$this->LOGGER->info('Reseting user: ' . $userId);
return $userId;
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:10,代码来源:UserBatchLoadBean.php
示例3: getCurrentUserEvents
/**
* Метод загружает события по переданному пользователю. Все эти события могут отражаться в маленьком личном кабинете пользователя.
*
* @param PsUser $user
*/
public function getCurrentUserEvents()
{
$events = array();
if (AuthManager::isAuthorized()) {
$this->profilerStart(__FUNCTION__);
try {
$this->LOGGER->info(' >> Запрошен список события для текущего пользователя');
//Мы должны пробежаться по офисным страницам пользователя, которые поддерживают состояния, и запросить эти состояния
foreach ($this->getUserAcessibleClassInstsFromList(self::LIST_OFFICE) as $office) {
if (!$office instanceof NumerableOfficePage) {
continue;
}
$state = $office->getNumericState();
if ($state) {
$events[$office->getIdent()] = $state;
}
}
$this->LOGGER->info(' << Список событий успешно загружен: ' . array_to_string($events, false));
} catch (Exception $ex) {
$this->LOGGER->info('Произошла ошибка: ' . $ex->getMessage());
$this->profilerStop(false);
throw $ex;
}
$this->profilerStop();
}
return $events;
}
开发者ID:ilivanoff,项目名称:www,代码行数:32,代码来源:IdentPagesManager.php
示例4: smarty_modifier_post_meta
function smarty_modifier_post_meta(PostContentProvider $postCP, $news = false)
{
$post = $postCP->getPost();
$postId = $post->getId();
$type = $post->getPostType();
$pp = Handlers::getInstance()->getPostsProcessorByPostType($type);
$rp = Handlers::getInstance()->getRubricsProcessorByPostType($type, false);
$trStateToggle = null;
$rubHref = null;
$commentsHref = null;
$name = null;
if ($news) {
$name = $post->getName();
$name = "<span class=\"name\">{$name}</span>";
}
if (!$news && $post->getPostType() == POST_TYPE_TRAINING && AuthManager::isAuthorized()) {
$trStateToggle = '<a href="#' . $postId . '" title="Изменить состояние урока" class="toggle">Пройден</a>';
}
$rubHref = $rp ? $rp->rubricHref($post->getRubricId(), null, 'rubric') : null;
// if (!$news) {
$commentsCnt = $post->getCommentsCount();
$commentsHref = $pp->postHref($post, "Комментариев: {$commentsCnt}", 'comments', array('class' => 'commentcount'));
// }
if ($name || $trStateToggle || $rubHref || $commentsHref) {
echo '<div class="post_meta">';
echo "{$name} {$trStateToggle} {$rubHref} {$commentsHref}";
echo '</div>';
}
}
开发者ID:ilivanoff,项目名称:www,代码行数:29,代码来源:modifier.post_meta.php
示例5: executeImpl
protected function executeImpl(ArrayAdapter $params)
{
$url = $params->str('url');
$text = $params->str('text');
$note = $params->str('note');
if (!$url || !$text) {
return 'Не передан url или текст';
}
/*
* Если пользователь не просматривал эту страницу и это не администратор - игнорируем.
*/
/*
$wasOpened = PageOpenWatcher::isPageOpenedByUser($url, PsUser::instOrNull());
if (!$wasOpened && !AuthManager::isAuthorizedAsAdmin()) {
return 'Пользователь не открывал страницу'; //---
}
*/
$text = UserInputTools::safeShortText($text);
$note = $note ? UserInputTools::safeLongText($note) : $note;
$saved = UtilsBean::inst()->saveMisprint($url, $text, $note, AuthManager::getUserIdOrNull());
if (!$saved) {
return 'Запись не была сохранена';
//---
}
return new AjaxSuccess();
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:26,代码来源:Misprint.php
示例6: processImpl
protected function processImpl(PostArrayAdapter $adapter, $button)
{
$pass = $adapter->str(FORM_PARAM_REG_PASS);
$passConfirm = $adapter->str(FORM_PARAM_REG_PASS_CONF);
$error = UserInputValidator::validatePass($pass, $passConfirm);
if ($error) {
return array(FORM_PARAM_REG_PASS => $error);
}
$error = UserInputValidator::validatePassConfirm($pass, $passConfirm);
if ($error) {
return array(FORM_PARAM_REG_PASS_CONF => $error);
}
/*
* Код
*/
$code = $adapter->str(REMIND_CODE_PARAM);
if (!$code) {
return 'Не передан код восстановления';
}
$user = PassRecoverManager::changePassWithCode($code, $pass);
if ($user instanceof PsUser) {
$authed = AuthManager::loginUser($user->getEmail(), $pass);
if ($authed) {
return new AjaxSuccess();
} else {
return 'Не удалось авторизоваться после смены пароля';
}
} else {
//Описание - почему код не может быть использован
return $user;
}
}
开发者ID:ilivanoff,项目名称:www,代码行数:32,代码来源:RecoverUseCodeForm.php
示例7: getCurrentDateTimeZone
/** @return DateTimeZone */
public function getCurrentDateTimeZone()
{
if (!isset($this->curTZ)) {
$tzName = AuthManager::isAuthorized() ? PsUser::inst()->getTimezone() : null;
$this->curTZ = $tzName ? $this->getDateTimeZone($tzName) : $this->getDateTimeZone();
}
return $this->curTZ;
}
开发者ID:ilivanoff,项目名称:www,代码行数:9,代码来源:PsTimeZone.php
示例8: checkAccess
/**
* Checks permission to perform action
* @return boolean
*/
function checkAccess()
{
if (AuthManager::checkAccess($this->user, $this->sAction)) {
return true;
} else {
$this->errors[] = 'Access Denied ;)';
return false;
}
}
开发者ID:BackupTheBerlios,项目名称:nemesis-system,代码行数:13,代码来源:kernel.php
示例9: checkAccess
function checkAccess($methodName)
{
$result = true;
$securedMethods = ["getGoods", "getAdminOrder", "updateGood", "getGood", "getGoodImages", "deleteGood", "getDescriptionKeys", "getGoodsKeys", "getNextGoodCode", "uploadImagesForGood", "updatePrices", "listBooklets", "getBooklet", "saveBooklet", "deleteBooklet", "getBookletBackgrounds", "saveOrder"];
if (in_array($methodName, $securedMethods)) {
$result = isset($_SERVER['HTTPS']) && SessionManager::sessionStart() && AuthManager::isAuth();
}
return $result;
}
开发者ID:gingerP,项目名称:shop,代码行数:9,代码来源:controller-api.php
示例10: processImpl
protected function processImpl(PostArrayAdapter $adapter, $button)
{
$FEEDBACK = FeedbackManager::inst();
/*
* Тема
*/
$theme = $adapter->str(FORM_PARAM_THEME);
$error = UserInputValidator::validateShortText($theme);
if ($error) {
return array(FORM_PARAM_THEME => $error);
}
$theme = UserInputTools::safeShortText($theme);
/*
* Комментарий
*/
$text = $adapter->str(FORM_PARAM_COMMENT);
$error = UserInputValidator::validateLongText($text);
if ($error) {
return array(FORM_PARAM_COMMENT => $error);
}
$text = UserInputTools::safeLongText($text);
/*
* АВТОРИЗОВАН - пользуемся стандартным механизмом добавления сообщения в тред.
* Кодом треда, при этом, является сам пользователь.
*/
if (AuthManager::isAuthorized()) {
$msg = $FEEDBACK->saveMessage(PsUser::inst()->getId(), null, $text, $theme, PsUser::inst());
return new AjaxSuccess($FEEDBACK->buildLeaf($msg));
}
/*
* НЕ АВТОРИЗОВАН - сохраняем сообщение в таблицу анонимных пользователей.
*/
if (!AuthManager::isAuthorized()) {
/*
* Имя пользователя
*/
$name = $adapter->str(FORM_PARAM_NAME);
$error = UserInputValidator::validateShortText($name);
if ($error) {
return array(FORM_PARAM_NAME => $error);
}
$name = UserInputTools::safeShortText($name);
/*
* Контакты
*/
$contacts = $adapter->str(FORM_PARAM_REG_CONTACTS);
if ($contacts) {
$error = UserInputValidator::validateShortText($contacts, false);
if ($error) {
return array(FORM_PARAM_REG_CONTACTS => $error);
}
$contacts = UserInputTools::safeShortText($contacts);
}
$FEEDBACK->saveAnonimousFeedback($name, $contacts, $theme, $text);
return new AjaxSuccess();
}
}
开发者ID:ilivanoff,项目名称:www,代码行数:57,代码来源:FeedbackForm.php
示例11: getUserPassedLessons
public function getUserPassedLessons()
{
$result = array();
if (AuthManager::isAuthorized()) {
foreach (TRBean::inst()->getPassedLessons(AuthManager::getUserId()) as $id) {
$result["tr{$id}"] = true;
}
}
return $result;
}
开发者ID:ilivanoff,项目名称:www,代码行数:10,代码来源:TrainManager.php
示例12: login
public function login()
{
if (FORM_AdminLoginForm::getInstance()->isValid4Process()) {
$data = FORM_AdminLoginForm::getInstance()->getData();
$login = $data->getLogin();
$passwd = $data->getPassword();
AuthManager::loginAdmin($login, $passwd);
}
return AuthManager::isAuthorized();
}
开发者ID:ilivanoff,项目名称:www,代码行数:10,代码来源:AdminAuthManager.php
示例13: setUserAvatar
/**
* Назначает аватар пользователю
*
* @param int $userId - код пользователя
* @param int $avatarId - код аватара (может быть null, если мы сбрасываем аватар)
*/
public function setUserAvatar($userId, $avatarId = null)
{
//Валидируем входные параметры
$avatarId = PsCheck::intOrNull($avatarId);
$userId = AuthManager::validateUserId($userId);
if (is_integer($avatarId) && !AvatarUploader::inst()->hasUploadedFile($avatarId, $userId)) {
return false;
}
UserBean::inst()->setUserAvatar($userId, $avatarId);
return true;
}
开发者ID:ilivanoff,项目名称:www,代码行数:17,代码来源:AvatarsBean.php
示例14: getStructure
public function getStructure()
{
$cacheId = AuthManager::isAuthorized() ? 'a' : 'na' . '_structure';
$structure = PSCache::POSTS()->getFromCache($cacheId);
if (!is_array($structure)) {
PsProfiler::inst(__CLASS__)->start('Build structure');
$structure = $this->getStructureImpl()->toArray();
PsProfiler::inst(__CLASS__)->stop();
PSCache::POSTS()->saveToCache($structure, $cacheId);
}
return $structure;
}
开发者ID:ilivanoff,项目名称:www,代码行数:12,代码来源:NavigationManager.php
示例15: jsCommon
private function jsCommon()
{
$params['url'] = PsUrl::current();
$params['userId'] = AuthManager::getUserIdOrNull();
$params['isAuthorized'] = AuthManager::isAuthorized();
$params['isDOA'] = PsSettings::DEVMODE_OR_ADMIN();
$params['isLogging'] = PsSettings::DEVMODE_OR_ADMIN();
$params['currentSubmitTimeout'] = ActivityWatcher::getWaitTime();
$params['tzOffset'] = PsTimeZone::inst()->getCurrentDateTimeZone()->getOffset(new DateTime());
$params['marker'] = AuthManager::getUserSessoinMarker();
$params['foldings'] = FoldedStorage::listEntitiesRel();
return $params;
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:13,代码来源:PageBuilder.php
示例16: doProcess
protected function doProcess(PageContext $ctxt, RequestArrayAdapter $requestParams, ArrayAdapter $buildParams)
{
$this->authed = AuthManager::isAuthorizedAsAdmin();
if ($this->authed) {
$this->adminPage = AdminPagesManager::getInstance()->getCurrentPage();
} else {
if (FORM_AdminLoginForm::getInstance()->isValid4Process()) {
if (AdminAuthManager::getInstance()->login()) {
WebPages::reloadCurPage();
}
}
}
}
开发者ID:ilivanoff,项目名称:www,代码行数:13,代码来源:admin.php
示例17: doProcess
protected function doProcess(PageContext $ctxt, RequestArrayAdapter $requestParams, ArrayAdapter $buildParams)
{
$this->authed = AuthManager::isAuthorizedAsAdmin();
if ($this->authed) {
$this->adminPage = AdminPagesManager::getInstance()->getCurrentPage();
} else {
//Показываем форму авторизации админа только если используем базовый провайдер безопасности
if (PsSecurity::isBasic() && FORM_AdminLoginForm::getInstance()->isValid4Process()) {
if (AdminAuthManager::getInstance()->login()) {
PsUtil::redirectToSelf();
}
}
}
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:14,代码来源:admin.php
示例18: afficherInformationsConnexion
/**
* Afficher les informations de connexion (avec un lien pour quitter)
*
* @return string
*/
public static function afficherInformationsConnexion()
{
$auth = AuthManager::getInstance();
$authInfos = "<div id=\"boxMembre\">\n";
$authInfos .= "<div id=\"infosConnexion\">\n";
$authInfos .= "{$auth->getPrenom()} {$auth->getNom()}<br />\n";
$authInfos .= "Vous êtes {$auth->getStatut()}\n";
$authInfos .= "</div>\n";
$authInfos .= "<div id=\"quitter\">\n";
$authInfos .= "<a href=\"index.php?t=auth&a=quitter\">Quitter</a>\n";
$authInfos .= "</div>\n";
$authInfos .= "</div>\n";
return $authInfos;
}
开发者ID:Badacadabra,项目名称:Mini-journal,代码行数:19,代码来源:AuthHtml.class.php
示例19: testAbstractAuthenticationProvider
public function testAbstractAuthenticationProvider()
{
$provider = $this->getMockForAbstractClass(AbstractAuthenticationProvider::class);
$providerPriv = \TestingAccessWrapper::newFromObject($provider);
$obj = $this->getMockForAbstractClass('Psr\\Log\\LoggerInterface');
$provider->setLogger($obj);
$this->assertSame($obj, $providerPriv->logger, 'setLogger');
$obj = AuthManager::singleton();
$provider->setManager($obj);
$this->assertSame($obj, $providerPriv->manager, 'setManager');
$obj = $this->getMockForAbstractClass('Config');
$provider->setConfig($obj);
$this->assertSame($obj, $providerPriv->config, 'setConfig');
$this->assertType('string', $provider->getUniqueId(), 'getUniqueId');
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:15,代码来源:AbstractAuthenticationProviderTest.php
示例20: saveGallery
/**
* Сохранение картинок галлерей в БД
*/
public function saveGallery($gallery, $name, array $images)
{
AuthManager::checkAdminAccess();
$cnt = $this->getCnt('select count(1) as cnt from ps_gallery where v_dir=?', $gallery);
if ($cnt == 0) {
$this->insert('insert into ps_gallery (v_dir, v_name) VALUES (?, ?)', array($gallery, $name));
} else {
$this->update('update ps_gallery set v_name=? where v_dir=?', array($name, $gallery));
}
$this->update('delete from ps_gallery_images where v_dir=?', $gallery);
$order = 0;
foreach ($images as $img) {
$this->saveImg($gallery, $img, ++$order);
}
}
开发者ID:ilivanoff,项目名称:www,代码行数:18,代码来源:GalleryBean.php
注:本文中的AuthManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论