Skip to content
Snippets Groups Projects
Verified Commit d16dcc0b authored by Martin Weise's avatar Martin Weise
Browse files

Fixed some metadata and data issues

parent bd0f09f7
No related branches found
No related tags found
4 merge requests!231CI: Remove build for log-service,!228Better error message handling in the frontend,!223Release of version 1.4.0,!195Resolve "Multiple aliases cause errors"
...@@ -3,6 +3,7 @@ package at.tuwien.entities.database.table; ...@@ -3,6 +3,7 @@ package at.tuwien.entities.database.table;
import at.tuwien.entities.database.Database; import at.tuwien.entities.database.Database;
import at.tuwien.entities.database.table.columns.TableColumn; import at.tuwien.entities.database.table.columns.TableColumn;
import at.tuwien.entities.database.table.constraints.Constraints; import at.tuwien.entities.database.table.constraints.Constraints;
import at.tuwien.entities.user.User;
import lombok.*; import lombok.*;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import net.sf.jsqlparser.statement.select.FromItem; import net.sf.jsqlparser.statement.select.FromItem;
...@@ -44,10 +45,27 @@ public class Table { ...@@ -44,10 +45,27 @@ public class Table {
@Column(name = "created_by", columnDefinition = "VARCHAR(36)") @Column(name = "created_by", columnDefinition = "VARCHAR(36)")
private UUID createdBy; private UUID createdBy;
@ToString.Exclude
@org.springframework.data.annotation.Transient
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({
@JoinColumn(name = "created_by", referencedColumnName = "ID", insertable = false, updatable = false)
})
private User creator;
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(name = "owned_by", columnDefinition = "VARCHAR(36)") @Column(name = "owned_by", columnDefinition = "VARCHAR(36)")
private UUID ownedBy; private UUID ownedBy;
@ToString.Exclude
@org.springframework.data.annotation.Transient
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({
@JoinColumn(name = "owned_by", referencedColumnName = "ID", insertable = false, updatable = false)
})
private User owner;
@Column(name = "tname", nullable = false) @Column(name = "tname", nullable = false)
private String name; private String name;
......
...@@ -142,13 +142,10 @@ export default { ...@@ -142,13 +142,10 @@ export default {
return this.version.substring(0, 10) + 'T' + this.version.substring(11, 19) + 'Z' return this.version.substring(0, 10) + 'T' + this.version.substring(11, 19) + 'Z'
}, },
canModify () { canModify () {
if (!this.user || !this.access || !this.table || !this.table.creator) { if (!this.user || !this.access || !this.table) {
return false return false
} }
if (this.table.creator.username === this.user.username) { if (this.access.type === 'write_own' && this.table.owner.id === this.user.id) {
return true
}
if (this.access.type === 'write_own' && this.table.creator.username === this.user.username) {
return true return true
} }
return this.access.type === 'write_all' return this.access.type === 'write_all'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment