1.5.00 fix permission control

This commit is contained in:
Fred Tempez 2024-02-12 13:27:56 +01:00
parent 63f7767460
commit 08fb2d25fd

View File

@ -1755,12 +1755,12 @@ class course extends common
*/
public function permissionControl($funtion, $courseId)
{
switch (self::$actions[$funtion]) {
switch ($this->getUser('group') ) {
case self::GROUP_ADMIN:
return ($this->getUser('group') === self::$actions[$funtion]);
return true;
case self::GROUP_EDITOR:
return (
$this->getUser('group') >= self::$actions[$funtion]
$this->getUser('group') === self::$actions[$funtion]
&& $this->getData(['enrolment', $courseId])
&& ($this->getUser('id') === $this->getData(['course', $courseId, 'author'])
|| array_key_exists($this->getUser('id'), $this->getData(['enrolment', $courseId])) )