128 lines
2.2 KiB
JavaScript
128 lines
2.2 KiB
JavaScript
/*
|
|
|
|
Copyright (c) 2020, 2023, The Unified Company.
|
|
|
|
This code is part of Unify.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the ESA Software Community License - Strong Copyleft LICENSE,
|
|
as published by the ESA.
|
|
See the ESA Software Community License - Strong Copyleft LICENSE, for more details.
|
|
|
|
https://unifyjs.org
|
|
|
|
*/
|
|
|
|
|
|
import tools from '../unify/tools.js';
|
|
|
|
import document from '../unify/document.js';
|
|
|
|
import serverTable from '../server/table.js';
|
|
|
|
import Console from '../server/console.js';
|
|
|
|
import datatypes from '../unify/datatype.js';
|
|
|
|
import collection from '../unify/collection.js';
|
|
|
|
import defaultObject from '../unify/defaultObject.js';
|
|
|
|
import signed from '../unify/signed.js';
|
|
|
|
import unify from '../unify/unify.js';
|
|
|
|
|
|
class user extends serverTable {
|
|
|
|
username = new username();
|
|
|
|
salt = new salt();
|
|
|
|
hash = new hash();
|
|
|
|
comments = new collection( comment ); // user -> comment -> owner (user)
|
|
|
|
}
|
|
|
|
export default class table extends serverTable{
|
|
|
|
__className = "table";
|
|
|
|
signed = new signed();
|
|
|
|
user = "userplaceholder";
|
|
|
|
permissions = new Array();
|
|
|
|
secure = false;
|
|
|
|
|
|
constructor( argument, parent ) {
|
|
|
|
super();
|
|
|
|
unify.extend( this );
|
|
|
|
// Todo bug, More cores this doesn't work serverside parsing of tables.
|
|
// console.log(typeof global);
|
|
//if( typeof global != "undefined" && global.core && !this.table && parameter != "skip_table_parsing" ) {
|
|
|
|
// global.core.tableManager.parse( this );
|
|
|
|
//}
|
|
|
|
if( argument ) {
|
|
|
|
|
|
|
|
this.handleArgument( argument );
|
|
|
|
}
|
|
|
|
if( parent ) {
|
|
|
|
this.parent = parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
handleArgument( argument ) {
|
|
|
|
if( typeof argument == "number" ) {
|
|
|
|
this.id = argument;
|
|
|
|
}
|
|
|
|
if( tools.getClassName( argument ) == "collection" ) {
|
|
|
|
//console.log("set collection of table", this.constructor.name ) ;
|
|
|
|
this.setCollection( argument );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getCollection() {
|
|
|
|
if( this.collections.length > 0) {
|
|
|
|
return this.collections[0];
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|