Commit 4165e4ab authored by Richard Mansfield's avatar Richard Mansfield
Browse files

User can_publish_artefact method too restrictive (bug #865911)

The can_publish_artefact method on the User class, introduced in
commit aba54873

 (see bug #655631) is out of line with other
permissions on the site when it comes to institution artefacts.

Any institution member can include institution files on one of their
own pages, but this method (currently used when putting images into
forum posts) only allows publishing by institutional admins.

This change adds publishing permission on institution artefacts for
all institution members.

Change-Id: I3f8a15de573de6f58497ae45839647b462fa5e89
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 7baf61a6
......@@ -935,11 +935,17 @@ class User {
}
public function can_publish_artefact($a) {
if (($this->get('id') and $this->get('id') == $a->get('owner'))
|| ($a->get('institution') and $this->is_institutional_admin($a->get('institution')))) {
if (($this->get('id') and $this->get('id') == $a->get('owner'))) {
return true;
}
if ($i = $a->get('institution')) {
if ($i == 'mahara') {
return $this->get('admin');
}
return $this->in_institution($i);
}
if (!$group = $a->get('group')) {
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment