oauth_common_providerui.module 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?php
  2. /**
  3. * Implements hook_menu().
  4. */
  5. function oauth_common_providerui_menu() {
  6. $menu = array();
  7. $admin_base = array(
  8. 'access arguments' => array('administer oauth'),
  9. 'file' => 'oauth_common.admin.inc',
  10. );
  11. $menu['admin/config/services/oauth/contexts'] = array(
  12. 'title' => 'Contexts',
  13. 'description' => 'The different context for authorization',
  14. 'page callback' => 'oauth_common_list_context',
  15. 'type' => MENU_LOCAL_TASK,
  16. 'weight' => 1,
  17. ) + $admin_base;
  18. ////////////
  19. // Context administration
  20. ////////////
  21. $menu['admin/config/services/oauth/add'] = array(
  22. 'title' => 'Add context',
  23. 'page callback' => 'oauth_common_add_context',
  24. 'type' => MENU_LOCAL_TASK,
  25. 'weight' => 10,
  26. ) + $admin_base;
  27. $menu['admin/config/services/oauth/%oauth_common_context/edit'] = array(
  28. 'title' => 'Edit context',
  29. 'page callback' => 'oauth_common_edit_context',
  30. 'page arguments' => array(4),
  31. 'type' => MENU_LOCAL_TASK,
  32. 'weight' => 10,
  33. ) + $admin_base;
  34. $menu['admin/config/services/oauth/%oauth_common_context/export'] = array(
  35. 'title' => 'Export context',
  36. 'page callback' => 'drupal_get_form',
  37. 'page arguments' => array('oauth_common_export_context', 4),
  38. 'type' => MENU_LOCAL_TASK,
  39. 'weight' => 20,
  40. ) + $admin_base;
  41. $menu['admin/config/services/oauth/%oauth_common_context/delete'] = array(
  42. 'title' => 'Delete context',
  43. 'page callback' => 'drupal_get_form',
  44. 'page arguments' => array('oauth_common_delete_confirm_context', 4),
  45. 'type' => MENU_CALLBACK,
  46. ) + $admin_base;
  47. $menu['admin/config/services/oauth/%oauth_common_context/disable'] = array(
  48. 'page callback' => 'oauth_common_context',
  49. 'page arguments' => array(3),
  50. 'type' => MENU_CALLBACK,
  51. ) + $admin_base;
  52. $menu['admin/config/services/oauth/%oauth_common_context/enable'] = array(
  53. 'page callback' => 'oauth_common_enable_context',
  54. 'page arguments' => array(3),
  55. 'type' => MENU_CALLBACK,
  56. ) + $admin_base;
  57. ////////////
  58. // Authorization administration
  59. ////////////
  60. $menu['user/%user/oauth'] = array(
  61. 'title' => 'Authorization',
  62. 'page callback' => 'oauth_common_page_user_authorizations',
  63. 'page arguments' => array(1, TRUE),
  64. 'access callback' => '_oauth_common_user_access',
  65. 'access arguments' => array(1),
  66. 'file' => 'oauth_common.authorizations.inc',
  67. 'type' => MENU_LOCAL_TASK,
  68. );
  69. $menu['user/%user/oauth/authorizations'] = array(
  70. 'title' => 'Authorizations',
  71. 'page callback' => 'oauth_common_page_user_authorizations',
  72. 'page arguments' => array(1, TRUE),
  73. 'access callback' => '_oauth_common_user_access',
  74. 'access arguments' => array(1),
  75. 'file' => 'oauth_common.authorizations.inc',
  76. 'type' => MENU_DEFAULT_LOCAL_TASK,
  77. );
  78. $menu['user/%user/oauth/authorizations/%oauth_common_provider_token'] = array(
  79. 'title' => 'Edit authorization',
  80. 'page callback' => 'drupal_get_form',
  81. 'page arguments' => array('oauth_common_form_authorization', 4),
  82. 'access callback' => '_oauth_common_user_access',
  83. 'access arguments' => array(1, 'oauth authorize any consumers'),
  84. 'file' => 'oauth_common.authorizations.inc',
  85. 'type' => MENU_LOCAL_TASK,
  86. );
  87. $menu['user/%user/oauth/authorizations/%oauth_common_provider_token/delete'] = array(
  88. 'title' => 'Delete authorization',
  89. 'page callback' => 'drupal_get_form',
  90. 'page arguments' => array('oauth_common_form_authorization_delete', 1, 4),
  91. // We always want to allow the user to delete a authorization, that
  92. // shouldn't be a permission that can be rescinded.
  93. 'access callback' => 'user_edit_access',
  94. 'access arguments' => array(1),
  95. 'file' => 'oauth_common.authorizations.inc',
  96. 'type' => MENU_LOCAL_TASK,
  97. );
  98. ////////////
  99. // Consumer administration
  100. ////////////
  101. $menu['user/%user/oauth/consumers'] = array(
  102. 'title' => 'Consumers',
  103. 'page callback' => 'oauth_common_page_user_consumers',
  104. 'page arguments' => array(1),
  105. 'access callback' => '_oauth_common_user_access',
  106. 'access arguments' => array(1),
  107. 'file' => 'oauth_common.consumers.inc',
  108. 'type' => MENU_LOCAL_TASK,
  109. );
  110. $menu['user/%user/oauth/consumer/add'] = array(
  111. 'title' => 'Add consumer',
  112. 'page callback' => 'oauth_common_add_consumer',
  113. 'page arguments' => array(1),
  114. 'access callback' => 'oauth_common_can_create_consumers',
  115. 'file' => 'oauth_common.consumers.inc',
  116. 'type' => MENU_LOCAL_TASK,
  117. 'weight' => 10,
  118. );
  119. $menu['user/%user/oauth/consumer/%oauth_common_consumer'] = array(
  120. 'title' => 'Edit consumer',
  121. 'page callback' => 'oauth_common_edit_consumer',
  122. 'page arguments' => array(4),
  123. 'access callback' => 'oauth_common_can_edit_consumer',
  124. 'access arguments' => array(4),
  125. 'file' => 'oauth_common.consumers.inc',
  126. 'type' => MENU_LOCAL_TASK,
  127. );
  128. $menu['user/%user/oauth/consumer/%oauth_common_consumer/delete'] = array(
  129. 'title' => 'Delete consumer',
  130. 'page callback' => 'drupal_get_form',
  131. 'page arguments' => array('oauth_common_form_consumer_delete', 4),
  132. 'access callback' => 'oauth_common_can_edit_consumer',
  133. 'access arguments' => array(4),
  134. 'file' => 'oauth_common.consumers.inc',
  135. 'type' => MENU_LOCAL_TASK,
  136. );
  137. $menu['user/%user/oauth/consumer/%oauth_common_consumer/add-authorization'] = array(
  138. 'title' => 'Add authorization',
  139. 'page callback' => 'oauth_common_authorization_add',
  140. 'page arguments' => array(4),
  141. 'access callback' => 'oauth_common_can_authorize_consumer',
  142. 'access arguments' => array(4),
  143. 'file' => 'oauth_common.authorizations.inc',
  144. 'type' => MENU_LOCAL_TASK,
  145. );
  146. return $menu;
  147. }