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


PHP Authority类代码示例

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


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

示例1: json

 function json()
 {
     $this->requiring();
     $authority = new Authority();
     $authorized = $authority->authorize();
     if ($authorized !== true) {
         die('認証に失敗しました。ログインし直してください。');
     } else {
         return $this->execute();
     }
 }
开发者ID:rochefort8,项目名称:tt85,代码行数:11,代码来源:controller.php

示例2: update

 /**
  * We can override a method to add, for example, authorisation
  */
 public function update($id)
 {
     if (Authority::cannot('update', 'product', $id)) {
         return Response::json(array('message' => 'You are not allowed to update this product'), 401);
     }
     parent::update($id);
 }
开发者ID:vespakoen,项目名称:epi,代码行数:10,代码来源:ProductController.php

示例3: login

    /**
     * Logs one user on the admin panel
     *
     */
    public function login()
    {
        $default_admin_lang = Settings::get_default_admin_lang();
        // TODO :
        // - Replace by : config_item('uri_lang_code');
        // - Remove / Rewrite Settings::get_uri_lang()
        $uri_lang = Settings::get_uri_lang();
        // If the user is already logged and if he is in the correct minimum group, go to Admin
        if (User()->logged_in() && Authority::can('access', 'admin')) {
            redirect(base_url() . $uri_lang . '/' . config_item('admin_url'));
        }
        if (User()->logged_in() && !Authority::can('access', 'admin')) {
            redirect(base_url());
        }
        if (!empty($_POST)) {
            unset($_POST['submit']);
            if ($this->_try_validate_login()) {
                // User can log with email OR username
                if (strpos($_POST['username'], '@') !== FALSE) {
                    $email = $_POST['username'];
                    unset($_POST['username']);
                    $_POST['email'] = $email;
                }
                try {
                    User()->login($_POST);
                    redirect(base_url() . $uri_lang . '/' . config_item('admin_url') . '/auth/login');
                } catch (Exception $e) {
                    $this->login_errors = $e->getMessage();
                }
            } else {
                $this->login_errors = lang('ionize_login_error');
            }
        } else {
            if ($this->is_xhr()) {
                $html = '
					<script type="text/javascript">
						var url = "' . config_item('admin_url') . '";
						top.location.href = url;
					</script>';
                echo $html;
                exit;
                /*
                // Save options : as callback
                				$this->callback[] = array(
                	'fn' => 'ION.reload',
                	'args' => array('url'=> config_item('admin_url'))
                );
                $this->response();
                */
            } else {
                if (!in_array($uri_lang, Settings::get('displayed_admin_languages')) or $uri_lang != $default_admin_lang) {
                    redirect(base_url() . $default_admin_lang . '/' . config_item('admin_url') . '/auth/login');
                }
            }
        }
        $this->output('auth/login');
    }
开发者ID:pompalini,项目名称:emngo,代码行数:61,代码来源:auth.php

示例4: _initialize

 public function _initialize()
 {
     header("Content-Type:text/html; charset=utf-8");
     import('ORG.Util.Authority');
     //加载类库
     $auth = new Authority();
     //后台 admin_name
     $uid = $this->_session('admin_uid');
     $user = $this->_session('admin_name');
     $prompt = $uid ? "你没有权限" : "请登陆";
     $url = $uid ? "" : "__ROOT__/Admin/Logo.html";
     if ($user != "admin") {
         if (!$auth->getAuth(GROUP_NAME . '/' . MODULE_NAME . '/' . ACTION_NAME, $uid)) {
             //echo $user;
             $this->error($prompt, $url);
         }
     }
     $system = $this->systems();
     $this->assign('s', $system);
 }
开发者ID:chenyongze,项目名称:Dswjcms,代码行数:20,代码来源:AdminCommAction.class.php

示例5: index

 /**
  * Tree init.
  * Displays the tree view, which will call each menu tree builder
  *
  */
 public function index()
 {
     // TODO : Limit the number of displayed articles in the tree
     // $nb_elements = $this->page_model->count_all() + $this->article_model->count_all();
     if (Authority::can('access', 'admin/tree')) {
         // Menus : All menus
         $menus = $this->menu_model->get_list(array('order_by' => 'ordering ASC'));
         $this->template['menus'] = $menus;
         $this->output('tree/tree');
     }
 }
开发者ID:pompalini,项目名称:emngo,代码行数:16,代码来源:tree.php

示例6: update

 /**
  * Update one menu
  *
  */
 public function update()
 {
     $id = $this->input->post('id_menu');
     if ($id) {
         $this->menu_model->update($id, $this->input->post());
         if (Authority::can('access', 'admin/menu/permissions/backend')) {
             $resource = 'backend/menu/' . $id;
             $this->rule_model->save_element_roles_rules($resource, $this->input->post('backend_rule'));
         }
     }
     // UI update panels
     $this->_update_panels();
     $this->success(lang('ionize_message_menu_updated'));
 }
开发者ID:pompalini,项目名称:emngo,代码行数:18,代码来源:menu.php

示例7: tag_authority_can

 /**
  * @param FTL_Binding $tag
  *
  * @return string
  */
 public static function tag_authority_can(FTL_Binding $tag)
 {
     $action = $tag->getAttribute('action');
     $resource = $tag->getAttribute('resource');
     if (empty($action) && empty($resource)) {
         return self::show_tag_error($tag, 'Feed the "action" and "resource" attributes');
     }
     if (Authority::can($action, $resource)) {
         return $tag->expand();
     } else {
         // Else
         self::$trigger_else++;
     }
     return '';
 }
开发者ID:pompalini,项目名称:emngo,代码行数:20,代码来源:Authority.php

示例8: get_field_list

 /**
  * Returns one definition fields list
  *
  *
  */
 function get_field_list()
 {
     $fields = array();
     if (Authority::can('edit', 'admin/item/definition')) {
         $id_definition = $this->input->post('id_item_definition');
         $fields = $this->extend_field_model->get_lang_list(array('parent' => 'item', 'id_parent' => $id_definition), Settings::get_lang('default'));
     }
     //
     $this->template['id_item_definition'] = $id_definition;
     $this->template['fields'] = $fields;
     $this->output('item/definition/fields');
 }
开发者ID:pompalini,项目名称:emngo,代码行数:17,代码来源:item_definition.php

示例9: function

</ul>


<script type="text/javascript">

	/**
	 * Types list itemManager
	 *
	 */
	typesManager = new ION.ItemManager({ element: 'article_type', container: 'article_typeList' });
	
	typesManager.makeSortable();

	<?php 
if (Authority::can('edit', 'admin/article/type')) {
    ?>
		// Type editable
		$$('#article_typeList .title').each(function(item, idx)
		{
			var id = item.getProperty('data-id');

			item.addEvent('click', function(e){
				ION.formWindow('article_type' + id, 'article_typeForm' + id, Lang.get('ionize_title_type_edit'), 'article_type/edit/' + id);
			});
		});
	<?php 
}
?>

</script>
开发者ID:pompalini,项目名称:emngo,代码行数:30,代码来源:article_list.php

示例10: function

			mediaManager.toggleFileManager();
		});

		// Init the staticItemManager
		staticItemManager.init({
			'parent': 'article',
			'id_parent': id_article,
			'parentListContainer': 'articleTab'
		});

		// Get Static Items
		staticItemManager.getParentItemList();

		// Add video button
		<?php 
    if (Authority::can('link', 'admin/page/media')) {
        ?>

			$('btnAddVideoUrl').addEvent('click', function()
			{
				ION.dataWindow(
					'addExternalMedia',
					'ionize_label_add_video',
					'media/add_external_media_window',
					{width:600, height:150},
					{
						'parent': 'article',
						'id_parent': id_article
					}
				)
			});
开发者ID:rockylo,项目名称:ionize,代码行数:31,代码来源:article.php

示例11: function

require __DIR__ . DS . 'helpers' . EXT;
// --------------------------------------------------------------
// Load bundles
// --------------------------------------------------------------
//Bundle::start('thirdparty_dbmanager');
Bundle::start('thirdparty_bootsparks');
// --------------------------------------------------------------
// Load namespaces
// --------------------------------------------------------------
Autoloader::namespaces(array('Domain' => __DIR__));
// --------------------------------------------------------------
// Filters
// --------------------------------------------------------------
Route::filter('authority', function ($resource) {
    $action = Request::$route->parameters['0'];
    if (Authority::cannot($action, $resource)) {
        return Response::make('', 401);
    }
});
Route::filter('auth', function () {
    if (Auth::guest()) {
        return Redirect::make('', 401);
    }
});
// --------------------------------------------------------------
// Setting system tables
// --------------------------------------------------------------
DBManager::$hidden = Config::get('domain::dbmanager.hidden');
$api_version = Config::get('layla.domain.api.version');
// --------------------------------------------------------------
// Map the Base Controller
开发者ID:reith2004,项目名称:domain,代码行数:31,代码来源:start.php

示例12: function

		{
			ION.formWindow(
				'user', 					// Window ID
				'userForm',					// Form ID
				'ionize_title_add_user', 	// Window title
				'user/create',			// Window content URL
				{width: 400, resize:true}	// Window options
			);
		});

	<?php 
}
?>

	<?php 
if (Authority::can('create', 'admin/role')) {
    ?>

		// New Role
		$('newRoleToolbarButton').addEvent('click', function(e)
		{
			ION.formWindow(
				'role',
				'roleForm',
				'ionize_title_add_role',
				'role/create',
				{width: 420, resize:true}
			);
		});

	<?php 
开发者ID:pompalini,项目名称:emngo,代码行数:31,代码来源:users_toolbox.php

示例13: delete

 function delete($id = false)
 {
     Authority::is_logged_in();
     if (Authority::checkAuthority('Managecareer.delete') == true) {
         redirect('index.php/Loginpg');
     }
     $filter = array('career_id' => $id);
     $this->Careerpg_model->delete('career_detail', 'career_master', $filter);
     $this->session->set_flashdata('message_type', 'success');
     $this->session->set_flashdata('message', $this->config->item("index") . " Data deleted Successfully!!");
     $this->parser->parse('Adminheader', $this->data);
     $this->load->view('Mngcareer');
     $this->parser->parse('Adminfooter', $this->data);
     redirect('index.php/Careerpg/Mngcaindex');
 }
开发者ID:junctiontech,项目名称:careermitra,代码行数:15,代码来源:Careerpg.php

示例14: foreach

">

							<?php 
    foreach ($fields as $field) {
        ?>
								<li class="sortme element_field" data-id="<?php 
        echo $field['id_extend_field'];
        ?>
" id="element_field<?php 
        echo $field['id_extend_field'];
        ?>
">
									<span class="icon left drag"></span>

									<?php 
        if (Authority::can('edit', 'admin/element')) {
            ?>
										<a class="icon delete right" data-id="<?php 
            echo $field['id_extend_field'];
            ?>
"></a>
									<?php 
        }
        ?>

									<span class="lite right mr10" data-id="<?php 
        echo $field['id_extend_field'];
        ?>
">
										<?php 
        echo $field['type_name'];
开发者ID:trk,项目名称:ionize,代码行数:31,代码来源:definition.php

示例15: resolveLSID

function resolveLSID($l)
{
    global $config;
    $rdf = '';
    $xml = '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
    $xml .= "<result>\n";
    $xml .= "<lsid>" . $l . "</lsid>\n";
    $lsid = new LSID($l);
    $proxy = '';
    if ($config['proxy_name'] != '') {
        $proxy = $config['proxy_name'] . ":" . $config['proxy_port'];
    }
    $authority = new Authority($proxy);
    $ok = false;
    if (!$lsid->isValid()) {
        $xml .= "<error>LSID is not validly formed</error>\n";
    } else {
        $ok = $authority->Resolve($l);
        if (!$ok) {
            $xml .= "<error>DNS lookup for " . $lsid->getAuthority() . " failed</error>\n";
        } else {
            $authority->GetAuthorityWSDL();
            $ok = $authority->GetHTTPBinding();
            if (!$ok) {
                $xml .= "<error>No HTTP binding found</error>\n";
            }
            $ok = $authority->GetServiceWSDL($l);
            if (!$ok) {
                $xml .= "<error>Error retrieving service WSDL</error>";
            } else {
                $authority->GetMetadataHTTPLocation();
                $rdf = $authority->GetHTTPMetadata($l);
                $ok = $rdf != '';
            }
        }
    }
    if ($ok) {
        return $rdf;
    } else {
        $xml .= "<error_codes" . " HTTP=\"" . $authority->http_code . "\"" . " LSID=\"" . $authority->lsid_code . "\"" . " CURL=\"" . $authority->curl_code . "\"" . " />\n";
        $xml .= "</result>\n";
        return $xml;
    }
}
开发者ID:rdmpage,项目名称:bioguid,代码行数:44,代码来源:class_lsid.php


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