Changeset 3127469 in iPeer


Ignore:
Timestamp:
2012-12-07T13:56:33-08:00 (6 years ago)
Author:
Michael Tang <michael.tang@…>
Branches:
3.1.x, dev, hotfix, master, pagodabox, ticket463
Children:
e51ffc8
Parents:
1ad58ab
git-author:
Michael Tang <michael.tang@…> (12/07/2012 01:50:48 PM)
git-committer:
Michael Tang <michael.tang@…> (12/07/2012 01:56:33 PM)
Message:

fixed oauth permission bug #421

There was a discrepancy between the list of controllers generated
in create_acl for permissions and the expected permissions in the
interface. The reason is the difference between oauth_tokens and
oauthtokens for example.

To solve this problem I have renamed the oauth token and oauth
client controllers to have no underscore between them (just
like email templates).

Due to this small change, many of the links were broken, which
has now been fixed by making slight changes to various files in
this commit such as removing the underscore or changing the C in
client and T in token to be lowercase.

Up to this commit only super admins have access to the oauth tokens
and clients. I will be giving the appropriate permissions to the
other roles in my next commit.

Location:
app
Files:
9 edited
2 moved

Legend:

Unmodified
Added
Removed
  • app/controllers/oauthclients_controller.php

    r1ad58ab r3127469  
    99 * @license   MIT {@link http://www.opensource.org/licenses/MIT}
    1010 */
    11 class OauthClientsController extends AppController {
     11class OauthclientsController extends AppController {
    1212
    1313    public $name = 'OauthClients';
     
    116116        } else if (empty($this->data)) {
    117117            $this->data = $this->OauthClient->read(null, $id);
     118            debug($this->data);
    118119            if (empty($this->data)) {
    119120                $this->redirect('index');
  • app/controllers/oauthtokens_controller.php

    r1ad58ab r3127469  
    99 * @license   MIT {@link http://www.opensource.org/licenses/MIT}
    1010 */
    11 class OauthTokensController extends AppController {
     11class OauthtokensController extends AppController {
    1212
    1313    public $name = 'OauthTokens';
  • app/controllers/users_controller.php

    r1ad58ab r3127469  
    11381138        $this->Session->write('ipeerSession.id', $userData['id']);
    11391139        $this->Session->write('ipeerSession.username', $userData['username']);
    1140         $this->Session->write('ipeerSession.fullname', $userData['full_name']);
     1140        $this->Session->write('ipeerSession.fullname', $userData['first_name'].' '.$userData['last_name']);
    11411141        $this->Session->write('ipeerSession.email', $userData['email']);
    11421142    }
  • app/views/oauth_clients/add.ctp

    r1ad58ab r3127469  
    11<div class="oauthClients form">
    22<?php
    3 echo $this->Form->create('OauthClient');
     3echo $this->Form->create('Oauthclient');
    44if (isset($hideUser)) {
    5     echo $this->Form->input('user_id', array('div' => 'hide'));
     5    echo $this->Form->input('OauthClient.user_id', array('div' => 'hide'));
    66} else {
    7     echo $this->Form->input('user_id');
     7    echo $this->Form->input('OauthClient.user_id');
    88}
    9 echo $this->Form->input('key');
    10 echo $this->Form->input('secret');
    11 echo $this->Form->input('comment');
     9echo $this->Form->input('OauthClient.key');
     10echo $this->Form->input('OauthClient.secret');
     11echo $this->Form->input('OauthClient.comment');
    1212echo $this->Form->end(__('Submit', true));
    1313?>
  • app/views/oauth_clients/edit.ctp

    r1ad58ab r3127469  
    11<div class="oauthClients form">
    22<?php
    3 echo $this->Form->create('OauthClient');
    4 echo $this->Form->input('id');
    5 echo $this->Form->input('user_id');
    6 echo $this->Form->input('key');
    7 echo $this->Form->input('secret');
    8 echo $this->Form->input('enabled',
     3echo $this->Form->create('Oauthclient');
     4echo $this->Form->input('OauthClient.id');
     5echo $this->Form->input('OauthClient.user_id');
     6echo $this->Form->input('OauthClient.key');
     7echo $this->Form->input('OauthClient.secret');
     8echo $this->Form->input('OauthClient.enabled',
    99    array('options' => array('0' => 'False', '1' => 'True')));
    10 echo $this->Form->input('comment');
     10echo $this->Form->input('OauthClient.comment');
    1111echo $this->Form->end(__('Submit', true));
    1212?>
  • app/views/oauth_clients/index.ctp

    r1ad58ab r3127469  
    4949
    5050    sOut += '<li>';
    51     sOut += '<a href="<?php echo $this->base; ?>/oauth_clients/edit/'+aData[0]+'">Edit</a>';
     51    sOut += '<a href="<?php echo $this->base; ?>/oauthclients/edit/'+aData[0]+'">Edit</a>';
    5252    sOut += '</li>';
    5353
    5454    sOut += '<li>';
    55     sOut += '<a href="<?php echo $this->base; ?>/oauth_clients/delete/'+aData[0]+'">Delete</a>';
     55    sOut += '<a href="<?php echo $this->base; ?>/oauthclients/delete/'+aData[0]+'">Delete</a>';
    5656    sOut += '</li>';
    5757
  • app/views/oauth_tokens/add.ctp

    r1ad58ab r3127469  
    11<div class="oauthTokens form">
    22<?php
    3 echo $this->Form->create('OauthToken');
     3echo $this->Form->create('Oauthtoken');
    44if (isset($hideUser)) {
    5     echo $this->Form->input('user_id', array('div' => 'hide'));
     5    echo $this->Form->input('OauthToken.user_id', array('div' => 'hide'));
    66} else {
    7     echo $this->Form->input('user_id');
     7    echo $this->Form->input('OauthToken.user_id');
    88}
    9 echo $this->Form->input('key');
    10 echo $this->Form->input('secret');
    11 echo $this->Form->input('expires');
    12 echo $this->Form->input('comment');
     9echo $this->Form->input('OauthToken.key');
     10echo $this->Form->input('OauthToken.secret');
     11echo $this->Form->input('OauthToken.expires');
     12echo $this->Form->input('OauthToken.comment');
    1313echo $this->Form->end(__('Submit', true));
    1414?>
  • app/views/oauth_tokens/edit.ctp

    r1ad58ab r3127469  
    11<div class="oauthTokens form">
    22<?php
    3 echo $this->Form->create('OauthToken');
    4 echo $this->Form->input('id');
    5 echo $this->Form->input('user_id');
    6 echo $this->Form->input('key');
    7 echo $this->Form->input('secret');
    8 echo $this->Form->input('expires');
    9 echo $this->Form->input('enabled',
     3echo $this->Form->create('Oauthtoken');
     4echo $this->Form->input('OauthToken.id');
     5echo $this->Form->input('OauthToken.user_id');
     6echo $this->Form->input('OauthToken.key');
     7echo $this->Form->input('OauthToken.secret');
     8echo $this->Form->input('OauthToken.expires');
     9echo $this->Form->input('OauthToken.enabled',
    1010    array('options' => array('0' => 'False', '1' => 'True')));
    11 echo $this->Form->input('comment');
     11echo $this->Form->input('OauthToken.comment');
    1212echo $this->Form->end(__('Submit', true));
    1313?>
  • app/views/oauth_tokens/index.ctp

    r1ad58ab r3127469  
    4747
    4848    sOut += '<li>';
    49     sOut += '<a href="<?php echo $this->base; ?>/oauth_tokens/edit/'+aData[0]+'">Edit</a>';
     49    sOut += '<a href="<?php echo $this->base; ?>/oauthtokens/edit/'+aData[0]+'">Edit</a>';
    5050    sOut += '</li>';
    5151
    5252    sOut += '<li>';
    53     sOut += '<a href="<?php echo $this->base; ?>/oauth_tokens/delete/'+aData[0]+'">Delete</a>';
     53    sOut += '<a href="<?php echo $this->base; ?>/oauthtokens/delete/'+aData[0]+'">Delete</a>';
    5454    sOut += '</li>';
    5555
  • app/views/pages/admin.ctp

    r1ad58ab r3127469  
    2929        echo $this->Html->link(
    3030            'OAuth Client Credentials',
    31             array('controller' => 'oauth_clients')
     31            array('controller' => 'oauthclients')
    3232        );
    3333    echo "</li>";
     
    3838        echo $this->Html->link(
    3939            'OAuth Token Credentials',
    40             array('controller' => 'oauth_tokens')
     40            array('controller' => 'oauthtokens')
    4141        );
    4242    echo "</li>";
  • app/views/users/edit_profile.ctp

    r1ad58ab r3127469  
    6363    <h3><?php __('OAuth Client Credentials')?>:</h3>
    6464    <?php if (count($clients) == 0 || User::hasPermission('controllers/oauthclients')) { ?>
    65         <?php echo $html->link(__('Add Client Credential', true), '/oauth_clients/add', array('id' => 'add', 'class' => 'add-button')); ?>
     65        <?php echo $html->link(__('Add Client Credential', true), '/oauthclients/add', array('id' => 'add', 'class' => 'add-button')); ?>
    6666    <?php } ?>
    6767    <?php if (count($clients) > 0) { ?>
     
    7171            <?php echo $this->Form->select('OauthClient.'.$key.'.enabled', $enabled, $client['OauthClient']['enabled'], array('empty' => false)); ?>
    7272            <?php echo $this->Form->input('OauthClient.'.$key.'.id', array('value' => $client['OauthClient']['id'])); ?>
    73             <?php echo $html->link('X', '/oauth_clients/delete/'.$client['OauthClient']['id'], array('id' => 'delete')); ?></p>
     73            <?php echo $html->link('X', '/oauthclients/delete/'.$client['OauthClient']['id'], array('id' => 'delete')); ?></p>
    7474            <label id=comment><?php echo __('&nbsp;Comment: ').$client['OauthClient']['comment'];?></label>
    7575        <?php } ?>
     
    7878    <hr align=left width=95%>
    7979    <h3><?php __('OAuth Token Credentials')?>:</h3>
    80     <?php echo $html->link(__('Add Token Credential', true), '/oauth_tokens/add', array('id' => 'add', 'class' => 'add-button')); ?>
     80    <?php echo $html->link(__('Add Token Credential', true), '/oauthtokens/add', array('id' => 'add', 'class' => 'add-button')); ?>
    8181    <?php if (count($tokens) > 0) { ?>
    8282        <?php foreach ($tokens as $index => $token) { ?>
     
    8686            <?php echo $this->Form->select('OauthToken.'.$index.'.enabled', $enabled, $token['OauthToken']['enabled'], array('empty' => false)); ?>
    8787            <?php echo $this->Form->input('OauthToken.'.$index.'.id', array('value' => $token['OauthToken']['id'])); ?>
    88             <?php echo $html->link('X', '/oauth_tokens/delete/'.$token['OauthToken']['id'], array('id' => 'delete')); ?></p>
     88            <?php echo $html->link('X', '/oauthtokens/delete/'.$token['OauthToken']['id'], array('id' => 'delete')); ?></p>
    8989            <label id=comment><?php echo __('&nbsp;Comment: ').$token['OauthToken']['comment'];?></label>
    9090        <?php } ?>
Note: See TracChangeset for help on using the changeset viewer.