forked from mudrd8mz/moodle-mod_stampcoll
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcaps.php
29 lines (24 loc) · 1.13 KB
/
caps.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php // $Id$
/**
* Common definitions of $cap_* variables for Stamp Collection module
*
* @author David Mudrak
* @package mod/stampcoll
*/
if (empty($course) or empty($context)) {
die('You cannot call this script in that way');
}
/// Get capabilities. Somewhere we want to ignore admin's doanything
$cap_managestamps = has_capability('mod/stampcoll:managestamps', $context);
// if you can't collect, you can't view your own stamps
$cap_viewownstamps = has_capability('mod/stampcoll:collectstamps', $context, NULL, false)
&& has_capability('mod/stampcoll:viewownstamps', $context, NULL, false);
$cap_viewotherstamps = has_capability('mod/stampcoll:viewotherstamps', $context)
|| $cap_managestamps;
$cap_viewsomestamps = $cap_viewownstamps || $cap_viewotherstamps;
$cap_viewonlyownstamps = $cap_viewownstamps && (!$cap_viewotherstamps);
$cap_givestamps = has_capability('mod/stampcoll:givestamps', $context)
|| $cap_managestamps;
// allows to use editstamps.php
$cap_editstamps = $cap_givestamps || $cap_managestamps;
?>