本文整理汇总了PHP中ACL::set方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::set方法的具体用法?PHP ACL::set怎么用?PHP ACL::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACL
的用法示例。
在下文中一共展示了ACL::set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_cache_stores_route_objects
/**
* If Route::cache() was able to restore routes from the cache then
* it should return TRUE and load the cached routes
*
* @test
* @covers Route::cache
*/
public function test_cache_stores_route_objects()
{
$acls = ACL::all();
// First we create the cache
ACL::cache(TRUE);
// Now lets modify the "current" routes
ACL::set('contact', array('sending mail' => array('title' => __('Sending Mails'), 'restrict access' => FALSE, 'description' => __('Ability to send messages for administrators from your site'))));
// Then try and load said cache
$this->assertTrue(ACL::cache());
// Check the route cache flag
$this->assertTrue(ACL::$cache);
// And if all went ok the nonsensical route should be gone...
$this->assertEquals($acls, ACL::all());
}
示例2: array
/**
* Define Module specific Permissions
*
* Definition of user privileges by default if the ACL is present in the system.
* Note: Parameter `restrict access` indicates that these privileges have serious
* implications for safety.
*
* @uses ACL::cache
* @uses ACL::set
*/
if (!ACL::cache()) {
ACL::set('comment', array('administer comment' => array('title' => __('Administer Comments'), 'restrict access' => TRUE, 'description' => __('Administer comments and comments settings')), 'access comment' => array('title' => __('Access comments'), 'restrict access' => FALSE, 'description' => __('Access to any published comments')), 'post comment' => array('title' => __('Post comments'), 'restrict access' => FALSE, 'description' => __('Ability to publish comments')), 'skip comment approval' => array('title' => __('Skip comment approval'), 'restrict access' => FALSE, 'description' => __('Ability to publish comments without approval by the moderator')), 'edit own comment' => array('title' => __('Edit own comments'), 'restrict access' => FALSE, 'description' => __('Ability to editing own comments'))));
ACL::set('content', array('administer content' => array('title' => __('Administer content'), 'restrict access' => TRUE, 'description' => __('Most of the tasks associated with the administration of the contents of this website associated with this permission')), 'access content' => array('title' => __('Access content'), 'restrict access' => FALSE, 'description' => __('')), 'view own unpublished content' => array('title' => __('View own unpublished content'), 'restrict access' => FALSE, 'description' => __('')), 'administer page' => array('title' => __('Administer pages'), 'restrict access' => TRUE, 'description' => __('')), 'create page' => array('title' => __('Create pages'), 'restrict access' => FALSE, 'description' => __('The ability to create pages')), 'edit own page' => array('title' => __('Edit own pages'), 'restrict access' => FALSE, 'description' => __('')), 'edit any page' => array('title' => __('Edit any pages'), 'restrict access' => FALSE, 'description' => __('')), 'delete own page' => array('title' => __('Delete own pages'), 'restrict access' => FALSE, 'description' => __('')), 'delete any page' => array('title' => __('Delete any pages'), 'restrict access' => FALSE, 'description' => __(''))));
ACL::set('site', array('administer menu' => array('title' => __('Administer Menus'), 'restrict access' => TRUE, 'description' => __('')), 'administer paths' => array('title' => __('Administer Paths'), 'restrict access' => FALSE, 'description' => __('')), 'administer site' => array('title' => __('Administer Site'), 'restrict access' => TRUE, 'description' => __('')), 'administer tags' => array('title' => __('Administer Tags'), 'restrict access' => FALSE, 'description' => __('')), 'administer terms' => array('title' => __('Administer Terms'), 'restrict access' => FALSE, 'description' => __('')), 'administer formats' => array('title' => __('Administer Formats'), 'restrict access' => TRUE, 'description' => __('Managing the text formats of editor'))));
ACL::set('contact', array('sending mail' => array('title' => __('Sending Mails'), 'restrict access' => FALSE, 'description' => __('Ability to send messages for administrators from your site'))));
ACL::set('blog', array('administer blog' => array('title' => __('Administer Blog'), 'restrict access' => TRUE, 'description' => __('Administer Blog and Blog settings')), 'create blog' => array('title' => __('Create Blog post'), 'restrict access' => FALSE, 'description' => ''), 'edit own blog' => array('title' => __('Edit own Blog post'), 'restrict access' => FALSE, 'description' => ''), 'edit any blog' => array('title' => __('Edit any Blog posts'), 'restrict access' => FALSE, 'description' => ''), 'delete own blog' => array('title' => __('Delete own Blog post'), 'restrict access' => FALSE, 'description' => ''), 'delete any blog' => array('title' => __('Delete any Blog posts'), 'restrict access' => FALSE, 'description' => '')));
/** Cache the module specific permissions in production */
ACL::cache(Kohana::$environment === Kohana::PRODUCTION);
}
/**
* Load the filter cache
*
* @uses Filter::cache
* @uses Filter::set
* @uses Text::html
* @uses Text::htmlcorrector
* @uses Text::autop
* @uses Text::plain
* @uses Text::autolink
* @uses Text::initialcaps
* @uses Text::markdown
示例3: on_post_access
/**
* Изменение прав на разделы.
* @route POST//api/taxonomy/access.rpc
*/
public static function on_post_access(Context $ctx)
{
$ctx->user->checkAccess(ACL::UPDATE, 'tag');
if ($sections = (array) $ctx->post('sections')) {
$publishers = $ctx->post('publishers');
$owners = $ctx->post('owners');
$ctx->db->beginTransaction();
ACL::resetNode($sections);
foreach ($sections as $nid) {
if ($publishers == $owners) {
ACL::set($nid, $owners, ACL::CREATE | ACL::READ | ACL::UPDATE | ACL::DELETE | ACL::PUBLISH);
} else {
ACL::set($nid, $publishers, ACL::PUBLISH);
ACL::set($nid, $owners, ACL::CREATE | ACL::READ | ACL::UPDATE | ACL::DELETE);
}
}
$ctx->db->commit();
}
return $ctx->getRedirect('admin/access/taxonomy');
}
示例4: on_post_access
/**
* Изменение прав.
* @route POST//admin/structure/access
*/
public static function on_post_access(Context $ctx)
{
if (!Node::create('type')->checkPermission(ACL::UPDATE)) {
throw new ForbiddenException();
}
// Если объект не существует, выбросится 404.
$node = Node::load(array('class' => 'type', 'name' => $ctx->get('type'), 'deleted' => 0));
$ctx->db->beginTransaction();
foreach ($ctx->post as $gid => $data) {
ACL::set($node->id, intval($gid), ACL::asint($data));
}
$ctx->db->commit();
return $ctx->getRedirect();
}