mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
125 lines
5.9 KiB
HTML
Executable file
125 lines
5.9 KiB
HTML
Executable file
<?php
|
|
$strinherit = get_string('inherit','role');
|
|
$strallow = get_string('allow','role');
|
|
$strprevent = get_string('prevent','role');
|
|
$strprohibit = get_string('prohibit','role');
|
|
?>
|
|
|
|
<form name="overrideform" action="override.php" method="post">
|
|
<input type="hidden" name="contextid" value="<?php p($contextid) ?>">
|
|
<input type="hidden" name="roleid" value="<?php p($roleid) ?>">
|
|
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
|
|
<input type="hidden" name="userid" value="<?php p($userid) ?>" />
|
|
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
|
|
|
|
<table class="rolecap">
|
|
<tr>
|
|
<th class="name" align="left"><?php print_string('capability','role') ?></th>
|
|
<th class="inherit"><?php p($strinherit); ?></th>
|
|
<th class="allow"><?php p($strallow); ?></th>
|
|
<th class="prevent"><?php p($strprevent); ?></th>
|
|
<th class="prohibit"><?php p($strprohibit); ?></th>
|
|
<th class="risk"><?php print_string('risks','role') ?></th>
|
|
</tr>
|
|
<?php
|
|
|
|
// init these 2
|
|
$contextlevel = 0;
|
|
$component = '';
|
|
|
|
foreach ($capabilities as $capability) {
|
|
// prints a breaker if component or name or context level
|
|
if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
|
|
echo ('<tr class="rolecapheading header"><td colspan="6" class="header"><strong>'.get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
|
|
}
|
|
|
|
// these 2 are used to see to group same mod/core capabilities together
|
|
$contextlevel = $capability->contextlevel;
|
|
$component = $capability->component;
|
|
|
|
// check the capability override for this cap, this role in this context
|
|
if (isset($localoverrides[$capability->name])) {
|
|
$localpermission = $localoverrides[$capability->name]->permission;
|
|
} else {
|
|
$localpermission = 0; // Just inherit
|
|
}
|
|
|
|
if (isset($r_caps[$capability->name])) {
|
|
$isallow = $r_caps[$capability->name] > 0;
|
|
$isprevent = $r_caps[$capability->name] < 0 && $r_caps[$capability->name] > -500;
|
|
$isprohibit = $r_caps[$capability->name] <= -500;
|
|
} else {
|
|
$isallow = 0;
|
|
$isprevent = 0;
|
|
$isprohibit = 0;
|
|
}
|
|
|
|
$isdisabled = $isprohibit || islegacy($capability->name);
|
|
|
|
$riskinfo = '';
|
|
$rowclasses = '';
|
|
if (RISK_MANAGETRUST & (int)$capability->riskbitmask) {
|
|
$riskinfo .= '<a title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">T</a>';
|
|
$rowclasses .= ' riskmanagetrust';
|
|
}
|
|
if (RISK_CONFIG & (int)$capability->riskbitmask) {
|
|
$riskinfo .= '<a title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">C</a>';
|
|
$rowclasses .= ' riskconfig';
|
|
}
|
|
if (RISK_XSS & (int)$capability->riskbitmask) {
|
|
$riskinfo .= '<a title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">X</a>';
|
|
$rowclasses .= ' riskxss';
|
|
}
|
|
if (RISK_PERSONAL & (int)$capability->riskbitmask) {
|
|
$riskinfo .= '<a title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">P</a>';
|
|
$rowclasses .= ' riskpersonal';
|
|
}
|
|
if (RISK_SPAM & (int)$capability->riskbitmask) {
|
|
$riskinfo .= '<a title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot.'/'.$lang.'/Risks">S</a>';
|
|
$rowclasses .= ' riskspam';
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
<tr class="rolecap <?php echo $rowclasses; ?>">
|
|
<td class="name"><?php echo get_capability_string($capability->name); ?></td>
|
|
|
|
<td class="inherit">
|
|
<input type="radio" title="<?php p($strinherit); ?>" name="<?php echo $capability->name; ?>" value="0"
|
|
<?php
|
|
if ($localpermission == CAP_INHERIT) {echo 'checked="checked"';}
|
|
if ($isdisabled) {echo 'disabled="disabled"';}?> />
|
|
</td>
|
|
|
|
<td class="allow <?php if ($isallow) {echo ' capcurrent';} ?>">
|
|
<input type="radio" title="<?php p($strallow); ?>" name="<?php echo $capability->name; ?>"
|
|
<?php echo ' value="'.CAP_ALLOW.'"';
|
|
if ($localpermission == CAP_ALLOW) {echo ' checked="checked"';}
|
|
if ($isdisabled) {echo ' disabled="disabled"';}?> />
|
|
</td>
|
|
|
|
<td class="prevent <?php if ($isprevent) {echo ' capcurrent';} ?>">
|
|
<input type="radio" title="<?php p($strprevent); ?>" name="<?php echo $capability->name; ?>"
|
|
<?php echo ' value="'.CAP_PREVENT.'"';
|
|
if ($localpermission == CAP_PREVENT) {echo ' checked="checked"';}
|
|
if ($isdisabled) {echo ' disabled="disabled"';}?> />
|
|
</td>
|
|
|
|
<td class="prohibit <?php if ($isprohibit) {echo ' capcurrent';} ?>">
|
|
<input type="radio" title="<?php p($strprohibit); ?>" name="<?php echo $capability->name; ?>"
|
|
<?php echo ' value="'.CAP_PROHIBIT.'"';
|
|
if ($localpermission == CAP_PROHIBIT) {echo ' checked="checked"';}
|
|
if ($isdisabled) {echo ' disabled="disabled"';}?> />
|
|
</td>
|
|
<td class="risk"><?php echo $riskinfo; ?></td>
|
|
</tr>
|
|
|
|
<?php } ?>
|
|
</table>
|
|
<br />
|
|
<div align="center">
|
|
<input type="submit" value="<?php print_string('savechanges') ?>" />
|
|
<input type="submit" name="cancel" value="<?php print_string('cancel') ?>" />
|
|
</div>
|
|
</form>
|