access.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?php
  2. /**
  3. * Moodle capability definitions for the Sloodle module.
  4. *
  5. * The capabilities are loaded into the database table when the module is
  6. * installed or updated. Whenever the capability definitions are updated,
  7. * the module version number should be bumped up.
  8. *
  9. * @package sloodle
  10. * @copyright Copyright (c) 2008 Sloodle (various contributors)
  11. * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
  12. * @since Sloodle 0.3
  13. *
  14. * @contributor Peter R. Bloomfield
  15. * @contributor Edmund Edgar
  16. *
  17. */
  18. //
  19. // The system has four possible values for a capability:
  20. // CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set).
  21. //
  22. //
  23. // CAPABILITY NAMING CONVENTION
  24. //
  25. // It is important that capability names are unique. The naming convention
  26. // for capabilities that are specific to modules and blocks is as follows:
  27. // [mod/block]/<component_name>:<capabilityname>
  28. //
  29. // component_name should be the same as the directory name of the mod or block.
  30. //
  31. // Core moodle capabilities are defined thus:
  32. // moodle/<capabilityclass>:<capabilityname>
  33. //
  34. // Examples: mod/forum:viewpost
  35. // block/recent_activity:view
  36. // moodle/site:deleteuser
  37. //
  38. // The variable name for the capability definitions array follows the format
  39. // $<componenttype>_<component_name>_capabilities
  40. //
  41. // For the core capabilities, the variable is $moodle_capabilities.
  42. // NOTE: many Sloodle components relate directly to Moodle components.
  43. // In these cases, the standard capabilities for those components apply.
  44. // For example, Sloodle module configuration is covered by the Moodle standard capability:
  45. // moodle/course:manageactivities
  46. // Viewing and editing avatar details will be handled by the user profile capabilities.
  47. $mod_sloodle_capabilities = array(
  48. // Considered a 'staff' member in SL
  49. 'mod/sloodle:staff' => array(
  50. 'captype' => 'write',
  51. 'contextlevel' => CONTEXT_MODULE,
  52. 'legacy' => array(
  53. 'teacher' => CAP_ALLOW,
  54. 'editingteacher' => CAP_ALLOW,
  55. 'coursecreator' => CAP_ALLOW,
  56. 'admin' => CAP_ALLOW
  57. )
  58. ),
  59. // Authorising objects to access Sloodle
  60. 'mod/sloodle:objectauth' => array(
  61. 'riskbitmask' => RISK_CONFIG,
  62. 'captype' => 'write',
  63. 'contextlevel' => CONTEXT_MODULE,
  64. 'legacy' => array(
  65. 'editingteacher' => CAP_ALLOW,
  66. 'coursecreator' => CAP_ALLOW,
  67. 'admin' => CAP_ALLOW
  68. )
  69. ),
  70. // Authorising user objects to access user-specific parts of Sloodle (e.g. blogging)
  71. 'mod/sloodle:userobjectauth' => array(
  72. 'captype' => 'write',
  73. 'contextlevel' => CONTEXT_MODULE,
  74. 'legacy' => array(
  75. 'user' => CAP_ALLOW,
  76. 'guest' => CAP_PREVENT,
  77. 'student' => CAP_ALLOW,
  78. 'teacher' => CAP_ALLOW,
  79. 'editingteacher' => CAP_ALLOW,
  80. 'coursecreator' => CAP_ALLOW,
  81. 'admin' => CAP_ALLOW
  82. )
  83. ),
  84. // Access and use classroom layout profiles
  85. 'mod/sloodle:uselayouts' => array(
  86. 'captype' => 'read',
  87. 'contextlevel' => CONTEXT_MODULE,
  88. 'legacy' => array(
  89. 'teacher' => CAP_ALLOW,
  90. 'editingteacher' => CAP_ALLOW,
  91. 'coursecreator' => CAP_ALLOW,
  92. 'admin' => CAP_ALLOW
  93. )
  94. ),
  95. // Edit and delete classroom layout profiles
  96. 'mod/sloodle:editlayouts' => array(
  97. 'captype' => 'write',
  98. 'contextlevel' => CONTEXT_MODULE,
  99. 'legacy' => array(
  100. 'editingteacher' => CAP_ALLOW,
  101. 'coursecreator' => CAP_ALLOW,
  102. 'admin' => CAP_ALLOW
  103. )
  104. ),
  105. // Register an avatar with their own account
  106. 'mod/sloodle:registeravatar' => array(
  107. 'captype' => 'write',
  108. 'contextlevel' => CONTEXT_MODULE,
  109. 'legacy' => array(
  110. 'user' => CAP_ALLOW,
  111. 'guest' => CAP_PREVENT,
  112. 'student' => CAP_ALLOW,
  113. 'teacher' => CAP_ALLOW,
  114. 'editingteacher' => CAP_ALLOW,
  115. 'coursecreator' => CAP_ALLOW,
  116. 'admin' => CAP_ALLOW
  117. )
  118. ),
  119. // Distribute objects to own avatar
  120. 'mod/sloodle:distributeself' => array(
  121. 'captype' => 'write',
  122. 'contextlevel' => CONTEXT_MODULE,
  123. 'legacy' => array(
  124. 'guest' => CAP_PREVENT,
  125. 'student' => CAP_ALLOW,
  126. 'teacher' => CAP_ALLOW,
  127. 'editingteacher' => CAP_ALLOW,
  128. 'coursecreator' => CAP_ALLOW,
  129. 'admin' => CAP_ALLOW
  130. )
  131. ),
  132. // Distribute objects to other avatars
  133. 'mod/sloodle:distributeothers' => array(
  134. 'riskbitmask' => RISK_SPAM,
  135. 'captype' => 'write',
  136. 'contextlevel' => CONTEXT_MODULE,
  137. 'legacy' => array(
  138. 'guest' => CAP_PREVENT,
  139. 'editingteacher' => CAP_ALLOW,
  140. 'coursecreator' => CAP_ALLOW,
  141. 'admin' => CAP_ALLOW
  142. )
  143. ),
  144. // Indicates that the user is involved in the course. Replaces pre-Moodle-2 course:view
  145. 'mod/sloodle:courseparticipate' => array(
  146. 'captype' => 'write',
  147. 'contextlevel' => CONTEXT_COURSE,
  148. 'legacy' => array(
  149. 'guest' => CAP_PREVENT,
  150. 'student' => CAP_ALLOW,
  151. 'teacher' => CAP_ALLOW,
  152. 'editingteacher' => CAP_ALLOW,
  153. 'coursecreator' => CAP_ALLOW,
  154. 'admin' => CAP_ALLOW
  155. )
  156. ),
  157. // Indicates that the user is allowed to use a controller.
  158. // Intended to replace courseparticipate where permissions can sensibly be set at the controller level.
  159. 'mod/sloodle:controllerparticipate' => array(
  160. 'captype' => 'write',
  161. 'contextlevel' => CONTEXT_MODULE,
  162. 'legacy' => array(
  163. 'guest' => CAP_PREVENT,
  164. 'student' => CAP_ALLOW,
  165. 'teacher' => CAP_ALLOW,
  166. 'editingteacher' => CAP_ALLOW,
  167. 'coursecreator' => CAP_ALLOW,
  168. 'admin' => CAP_ALLOW
  169. )
  170. ),
  171. );
  172. ?>