当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthUser::hasPermission方法代码示例

本文整理汇总了PHP中AuthUser::hasPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthUser::hasPermission方法的具体用法?PHP AuthUser::hasPermission怎么用?PHP AuthUser::hasPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AuthUser的用法示例。


在下文中一共展示了AuthUser::hasPermission方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deactivate_plugin

 function deactivate_plugin($plugin)
 {
     if (!AuthUser::hasPermission('administrator')) {
         Flash::set('error', __('You do not have permission to access the requested page!'));
         redirect(get_url());
     }
     Plugin::deactivate($plugin);
 }
开发者ID:albertobraschi,项目名称:toad,代码行数:8,代码来源:SettingController.php

示例2: _checkPermission

 public static function _checkPermission()
 {
     AuthUser::load();
     if (!AuthUser::isLoggedIn()) {
         redirect(get_url('login'));
     } else {
         if (!AuthUser::hasPermission('administrator,developer,editor')) {
             //             Flash::set('error', __('You do not have permission to access the requested page!'));
             //             redirect(get_url());
         }
     }
 }
开发者ID:sindotnet,项目名称:tiigo,代码行数:12,代码来源:AboutController.php

示例3: __construct

 function __construct()
 {
     AuthUser::load();
     if (!AuthUser::isLoggedIn()) {
         redirect(get_url('login'));
     }
     if (!AuthUser::hasPermission('admin_view')) {
         redirect(URL_PUBLIC);
     }
     $this->setLayout('backend');
     $this->assignToLayout('sidebar', new View('../../plugins/funky_cache/views/sidebar'));
 }
开发者ID:bomura,项目名称:funky_cache,代码行数:12,代码来源:FunkyCacheController.php

示例4: __construct

 function __construct()
 {
     AuthUser::load();
     if (!AuthUser::isLoggedIn()) {
         redirect(get_url('login'));
     } else {
         if (!AuthUser::hasPermission('administrator') && !AuthUser::hasPermission('developer')) {
             Flash::set('error', __('You do not have permission to access the requested page!'));
             redirect(get_url());
         }
     }
     $this->setLayout('backend');
     $this->assignToLayout('sidebar', new View('layout/sidebar'));
 }
开发者ID:albertobraschi,项目名称:toad,代码行数:14,代码来源:LayoutController.php

示例5: _checkPermission

 /**
  * Used to check generic permissions for entire the controller.
  */
 private static final function _checkPermission()
 {
     AuthUser::load();
     if (!AuthUser::isLoggedIn()) {
         redirect(get_url('login'));
     } else {
         if (!AuthUser::hasPermission('admin_edit')) {
             Flash::set('error', __('You do not have permission to access the requested page!'));
             if (Setting::get('default_tab') === 'setting') {
                 redirect(get_url('page'));
             } else {
                 redirect(get_url());
             }
         }
     }
 }
开发者ID:sindotnet,项目名称:cona,代码行数:19,代码来源:SettingController.php

示例6: __construct

 function __construct()
 {
     AuthUser::load();
     if (!AuthUser::isLoggedIn()) {
         redirect(get_url('login'));
     } else {
         if (!AuthUser::hasPermission('layout_view')) {
             Flash::set('error', __('You do not have permission to access the requested page!'));
             if (Setting::get('default_tab') === 'layout') {
                 redirect(get_url('page'));
             } else {
                 redirect(get_url());
             }
         }
     }
     $this->setLayout('backend');
     $this->assignToLayout('sidebar', new View('layout/sidebar'));
 }
开发者ID:ariksavage,项目名称:superior-optical-eyewear,代码行数:18,代码来源:LayoutController.php

示例7: image_resize_try_resizing

/**
 * Execute this function on page_not_found.
 * If the request is for an image file,
 * resize the image.
 */
function image_resize_try_resizing()
{
    // Require that visitor be logged in and has
    // permission to create files
    if (!AuthUser::isLoggedIn()) {
        AuthUser::load();
    }
    if (!AuthUser::hasPermission('administrator,developer,editor')) {
        return false;
    }
    // Check that gd library is available
    if (!ImageResize::gd_available()) {
        return false;
    }
    if (preg_match('#\\.(jpe?g|gif|png|wbmp)$#i', CURRENT_URI)) {
        // If requested file appears to be an accepted format, create the new image
        if (image_resize_scale(CURRENT_URI) && !DEBUG) {
            // If Frog isn't debugging, it writes to a file; redirect to it
            header('Location: ' . URL_PUBLIC . "/" . CURRENT_URI);
            // Exit here to prevent a page not found message
            exit;
        }
    }
}
开发者ID:naehrstoff,项目名称:image_resize,代码行数:29,代码来源:index.php

示例8: get_url

    echo get_url('snippet/edit/' . $snippet->id);
    ?>
"><?php 
    echo $snippet->name;
    ?>
</a>
    <img class="handle" src="<?php 
    echo PATH_PUBLIC;
    ?>
wolf/admin/images/drag.gif" alt="<?php 
    echo __('Drag and Drop');
    ?>
" align="middle" />
    <div class="remove">
        <?php 
    if (AuthUser::hasPermission('snippet_delete')) {
        ?>
        
            <a class="remove" href="<?php 
        echo get_url('snippet/delete/' . $snippet->id);
        ?>
" onclick="return confirm('<?php 
        echo __('Are you sure you wish to delete?');
        ?>
 <?php 
        echo $snippet->name;
        ?>
?');"><img src="<?php 
        echo PATH_PUBLIC;
        ?>
wolf/admin/images/icon-remove.gif" alt="<?php 
开发者ID:ariksavage,项目名称:superior-optical-eyewear,代码行数:31,代码来源:index.php

示例9: __

    echo __('on');
    ?>
 <?php 
    echo date('D, j M Y', strtotime($snippet->updated_on));
    ?>
</small>
                </p>
                <?php 
}
?>
            </div>
        </div>
    </div>
    <p class="buttons">
        <?php 
if ($action == 'edit' && AuthUser::hasPermission('snippet_edit') || $action == 'add' && AuthUser::hasPermission('snippet_add')) {
    ?>
            <input class="button" name="commit" type="submit" accesskey="s" value="<?php 
    echo __('Save');
    ?>
" />
            <input class="button" name="continue" type="submit" accesskey="e" value="<?php 
    echo __('Save and Continue Editing');
    ?>
" />
            <?php 
    echo __('or');
    ?>
 
        <?php 
} else {
开发者ID:ariksavage,项目名称:superior-optical-eyewear,代码行数:31,代码来源:edit.php

示例10: __checkPermission

	private static function __checkPermission($permission='facts_view') {
		AuthUser::load();
		if ( ! AuthUser::isLoggedIn()) {
			redirect(get_url('login'));
		}
		if ( ! AuthUser::hasPermission($permission) ) {
			Flash::set('error', __('You do not have permission to access the requested page!'));
			if (! AuthUser::hasPermission('facts_view') ) redirect(get_url());
			else redirect(get_url('plugin/facts'));
		}
	}//*/
开发者ID:realslacker,项目名称:Facts-Plugin,代码行数:11,代码来源:FactsController.php

示例11: delete

 /**
  * Deletes a Snippet.
  *
  * @param string $id Snippet id
  */
 public function delete($id)
 {
     if (!AuthUser::hasPermission('snippet_delete')) {
         Flash::set('error', __('You do not have permission to delete snippets!'));
         redirect(get_url('snippet'));
     }
     // find the user to delete
     if ($snippet = Record::findByIdFrom('Snippet', $id)) {
         if ($snippet->delete()) {
             Flash::set('success', __('Snippet :name has been deleted!', array(':name' => $snippet->name)));
             Observer::notify('snippet_after_delete', $snippet);
         } else {
             Flash::set('error', __('Snippet :name has not been deleted!', array(':name' => $snippet->name)));
         }
     } else {
         Flash::set('error', __('Snippet not found!'));
     }
     redirect(get_url('snippet'));
 }
开发者ID:ariksavage,项目名称:superior-optical-eyewear,代码行数:24,代码来源:SnippetController.php

示例12: get_url

      <div class="modify">
        <a href="<?php 
    echo get_url('page/add', $child->id);
    ?>
"><img src="<?php 
    echo URI_PUBLIC . CORE_FOLDER;
    ?>
/admin/images/plus.png" align="middle" title="<?php 
    echo __('Add child');
    ?>
" alt="<?php 
    echo __('Add child');
    ?>
" /></a>&nbsp;
<?php 
    if (!$child->is_protected || AuthUser::hasPermission('administrator') || AuthUser::hasPermission('developer')) {
        ?>
        <a class="remove" href="<?php 
        echo get_url('page/delete/' . $child->id);
        ?>
" onclick="return confirm('<?php 
        echo __('Are you sure you wish to delete');
        ?>
 <?php 
        echo $child->title;
        ?>
 <?php 
        echo __('and its underlying pages');
        ?>
?');"><img src="<?php 
        echo URI_PUBLIC . CORE_FOLDER;
开发者ID:julpi,项目名称:FreshCMS,代码行数:31,代码来源:children.php

示例13: delete

 public function delete($id)
 {
     if (!AuthUser::hasPermission('user_delete')) {
         Flash::set('error', __('You do not have permission to access the requested page!'));
         redirect(get_url());
     }
     // Sanity checks
     use_helper('Validate');
     if (!Validate::numeric($id)) {
         Flash::set('error', __('Invalid input found!'));
         redirect(get_url());
     }
     // CSRF checks
     if (isset($_GET['csrf_token'])) {
         $csrf_token = $_GET['csrf_token'];
         if (!SecureToken::validateToken($csrf_token, BASE_URL . 'user/delete/' . $id)) {
             Flash::set('error', __('Invalid CSRF token found!'));
             redirect(get_url('user'));
         }
     } else {
         Flash::set('error', __('No CSRF token found!'));
         redirect(get_url('user'));
     }
     // security (dont delete the first admin)
     if ($id > 1) {
         // find the user to delete
         if ($user = Record::findByIdFrom('User', $id)) {
             if ($user->delete()) {
                 Flash::set('success', __('User <strong>:name</strong> has been deleted!', array(':name' => $user->name)));
                 Observer::notify('user_after_delete', $user->name);
             } else {
                 Flash::set('error', __('User <strong>:name</strong> has not been deleted!', array(':name' => $user->name)));
             }
         } else {
             Flash::set('error', __('User not found!'));
         }
     } else {
         Flash::set('error', __('Action disabled!'));
     }
     redirect(get_url('user'));
 }
开发者ID:sindotnet,项目名称:cona,代码行数:41,代码来源:UserController.php

示例14: __

if ($action == 'edit') {
    echo __('Leave password blank for it to remain unchanged.');
}
?>
</td>
    </tr>
    <tr>
      <td class="label"><label for="user_confirm"><?php 
echo __('Confirm Password');
?>
</label></td>

      <td class="field"><input class="textbox" id="user_confirm" maxlength="40" name="user[confirm]" size="40" type="password" value="" /></td>
    </tr>
<?php 
if (AuthUser::hasPermission('administrator')) {
    ?>
 
    <tr>
      <td class="label"><?php 
    echo __('Roles');
    ?>
</td>
      <td class="field">
<?php 
    $user_permissions = $user instanceof User ? $user->getPermissions() : array('editor');
    foreach ($permissions as $perm) {
        ?>
        <span class="checkbox"><input<?php 
        if (in_array($perm->name, $user_permissions)) {
            echo ' checked="checked"';
开发者ID:albertobraschi,项目名称:toad,代码行数:31,代码来源:edit.php

示例15: __

  </table>

<?php 
Observer::notify('user_edit_view_after_details', $user);
?>

  <p class="buttons">
    <input class="button" name="commit" type="submit" accesskey="s" value="<?php 
echo __('Save');
?>
" />
    <?php 
echo __('or');
?>
 <a href="<?php 
echo AuthUser::hasPermission('administrator') ? get_url('user') : get_url();
?>
"><?php 
echo __('Cancel');
?>
</a>
  </p>

</form>

<script type="text/javascript">
// <![CDATA[
    function setConfirmUnload(on, msg) {
        window.onbeforeunload = (on) ? unloadMessage : null;
        return true;
    }
开发者ID:julpi,项目名称:FreshCMS,代码行数:31,代码来源:edit.php


注:本文中的AuthUser::hasPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。