| 1 |
<?php |
<?php |
| 2 |
// $Id: services_oauth.module,v 1.1 2009/05/08 21:12:30 hugowetterberg Exp $ |
// $Id: services_oauth.module,v 1.2 2009/05/08 22:00:14 hugowetterberg Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_services_authentication(). |
* Implementation of hook_services_authentication(). |
| 20 |
* Implementation of hook_perm(). |
* Implementation of hook_perm(). |
| 21 |
*/ |
*/ |
| 22 |
function services_oauth_perm() { |
function services_oauth_perm() { |
| 23 |
return array('services oauth register consumers'); |
return array('services oauth authorize consumers', 'services oauth register consumers'); |
| 24 |
} |
} |
| 25 |
|
|
| 26 |
/** |
/** |
| 37 |
'type' => MENU_CALLBACK, |
'type' => MENU_CALLBACK, |
| 38 |
); |
); |
| 39 |
|
|
| 40 |
|
$menu['oauth/authorized'] = array( |
| 41 |
|
'title' => 'Authorization finished', |
| 42 |
|
'page callback' => '_services_oauth_authorized', |
| 43 |
|
'access callback' => '_services_oauth_always_true', |
| 44 |
|
'file' => 'services_oauth.pages.inc', |
| 45 |
|
'type' => MENU_CALLBACK, |
| 46 |
|
); |
| 47 |
|
|
| 48 |
$menu['oauth/request_token'] = array( |
$menu['oauth/request_token'] = array( |
| 49 |
'page callback' => '_services_oauth_request_token', |
'page callback' => '_services_oauth_request_token', |
| 50 |
'access callback' => '_services_oauth_always_true', |
'access callback' => '_services_oauth_always_true', |
| 148 |
} |
} |
| 149 |
|
|
| 150 |
function oauth_services_user_access($user) { |
function oauth_services_user_access($user) { |
| 151 |
return user_edit_access($user) && (user_access('access services', $user) || user_access('services oauth register consumers', $user)); |
return user_edit_access($user) && (user_access('services oauth authorize consumers', $user) || user_access('services oauth register consumers', $user)); |
| 152 |
} |
} |
| 153 |
|
|
| 154 |
/** |
/** |