Commit 032f08c9 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Create group table before artefact table in install

parent aad91c23
......@@ -220,79 +220,6 @@
<KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="activity_type" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
<FIELD NAME="artefacttype" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="container" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
<FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="atime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="locked" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="title" TYPE="text" NOTNULL="true" />
<FIELD NAME="description" TYPE="text" NOTNULL="false" />
<FIELD NAME="note" TYPE="text" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="typefk" TYPE="foreign" FIELDS="artefacttype" REFTABLE="artefact_installed_type" REFFIELDS="name" />
<KEY NAME="parentfk" TYPE="foreign" FIELDS="parent" REFTABLE="artefact" REFFIELDS="id" />
<KEY NAME="usrfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
<KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
<KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_tag">
<FIELDS>
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="tag" TYPE="char" LENGTH="128" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="artefact,tag" />
<KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_parent_cache">
<FIELDS>
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="dirty" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="artefact,parent" />
<KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
<KEY NAME="parentfk" TYPE="foreign" FIELDS="parent" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_access_usr">
<FIELDS>
<FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="can_republish" TYPE="int" LENGTH="1" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="usr,artefact" />
<KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
<KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_access_role">
<FIELDS>
<FIELD NAME="role" TYPE="text" NOTNULL="true" />
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="can_view" TYPE="int" LENGTH="1" NOTNULL="true" />
<FIELD NAME="can_edit" TYPE="int" LENGTH="1" NOTNULL="true" />
<FIELD NAME="can_republish" TYPE="int" LENGTH="1" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="role,artefact" />
<KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="grouptype">
<FIELDS>
<FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" />
......@@ -370,6 +297,79 @@
<KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
<FIELD NAME="artefacttype" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="container" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
<FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="atime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="locked" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="title" TYPE="text" NOTNULL="true" />
<FIELD NAME="description" TYPE="text" NOTNULL="false" />
<FIELD NAME="note" TYPE="text" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="typefk" TYPE="foreign" FIELDS="artefacttype" REFTABLE="artefact_installed_type" REFFIELDS="name" />
<KEY NAME="parentfk" TYPE="foreign" FIELDS="parent" REFTABLE="artefact" REFFIELDS="id" />
<KEY NAME="usrfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
<KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
<KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_tag">
<FIELDS>
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="tag" TYPE="char" LENGTH="128" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="artefact,tag" />
<KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_parent_cache">
<FIELDS>
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="dirty" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="artefact,parent" />
<KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
<KEY NAME="parentfk" TYPE="foreign" FIELDS="parent" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_access_usr">
<FIELDS>
<FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="can_republish" TYPE="int" LENGTH="1" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="usr,artefact" />
<KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
<KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_access_role">
<FIELDS>
<FIELD NAME="role" TYPE="text" NOTNULL="true" />
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="can_view" TYPE="int" LENGTH="1" NOTNULL="true" />
<FIELD NAME="can_edit" TYPE="int" LENGTH="1" NOTNULL="true" />
<FIELD NAME="can_republish" TYPE="int" LENGTH="1" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="role,artefact" />
<KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="interaction_instance">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
......
......@@ -464,7 +464,7 @@ abstract class GroupType {
'submittableto' => !empty($assessingroles),
));
$roles = $this->get_roles();
if (!in_array($roles, 'admin')) {
if (!in_array('admin', $roles)) {
$roles[] = 'admin';
}
$editingroles = $this->get_view_editing_roles();
......@@ -472,8 +472,8 @@ abstract class GroupType {
insert_record('grouptype_roles', (object) array(
'grouptype' => $type,
'role' => $r,
'edit_views' => in_array($r, $editingroles),
'see_submitted_views' => in_array($r, $assessingroles),
'edit_views' => (int)in_array($r, $editingroles),
'see_submitted_views' => (int)in_array($r, $assessingroles),
));
}
}
......
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