Example #1
0
function op_have_privilege_by_uri($uri, $params = array(), $member_id = null)
{
    $routing = sfContext::getInstance()->getRouting();
    $routes = $routing->getRoutes();
    if (empty($routes[$uri])) {
        return true;
    }
    $route = clone $routes[$uri];
    if ($route instanceof opDynamicAclRoute) {
        $route->bind(sfContext::getInstance(), $params);
        try {
            $route->getObject();
        } catch (sfError404Exception $e) {
            // do nothing
        }
        $options = $route->getOptions();
        return op_have_privilege($options['privilege'], $member_id, $route);
    }
    return true;
}
Example #2
0
?>
</ul>
<?php 
end_slot();
?>

<?php 
$list = array();
if (op_have_privilege('edit')) {
    $list = array(__('Consumer key') => $consumer->getKeyString(), __('Consumer secret') => $consumer->getSecret(), __('Request token URL') => url_for('oauth_request_token', array(), true), __('Access token URL') => url_for('oauth_access_token', array(), true), __('Authorize URL') => url_for('oauth_authorize_token', array(), true), __('対応している署名方式') => 'HMAC-SHA1');
}
op_include_parts('listBox', 'consumerInformation', array('list' => array_merge(array(__('説明') => nl2br($consumer->getDescription()), __('登録者') => $consumer->getMember(), __('使用する API') => get_slot('_api_list')), $list)));
?>

<ul>
<?php 
if (op_have_privilege('edit')) {
    ?>
  <li><?php 
    echo link_to('このアプリケーションを編集', 'connection_edit', $consumer);
    ?>
</li>
<?php 
}
?>
  <li><?php 
echo link_to('連携済みアプリケーション一覧', 'connection_list');
?>
</li>
</ul>