mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 01:49:05 +02:00
Merge branch 'master' into permission_rework
This commit is contained in:
commit
33f8d2ba9e
109 changed files with 5095 additions and 2860 deletions
|
@ -56,7 +56,7 @@ Part-DB is also used by small companies and universities for managing their inve
|
|||
## Requirements
|
||||
* A **web server** (like Apache2 or nginx) that is capable of running [Symfony 5](https://symfony.com/doc/current/reference/requirements.html),
|
||||
this includes a minimum PHP version of **PHP 7.4**
|
||||
* A **MySQL** (at least 5.6.5) /**MariaDB** (at least 10.0.1) database server if you do not want to use SQLite.
|
||||
* A **MySQL** (at least 5.7) /**MariaDB** (at least 10.2.2) database server if you do not want to use SQLite.
|
||||
* Shell access to your server is highly suggested!
|
||||
* For building the client side assets **yarn** and **nodejs** is needed.
|
||||
|
||||
|
|
|
@ -187,16 +187,47 @@ Editor.defaultConfig = {
|
|||
},
|
||||
'fontSize': {
|
||||
options: [
|
||||
8,
|
||||
11,
|
||||
13,
|
||||
'default',
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
],
|
||||
supportAllValues: true
|
||||
},
|
||||
// Allow all HTML features for our labels
|
||||
htmlSupport: {
|
||||
allow: [
|
||||
{
|
||||
name: /.*/,
|
||||
attributes: true,
|
||||
classes: true,
|
||||
styles: true
|
||||
}
|
||||
],
|
||||
disallow: [
|
||||
//Some rudimentary protection against XSS, even if it is not really needed as this is only parsed by DOMHTML which does not support any kind of script execution.
|
||||
{
|
||||
name: /^(head|body|html|script)$/i,
|
||||
},
|
||||
{
|
||||
name: /.*/,
|
||||
attributes: /^on.*/i
|
||||
}
|
||||
]
|
||||
},
|
||||
image: {
|
||||
toolbar: [
|
||||
'imageTextAlternative',
|
||||
|
@ -214,7 +245,7 @@ Editor.defaultConfig = {
|
|||
'tableCellProperties',
|
||||
'tableProperties'
|
||||
]
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default { Editor, EditorWatchdog };
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
.cke_placeholder {
|
||||
background: #ffff00;
|
||||
padding: 4px 2px;
|
||||
padding: 1px 2px;
|
||||
outline-offset: -2px;
|
||||
line-height: 1em;
|
||||
margin: 0 1px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.cke_placeholder::selection {
|
||||
|
|
|
@ -93,6 +93,16 @@ const PLACEHOLDERS = [
|
|||
['[[CREATION_DATE]]', 'Creation datetime'],
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Barcodes',
|
||||
entries: [
|
||||
['[[1D_CONTENT]]', 'Content of the 1D barcodes (like Code 39)'],
|
||||
['[[2D_CONTENT]]', 'Content of the 2D barcodes (QR codes)'],
|
||||
['[[BARCODE_QR]]', 'QR code linking to this element'],
|
||||
['[[BARCODE_C128]]', 'Code 128 barcode linking to this element'],
|
||||
['[[BARCODE_C39]]', 'Code 39 barcode linking to this element'],
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Globals',
|
||||
entries: [
|
||||
|
@ -102,7 +112,8 @@ const PLACEHOLDERS = [
|
|||
['[[DATE]]', 'Current date'],
|
||||
['[[TIME]]', 'Current time'],
|
||||
['[[INSTALL_NAME]]', 'Instance name'],
|
||||
['[[TYPE]]', 'Target type']
|
||||
['[[TYPE]]', 'Target type'],
|
||||
['[[INSTANCE_URL]]', 'URL of this Part-DB instance']
|
||||
],
|
||||
},
|
||||
];
|
||||
|
@ -136,6 +147,7 @@ function getDropdownItemsDefinitions(t) {
|
|||
model: new Model( {
|
||||
commandParam: entry[0],
|
||||
label: t(entry[1]),
|
||||
tooltip: entry[0],
|
||||
withText: true
|
||||
} ),
|
||||
};
|
||||
|
|
|
@ -37,6 +37,14 @@ Object.assign( window.CKEDITOR_TRANSLATIONS[ 'de' ].dictionary, {
|
|||
'Storage location': 'Lagerort',
|
||||
'Storage location (Full path)': 'Lagerort (Vollständiger Pfad)',
|
||||
|
||||
|
||||
'Barcodes': 'Barcodes',
|
||||
'Content of the 1D barcodes (like Code 39)': 'Inhalt der 1D Barcodes (z.B. Code 39)',
|
||||
'Content of the 2D barcodes (QR codes)': 'Inhalt der 2D Barcodes (QR Codes)',
|
||||
'QR code linking to this element': 'QR Code verknüpft mit diesem Element',
|
||||
'Code 128 barcode linking to this element': 'Code 128 Barcode verknüpft mit diesem Element',
|
||||
'Code 39 barcode linking to this element': 'Code 39 Barcode verknüpft mit diesem Element',
|
||||
|
||||
'Location ID': 'Lagerort ID',
|
||||
'Name': 'Name',
|
||||
'Full path': 'Vollständiger Pfad',
|
||||
|
@ -50,5 +58,6 @@ Object.assign( window.CKEDITOR_TRANSLATIONS[ 'de' ].dictionary, {
|
|||
'Current time': 'Aktuelle Zeit',
|
||||
'Instance name': 'Instanzname',
|
||||
'Target type': 'Zieltyp',
|
||||
'URL of this Part-DB instance': 'URL dieser Part-DB Instanz',
|
||||
|
||||
} );
|
|
@ -6,6 +6,7 @@ import { default as HTMLLabelEditor } from "../../ckeditor/html_label";
|
|||
|
||||
import EditorWatchdog from '@ckeditor/ckeditor5-watchdog/src/editorwatchdog';
|
||||
|
||||
import "../../css/ckeditor.css";
|
||||
|
||||
/* stimulusFetch: 'lazy' */
|
||||
export default class extends Controller {
|
||||
|
@ -43,6 +44,13 @@ export default class extends Controller {
|
|||
editor.enableReadOnlyMode("readonly");
|
||||
}
|
||||
|
||||
//Apply additional styles
|
||||
const editor_div = editor.ui.view.element;
|
||||
const new_classes = this.element.dataset.ckClass;
|
||||
if (editor_div && new_classes) {
|
||||
editor_div.classList.add(...new_classes.split(","));
|
||||
}
|
||||
|
||||
console.log(editor);
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
@ -6,6 +6,8 @@ export default class extends TreeController {
|
|||
|
||||
_storage_key;
|
||||
|
||||
_lastUpdate;
|
||||
|
||||
connect() {
|
||||
//Check if the tree is already initialized, if so then skip initialization (useful when going back) to in history using Turbo
|
||||
if(this._isInitialized()) {
|
||||
|
@ -31,6 +33,25 @@ export default class extends TreeController {
|
|||
} else {
|
||||
this.setMode(default_mode);
|
||||
}
|
||||
|
||||
//Register an event listener which checks if the tree needs to be updated
|
||||
document.addEventListener('turbo:render', this.doUpdateIfNeeded.bind(this));
|
||||
}
|
||||
|
||||
doUpdateIfNeeded()
|
||||
{
|
||||
const info_element = document.getElementById('sidebar-last-time-updated');
|
||||
const date_str = info_element.dataset.lastUpdate;
|
||||
const server_last_update = new Date(date_str);
|
||||
|
||||
if(this._lastUpdate < server_last_update) {
|
||||
console.log("Sidebar tree is outdated, reloading (last update: " + this._lastUpdate + ", server update: " + server_last_update + ")");
|
||||
this._lastUpdate = new Date();
|
||||
|
||||
|
||||
|
||||
this.reinitTree();
|
||||
}
|
||||
}
|
||||
|
||||
setMode(mode) {
|
||||
|
@ -47,6 +68,9 @@ export default class extends TreeController {
|
|||
this.sourceTextTarget.innerText = text;
|
||||
|
||||
this.setURL(url);
|
||||
|
||||
//Update the last update time
|
||||
this._lastUpdate = new Date();
|
||||
}
|
||||
|
||||
changeDataSource(event)
|
||||
|
@ -61,5 +85,7 @@ export default class extends TreeController {
|
|||
|
||||
//Save the mode in local storage
|
||||
localStorage.setItem(this._storage_key, mode);
|
||||
|
||||
this._lastUpdate = new Date();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,14 +70,7 @@ export default class extends Controller {
|
|||
onNodeSelected: (event) => {
|
||||
const node = event.detail.node;
|
||||
if (node.href) {
|
||||
|
||||
//Simulate a click so we just change the inner frame
|
||||
let a = document.createElement('a');
|
||||
a.setAttribute('href', node.href);
|
||||
a.innerHTML = "";
|
||||
this.element.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.Turbo.visit(node.href, {action: "advance"});
|
||||
}
|
||||
},
|
||||
//onNodeContextmenu: contextmenu_handler,
|
||||
|
|
|
@ -65,6 +65,7 @@ body {
|
|||
|
||||
/** Hide scrollbar in old Firefox and Edge **/
|
||||
-ms-overflow-style: none;
|
||||
/*noinspection CssInvalidPropertyValue*/
|
||||
overflow: -moz-scrollbars-none;
|
||||
/*noinspection CssUnknownProperty*/
|
||||
scrollbar-width: none;
|
||||
|
@ -94,6 +95,7 @@ body {
|
|||
|
||||
/** Hide scrollbar in Firefox and Edge **/
|
||||
-ms-overflow-style: none;
|
||||
/*noinspection CssInvalidPropertyValue*/
|
||||
overflow: -moz-scrollbars-none;
|
||||
/* Use standard version for hiding the scrollbar */
|
||||
scrollbar-width: none;
|
||||
|
@ -252,10 +254,10 @@ a.badge {
|
|||
.bg-primary-striped {
|
||||
background: repeating-linear-gradient(
|
||||
-45deg,
|
||||
var(--primary),
|
||||
var(--primary) 10px,
|
||||
var(--info) 10px,
|
||||
var(--info) 20px
|
||||
var(--bs-primary),
|
||||
var(--bs-primary) 10px,
|
||||
var(--bs-info) 10px,
|
||||
var(--bs-info) 20px
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -377,7 +379,7 @@ btn-xs
|
|||
margin-right: auto;
|
||||
}
|
||||
|
||||
.darkmode--activated .hoverpic:hover, {
|
||||
.darkmode--activated .hoverpic:hover {
|
||||
background: black;
|
||||
}
|
||||
|
||||
|
@ -722,16 +724,20 @@ div.dataTables_wrapper div.dataTables_info {
|
|||
white-space: normal;
|
||||
}
|
||||
|
||||
th.select-checkbox {
|
||||
min-width: 10px;
|
||||
}
|
||||
|
||||
|
||||
/*******************************
|
||||
Parts datatable styling
|
||||
******************************/
|
||||
.attach-table-icon {
|
||||
margin-right: 0.7em;
|
||||
color: var(--gray);
|
||||
color: var(--bs-gray);
|
||||
}
|
||||
.attach-table-icon:hover {
|
||||
color: var(--gray-dark);
|
||||
color: var(--bs-gray-dark);
|
||||
}
|
||||
.badge-table {
|
||||
margin-right: 0.2em;
|
||||
|
|
19
assets/css/ckeditor.css
Normal file
19
assets/css/ckeditor.css
Normal file
|
@ -0,0 +1,19 @@
|
|||
/********************************************************************
|
||||
* HTML Label style override
|
||||
*********************************************************************/
|
||||
|
||||
/** Should be the same settings, as in label_style.css */
|
||||
.ck-html-label .ck-content {
|
||||
font-family: "DejaVu Sans Mono", monospace;
|
||||
font-size: 12px;
|
||||
line-height: 1.0;
|
||||
font-size-adjust: 1.5;
|
||||
}
|
||||
|
||||
.ck-html-label .ck-content p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ck-html-label .ck-content hr {
|
||||
margin: 2px;
|
||||
}
|
|
@ -11,4 +11,12 @@
|
|||
}
|
||||
.dropdown-item .picker-hs {
|
||||
display: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
/** Bootstrap-select Unhide on selected element */
|
||||
.picker-us {
|
||||
display: inherit;
|
||||
}
|
||||
.dropdown-item .picker-us {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
import u2fApi from 'u2f-api'
|
||||
|
||||
'use strict'
|
||||
|
||||
window.u2fauth = window.u2fauth || {}
|
||||
|
||||
u2fauth.formId = 'u2fForm'
|
||||
u2fauth.authCodeId = '_auth_code'
|
||||
u2fauth.keynameId = 'u2fkeyname'
|
||||
u2fauth.pressButtonId = 'u2fpressbutton'
|
||||
u2fauth.errorId = 'u2fError'
|
||||
u2fauth.timeout = 30
|
||||
u2fauth.errorTranslation = {
|
||||
1: 'Unknown Error',
|
||||
2: 'Bad Request',
|
||||
3: 'Client configuration not supported',
|
||||
4: 'Device already registered or ineligible',
|
||||
5: 'Timeout. Click to retry'
|
||||
}
|
||||
|
||||
u2fauth.ready = function (fn) {
|
||||
if (document.readyState !== 'loading') {
|
||||
fn()
|
||||
} else if (document.addEventListener) {
|
||||
document.addEventListener('DOMContentLoaded', fn)
|
||||
} else {
|
||||
document.attachEvent('onreadystatechange', function () {
|
||||
if (document.readyState !== 'loading') { fn() }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
u2fauth.authenticate = function () {
|
||||
u2fauth.clearError()
|
||||
u2fauth.showPressButton()
|
||||
|
||||
var form = document.getElementById(u2fauth.formId)
|
||||
var request = JSON.parse(form.dataset.request)
|
||||
|
||||
u2fApi.isSupported()
|
||||
.then(function (supported) {
|
||||
if (supported) {
|
||||
return u2fApi.sign(request, u2fauth.timeout)
|
||||
.then(response => {
|
||||
u2fauth.hidePressButton()
|
||||
u2fauth.submit(form, response)
|
||||
})
|
||||
} else {
|
||||
alert('Browser not supported')
|
||||
}
|
||||
})
|
||||
.catch(data => {
|
||||
u2fauth.hidePressButton()
|
||||
u2fauth.showError(data.metaData.code, u2fauth.authenticate)
|
||||
})
|
||||
}
|
||||
|
||||
u2fauth.register = function () {
|
||||
u2fauth.clearError()
|
||||
u2fauth.hideKeyname()
|
||||
u2fauth.showPressButton()
|
||||
|
||||
var form = document.getElementById(u2fauth.formId)
|
||||
var request = JSON.parse(form.dataset.request)
|
||||
|
||||
u2fApi.isSupported()
|
||||
.then(function (supported) {
|
||||
if (supported) {
|
||||
return u2fApi.register(request[0], request[1], u2fauth.timeout)
|
||||
.then(response => {
|
||||
u2fauth.hidePressButton()
|
||||
u2fauth.submit(form, response)
|
||||
})
|
||||
} else {
|
||||
alert('Browser not supported')
|
||||
}
|
||||
})
|
||||
.catch(data => {
|
||||
console.info(data)
|
||||
u2fauth.hidePressButton()
|
||||
u2fauth.showError(data.metaData.code, u2fauth.register)
|
||||
})
|
||||
}
|
||||
|
||||
u2fauth.submit = function (form, data) {
|
||||
var codeField = document.getElementById(u2fauth.authCodeId)
|
||||
codeField.value = JSON.stringify(data)
|
||||
form.submit()
|
||||
}
|
||||
|
||||
u2fauth.hideKeyname = function () {
|
||||
var keyname = document.getElementById(u2fauth.keynameId)
|
||||
keyname.style.display = 'none'
|
||||
}
|
||||
|
||||
u2fauth.hidePressButton = function () {
|
||||
var pressButton = document.getElementById(u2fauth.pressButtonId)
|
||||
pressButton.style.display = 'none'
|
||||
}
|
||||
|
||||
u2fauth.showPressButton = function () {
|
||||
var pressButton = document.getElementById(u2fauth.pressButtonId)
|
||||
pressButton.style.display = 'block'
|
||||
}
|
||||
|
||||
u2fauth.clearError = function () {
|
||||
var errorDisplay = document.getElementById(u2fauth.errorId)
|
||||
errorDisplay.style.display = 'none'
|
||||
errorDisplay.innerText = ''
|
||||
}
|
||||
|
||||
u2fauth.showError = function (error, callback) {
|
||||
var errorDisplay = document.getElementById(u2fauth.errorId)
|
||||
errorDisplay.style.display = 'block'
|
||||
errorDisplay.innerText = u2fauth.errorTranslation[error]
|
||||
errorDisplay.onclick = callback
|
||||
}
|
||||
|
||||
u2fauth.ready(function () {
|
||||
const form = document.getElementById('u2fForm')
|
||||
if (!form) {
|
||||
return
|
||||
}
|
||||
const type = form.dataset.action
|
||||
|
||||
if (type === 'auth') {
|
||||
u2fauth.authenticate()
|
||||
} else if (type === 'reg' && form.addEventListener) {
|
||||
form.addEventListener('submit', function (event) {
|
||||
event.preventDefault()
|
||||
u2fauth.register()
|
||||
}, false)
|
||||
}
|
||||
})
|
208
assets/js/webauthn_tfa.js
Normal file
208
assets/js/webauthn_tfa.js
Normal file
|
@ -0,0 +1,208 @@
|
|||
'use strict'
|
||||
|
||||
class WebauthnTFA {
|
||||
|
||||
// Decodes a Base64Url string
|
||||
_base64UrlDecode = (input) => {
|
||||
input = input
|
||||
.replace(/-/g, '+')
|
||||
.replace(/_/g, '/');
|
||||
|
||||
const pad = input.length % 4;
|
||||
if (pad) {
|
||||
if (pad === 1) {
|
||||
throw new Error('InvalidLengthError: Input base64url string is the wrong length to determine padding');
|
||||
}
|
||||
input += new Array(5-pad).join('=');
|
||||
}
|
||||
|
||||
return window.atob(input);
|
||||
};
|
||||
|
||||
// Converts an array of bytes into a Base64Url string
|
||||
_arrayToBase64String = (a) => btoa(String.fromCharCode(...a));
|
||||
|
||||
// Prepares the public key options object returned by the Webauthn Framework
|
||||
_preparePublicKeyOptions = publicKey => {
|
||||
//Convert challenge from Base64Url string to Uint8Array
|
||||
publicKey.challenge = Uint8Array.from(
|
||||
this._base64UrlDecode(publicKey.challenge),
|
||||
c => c.charCodeAt(0)
|
||||
);
|
||||
|
||||
//Convert the user ID from Base64 string to Uint8Array
|
||||
if (publicKey.user !== undefined) {
|
||||
publicKey.user = {
|
||||
...publicKey.user,
|
||||
id: Uint8Array.from(
|
||||
window.atob(publicKey.user.id),
|
||||
c => c.charCodeAt(0)
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
//If excludeCredentials is defined, we convert all IDs to Uint8Array
|
||||
if (publicKey.excludeCredentials !== undefined) {
|
||||
publicKey.excludeCredentials = publicKey.excludeCredentials.map(
|
||||
data => {
|
||||
return {
|
||||
...data,
|
||||
id: Uint8Array.from(
|
||||
this._base64UrlDecode(data.id),
|
||||
c => c.charCodeAt(0)
|
||||
),
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (publicKey.allowCredentials !== undefined) {
|
||||
publicKey.allowCredentials = publicKey.allowCredentials.map(
|
||||
data => {
|
||||
return {
|
||||
...data,
|
||||
id: Uint8Array.from(
|
||||
this._base64UrlDecode(data.id),
|
||||
c => c.charCodeAt(0)
|
||||
),
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return publicKey;
|
||||
};
|
||||
|
||||
// Prepares the public key credentials object returned by the authenticator
|
||||
_preparePublicKeyCredentials = data => {
|
||||
const publicKeyCredential = {
|
||||
id: data.id,
|
||||
type: data.type,
|
||||
rawId: this._arrayToBase64String(new Uint8Array(data.rawId)),
|
||||
response: {
|
||||
clientDataJSON: this._arrayToBase64String(
|
||||
new Uint8Array(data.response.clientDataJSON)
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
if (data.response.attestationObject !== undefined) {
|
||||
publicKeyCredential.response.attestationObject = this._arrayToBase64String(
|
||||
new Uint8Array(data.response.attestationObject)
|
||||
);
|
||||
}
|
||||
|
||||
if (data.response.authenticatorData !== undefined) {
|
||||
publicKeyCredential.response.authenticatorData = this._arrayToBase64String(
|
||||
new Uint8Array(data.response.authenticatorData)
|
||||
);
|
||||
}
|
||||
|
||||
if (data.response.signature !== undefined) {
|
||||
publicKeyCredential.response.signature = this._arrayToBase64String(
|
||||
new Uint8Array(data.response.signature)
|
||||
);
|
||||
}
|
||||
|
||||
if (data.response.userHandle !== undefined) {
|
||||
publicKeyCredential.response.userHandle = this._arrayToBase64String(
|
||||
new Uint8Array(data.response.userHandle)
|
||||
);
|
||||
}
|
||||
|
||||
return publicKeyCredential;
|
||||
};
|
||||
|
||||
|
||||
constructor()
|
||||
{
|
||||
const register_dom_ready = (fn) => {
|
||||
document.addEventListener('turbo:load', fn)
|
||||
}
|
||||
|
||||
register_dom_ready(() => {
|
||||
this.registerForms();
|
||||
});
|
||||
}
|
||||
|
||||
registerForms()
|
||||
{
|
||||
//Find all forms which have an data-webauthn-tfa-action attribute
|
||||
const forms = document.querySelectorAll('form[data-webauthn-tfa-action]');
|
||||
|
||||
forms.forEach((form) => {
|
||||
console.debug('Found webauthn TFA form with action: ' + form.getAttribute('data-webauthn-tfa-action'), form);
|
||||
//Ensure that the form has webauthn data
|
||||
|
||||
const dataString = form.getAttribute('data-webauthn-tfa-data')
|
||||
const action = form.getAttribute('data-webauthn-tfa-action');
|
||||
|
||||
if (!dataString) {
|
||||
console.error('Form does not have webauthn data, can not continue!', form);
|
||||
return;
|
||||
}
|
||||
|
||||
//Convert dataString to the needed dataObject
|
||||
const dataObject = JSON.parse(dataString);
|
||||
const options = this._preparePublicKeyOptions(dataObject);
|
||||
|
||||
|
||||
if(action === 'authenticate'){
|
||||
this.authenticate(form, {publicKey: options});
|
||||
}
|
||||
|
||||
if(action === 'register'){
|
||||
//Register submit action, so we can do the registration on submit
|
||||
form.addEventListener('submit', (e) => {
|
||||
e.preventDefault();
|
||||
this.register(form, {publicKey: options});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the form with the given result data
|
||||
* @param form
|
||||
* @param data
|
||||
* @private
|
||||
*/
|
||||
_submit(form, data)
|
||||
{
|
||||
const resultField = document.getElementById('_auth_code');
|
||||
resultField.value = JSON.stringify(data)
|
||||
form.submit();
|
||||
}
|
||||
|
||||
authenticate(form, authData)
|
||||
{
|
||||
navigator.credentials.get(authData)
|
||||
.then((credential) => {
|
||||
//Convert our credential to a form which can be JSON encoded
|
||||
let data = this._preparePublicKeyCredentials(credential);
|
||||
|
||||
this._submit(form, data)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("WebAuthn Authentication error: ", error);
|
||||
alert("Error: " + error)
|
||||
});
|
||||
}
|
||||
|
||||
register(form, authData)
|
||||
{
|
||||
navigator.credentials.create(authData)
|
||||
.then((credential) => {
|
||||
//Convert our credential to a form which can be JSON encoded
|
||||
let data = this._preparePublicKeyCredentials(credential);
|
||||
|
||||
this._submit(form, data)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("WebAuthn Registration error: ", error);
|
||||
alert("Error: " + error)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.webauthnTFA = new WebauthnTFA();
|
|
@ -10,17 +10,19 @@
|
|||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"beberlei/doctrineextensions": "^1.2",
|
||||
"brick/math": "^0.10.2",
|
||||
"brick/math": "^0.8.15",
|
||||
"composer/package-versions-deprecated": "1.11.99.4",
|
||||
"doctrine/annotations": "^1.6",
|
||||
"doctrine/doctrine-bundle": "^2.0",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.0",
|
||||
"doctrine/orm": "^2.9",
|
||||
"doctrine/dbal": "3.4.*",
|
||||
"dompdf/dompdf": "^2.0.0",
|
||||
"erusev/parsedown": "^1.7",
|
||||
"florianv/swap": "^4.0",
|
||||
"florianv/swap-bundle": "dev-master",
|
||||
"gregwar/captcha-bundle": "^2.1.0",
|
||||
"jbtronics/2fa-webauthn": "^1.0.0",
|
||||
"league/html-to-markdown": "^5.0.1",
|
||||
"liip/imagine-bundle": "^2.2",
|
||||
"nelmio/security-bundle": "^3.0",
|
||||
|
@ -69,8 +71,8 @@
|
|||
"twig/inky-extra": "^3.0",
|
||||
"twig/intl-extra": "^3.0",
|
||||
"twig/markdown-extra": "^3.0",
|
||||
"webmozart/assert": "^1.4",
|
||||
"r/u2f-two-factor-bundle": "dev-scheb/2fa-support"
|
||||
"web-auth/webauthn-symfony-bundle": "^3.3",
|
||||
"webmozart/assert": "^1.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"dama/doctrine-test-bundle": "^7.0",
|
||||
|
@ -144,9 +146,5 @@
|
|||
}
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/jbtronics/u2f-two-factor-bundle.git"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
2232
composer.lock
generated
2232
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -23,6 +23,8 @@ return [
|
|||
Florianv\SwapBundle\FlorianvSwapBundle::class => ['all' => true],
|
||||
Nelmio\SecurityBundle\NelmioSecurityBundle::class => ['all' => true],
|
||||
Symfony\UX\Turbo\TurboBundle::class => ['all' => true],
|
||||
Jbtronics\TFAWebauthn\TFAWebauthnBundle::class => ['all' => true],
|
||||
Scheb\TwoFactorBundle\SchebTwoFactorBundle::class => ['all' => true],
|
||||
R\U2FTwoFactorBundle\RU2FTwoFactorBundle::class => ['all' => true],
|
||||
SpomkyLabs\CborBundle\SpomkyLabsCborBundle::class => ['all' => true],
|
||||
Webauthn\Bundle\WebauthnBundle::class => ['all' => true],
|
||||
];
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
ru2_f_two_factor:
|
||||
formTemplate: "/security/U2F/u2f_login.html.twig"
|
||||
registerTemplate: "/security/U2F/u2f_register.html.twig"
|
||||
authCodeParameter: _auth_code
|
|
@ -25,4 +25,4 @@ scheb_two_factor:
|
|||
# If you're using guard-based authentication, you have to use this one:
|
||||
# - Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken
|
||||
# If you're using authenticator-based security (introduced in Symfony 5.1), you have to use this one:
|
||||
# - Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken
|
||||
# - Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken
|
|
@ -16,6 +16,7 @@ twig:
|
|||
error_page_admin_email: '%partdb.error_pages.admin_email%'
|
||||
error_page_show_help: '%partdb.error_pages.show_help%'
|
||||
sidebar_items: '%partdb.sidebar.items%'
|
||||
sidebar_tree_updater: '@App\Services\Trees\SidebarTreeUpdater'
|
||||
|
||||
when@test:
|
||||
twig:
|
||||
|
|
5
config/packages/webauthn_2fa.yaml
Normal file
5
config/packages/webauthn_2fa.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
tfa_webauthn:
|
||||
enabled: true
|
||||
template: security/Webauthn/webauthn_login.html.twig
|
||||
|
||||
rpName: '%partdb.title%'
|
|
@ -4,8 +4,4 @@
|
|||
_controller: "scheb_two_factor.form_controller::form"
|
||||
|
||||
2fa_login_check:
|
||||
path: /{_locale}/2fa_check
|
||||
|
||||
r_u2f_register:
|
||||
resource: "@RU2FTwoFactorBundle/Resources/config/routing.yml"
|
||||
prefix: /{_locale}/user
|
||||
path: /{_locale}/2fa_check
|
535
migrations/Version20220925162725.php
Normal file
535
migrations/Version20220925162725.php
Normal file
|
@ -0,0 +1,535 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use App\Migration\AbstractMultiPlatformMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20220925162725 extends AbstractMultiPlatformMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add indices to improve performance';
|
||||
}
|
||||
|
||||
public function mySQLUp(Schema $schema): void
|
||||
{
|
||||
//Change row format to dynamic to allow longer indices (this step is only needed for databases created with an older MySQL/MariaDB version
|
||||
$this->addSql('ALTER TABLE attachments ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE attachment_types ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE categories ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE currencies ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE devices ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE device_parts ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE footprints ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE `groups` ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE label_profiles ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE log ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE manufacturers ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE measurement_units ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE migration_versions ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE orderdetails ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE parameters ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE parts ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE part_lots ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE pricedetails ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE storelocations ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE suppliers ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE u2f_keys ROW_FORMAT=DYNAMIC');
|
||||
$this->addSql('ALTER TABLE users ROW_FORMAT=DYNAMIC');
|
||||
|
||||
//Normalize charset encoding for all tables, as old installations might have different encodings
|
||||
$this->addSql('ALTER TABLE attachments convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE attachment_types convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE categories convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE currencies convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE devices convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE device_parts convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE footprints convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE `groups` convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE label_profiles convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE log convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE manufacturers convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE measurement_units convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE migration_versions convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE orderdetails convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE parameters convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE parts convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE part_lots convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE pricedetails convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE storelocations convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE suppliers convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE u2f_keys convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
$this->addSql('ALTER TABLE users convert to character set utf8mb4 collate utf8mb4_unicode_ci');
|
||||
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE INDEX attachment_types_idx_name ON attachment_types (name)');
|
||||
$this->addSql('CREATE INDEX attachment_types_idx_parent_name ON attachment_types (parent_id, name)');
|
||||
$this->addSql('ALTER TABLE attachments CHANGE type_id type_id INT NOT NULL');
|
||||
$this->addSql('CREATE INDEX attachments_idx_id_element_id_class_name ON attachments (id, element_id, class_name)');
|
||||
$this->addSql('CREATE INDEX attachments_idx_class_name_id ON attachments (class_name, id)');
|
||||
$this->addSql('CREATE INDEX attachment_name_idx ON attachments (name)');
|
||||
$this->addSql('CREATE INDEX attachment_element_idx ON attachments (class_name, element_id)');
|
||||
$this->addSql('ALTER TABLE categories CHANGE partname_regex partname_regex LONGTEXT NOT NULL, CHANGE partname_hint partname_hint LONGTEXT NOT NULL, CHANGE default_description default_description LONGTEXT NOT NULL, CHANGE default_comment default_comment LONGTEXT NOT NULL');
|
||||
$this->addSql('CREATE INDEX category_idx_name ON categories (name)');
|
||||
$this->addSql('CREATE INDEX category_idx_parent_name ON categories (parent_id, name)');
|
||||
$this->addSql('ALTER TABLE currencies CHANGE exchange_rate exchange_rate NUMERIC(11, 5) DEFAULT NULL COMMENT \'(DC2Type:big_decimal)\'');
|
||||
$this->addSql('CREATE INDEX currency_idx_name ON currencies (name)');
|
||||
$this->addSql('CREATE INDEX currency_idx_parent_name ON currencies (parent_id, name)');
|
||||
$this->addSql('ALTER TABLE device_parts CHANGE mountnames mountnames LONGTEXT NOT NULL');
|
||||
$this->addSql('CREATE INDEX footprint_idx_name ON footprints (name)');
|
||||
$this->addSql('CREATE INDEX footprint_idx_parent_name ON footprints (parent_id, name)');
|
||||
$this->addSql('CREATE INDEX group_idx_name ON `groups` (name)');
|
||||
$this->addSql('CREATE INDEX group_idx_parent_name ON `groups` (parent_id, name)');
|
||||
$this->addSql('ALTER TABLE log CHANGE level level TINYINT(4) NOT NULL');
|
||||
$this->addSql('CREATE INDEX log_idx_type ON log (type)');
|
||||
$this->addSql('CREATE INDEX log_idx_type_target ON log (type, target_type, target_id)');
|
||||
$this->addSql('CREATE INDEX log_idx_datetime ON log (datetime)');
|
||||
$this->addSql('CREATE INDEX manufacturer_name ON manufacturers (name)');
|
||||
$this->addSql('CREATE INDEX manufacturer_idx_parent_name ON manufacturers (parent_id, name)');
|
||||
$this->addSql('CREATE INDEX unit_idx_name ON measurement_units (name)');
|
||||
$this->addSql('CREATE INDEX unit_idx_parent_name ON measurement_units (parent_id, name)');
|
||||
$this->addSql('CREATE INDEX orderdetails_supplier_part_nr ON orderdetails (supplierpartnr)');
|
||||
$this->addSql('CREATE INDEX parameter_name_idx ON parameters (name)');
|
||||
$this->addSql('CREATE INDEX parameter_group_idx ON parameters (param_group)');
|
||||
$this->addSql('CREATE INDEX parameter_type_element_idx ON parameters (type, element_id)');
|
||||
$this->addSql('CREATE INDEX part_lots_idx_instock_un_expiration_id_part ON part_lots (instock_unknown, expiration_date, id_part)');
|
||||
$this->addSql('CREATE INDEX part_lots_idx_needs_refill ON part_lots (needs_refill)');
|
||||
$this->addSql('ALTER TABLE parts CHANGE description description LONGTEXT NOT NULL, CHANGE comment comment LONGTEXT NOT NULL');
|
||||
$this->addSql('CREATE INDEX parts_idx_datet_name_last_id_needs ON parts (datetime_added, name, last_modified, id, needs_review)');
|
||||
$this->addSql('CREATE INDEX parts_idx_name ON parts (name)');
|
||||
$this->addSql('ALTER TABLE pricedetails CHANGE price price NUMERIC(11, 5) NOT NULL COMMENT \'(DC2Type:big_decimal)\'');
|
||||
$this->addSql('CREATE INDEX pricedetails_idx_min_discount ON pricedetails (min_discount_quantity)');
|
||||
$this->addSql('CREATE INDEX pricedetails_idx_min_discount_price_qty ON pricedetails (min_discount_quantity, price_related_quantity)');
|
||||
$this->addSql('CREATE INDEX location_idx_name ON storelocations (name)');
|
||||
$this->addSql('CREATE INDEX location_idx_parent_name ON storelocations (parent_id, name)');
|
||||
$this->addSql('ALTER TABLE suppliers CHANGE shipping_costs shipping_costs NUMERIC(11, 5) DEFAULT NULL COMMENT \'(DC2Type:big_decimal)\'');
|
||||
$this->addSql('CREATE INDEX supplier_idx_name ON suppliers (name)');
|
||||
$this->addSql('CREATE INDEX supplier_idx_parent_name ON suppliers (parent_id, name)');
|
||||
$this->addSql('ALTER TABLE users CHANGE config_instock_comment_w config_instock_comment_w LONGTEXT NOT NULL, CHANGE config_instock_comment_a config_instock_comment_a LONGTEXT NOT NULL');
|
||||
$this->addSql('CREATE INDEX user_idx_username ON users (name)');
|
||||
}
|
||||
|
||||
public function mySQLDown(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX attachments_idx_id_element_id_class_name ON `attachments`');
|
||||
$this->addSql('DROP INDEX attachments_idx_class_name_id ON `attachments`');
|
||||
$this->addSql('DROP INDEX attachment_name_idx ON `attachments`');
|
||||
$this->addSql('DROP INDEX attachment_element_idx ON `attachments`');
|
||||
$this->addSql('ALTER TABLE `attachments` CHANGE type_id type_id INT DEFAULT NULL');
|
||||
$this->addSql('DROP INDEX attachment_types_idx_name ON `attachment_types`');
|
||||
$this->addSql('DROP INDEX attachment_types_idx_parent_name ON `attachment_types`');
|
||||
$this->addSql('DROP INDEX category_idx_name ON `categories`');
|
||||
$this->addSql('DROP INDEX category_idx_parent_name ON `categories`');
|
||||
$this->addSql('ALTER TABLE `categories` CHANGE partname_hint partname_hint TEXT NOT NULL, CHANGE partname_regex partname_regex TEXT NOT NULL, CHANGE default_description default_description TEXT NOT NULL, CHANGE default_comment default_comment TEXT NOT NULL');
|
||||
$this->addSql('DROP INDEX currency_idx_name ON currencies');
|
||||
$this->addSql('DROP INDEX currency_idx_parent_name ON currencies');
|
||||
$this->addSql('ALTER TABLE currencies CHANGE exchange_rate exchange_rate NUMERIC(11, 5) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE `device_parts` CHANGE mountnames mountnames MEDIUMTEXT NOT NULL');
|
||||
$this->addSql('DROP INDEX footprint_idx_name ON `footprints`');
|
||||
$this->addSql('DROP INDEX footprint_idx_parent_name ON `footprints`');
|
||||
$this->addSql('DROP INDEX group_idx_name ON `groups`');
|
||||
$this->addSql('DROP INDEX group_idx_parent_name ON `groups`');
|
||||
$this->addSql('DROP INDEX log_idx_type ON log');
|
||||
$this->addSql('DROP INDEX log_idx_type_target ON log');
|
||||
$this->addSql('DROP INDEX log_idx_datetime ON log');
|
||||
$this->addSql('ALTER TABLE log CHANGE level level TINYINT(1) NOT NULL');
|
||||
$this->addSql('DROP INDEX manufacturer_name ON `manufacturers`');
|
||||
$this->addSql('DROP INDEX manufacturer_idx_parent_name ON `manufacturers`');
|
||||
$this->addSql('DROP INDEX unit_idx_name ON `measurement_units`');
|
||||
$this->addSql('DROP INDEX unit_idx_parent_name ON `measurement_units`');
|
||||
$this->addSql('DROP INDEX orderdetails_supplier_part_nr ON `orderdetails`');
|
||||
$this->addSql('DROP INDEX parameter_name_idx ON parameters');
|
||||
$this->addSql('DROP INDEX parameter_group_idx ON parameters');
|
||||
$this->addSql('DROP INDEX parameter_type_element_idx ON parameters');
|
||||
$this->addSql('DROP INDEX parts_idx_datet_name_last_id_needs ON `parts`');
|
||||
$this->addSql('DROP INDEX parts_idx_name ON `parts`');
|
||||
$this->addSql('ALTER TABLE `parts` CHANGE description description MEDIUMTEXT NOT NULL, CHANGE comment comment MEDIUMTEXT NOT NULL');
|
||||
$this->addSql('DROP INDEX part_lots_idx_instock_un_expiration_id_part ON part_lots');
|
||||
$this->addSql('DROP INDEX part_lots_idx_needs_refill ON part_lots');
|
||||
$this->addSql('DROP INDEX pricedetails_idx_min_discount ON `pricedetails`');
|
||||
$this->addSql('DROP INDEX pricedetails_idx_min_discount_price_qty ON `pricedetails`');
|
||||
$this->addSql('ALTER TABLE `pricedetails` CHANGE price price NUMERIC(11, 5) NOT NULL');
|
||||
$this->addSql('DROP INDEX location_idx_name ON `storelocations`');
|
||||
$this->addSql('DROP INDEX location_idx_parent_name ON `storelocations`');
|
||||
$this->addSql('DROP INDEX supplier_idx_name ON `suppliers`');
|
||||
$this->addSql('DROP INDEX supplier_idx_parent_name ON `suppliers`');
|
||||
$this->addSql('ALTER TABLE `suppliers` CHANGE shipping_costs shipping_costs NUMERIC(11, 5) DEFAULT NULL');
|
||||
$this->addSql('DROP INDEX user_idx_username ON `users`');
|
||||
$this->addSql('ALTER TABLE `users` CHANGE config_instock_comment_a config_instock_comment_a TEXT NOT NULL, CHANGE config_instock_comment_w config_instock_comment_w TEXT NOT NULL');
|
||||
}
|
||||
|
||||
public function sqLiteUp(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__attachment_types AS SELECT id, parent_id, id_preview_attachement, filetype_filter, comment, not_selectable, name, last_modified, datetime_added FROM attachment_types');
|
||||
$this->addSql('DROP TABLE attachment_types');
|
||||
$this->addSql('CREATE TABLE attachment_types (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, filetype_filter CLOB NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_EFAED719727ACA70 FOREIGN KEY (parent_id) REFERENCES "attachment_types" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EFAED7196DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO attachment_types (id, parent_id, id_preview_attachement, filetype_filter, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, filetype_filter, comment, not_selectable, name, last_modified, datetime_added FROM __temp__attachment_types');
|
||||
$this->addSql('DROP TABLE __temp__attachment_types');
|
||||
$this->addSql('CREATE INDEX IDX_EFAED7196DEDCEC2 ON attachment_types (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_EFAED719727ACA70 ON attachment_types (parent_id)');
|
||||
$this->addSql('CREATE INDEX attachment_types_idx_name ON attachment_types (name)');
|
||||
$this->addSql('CREATE INDEX attachment_types_idx_parent_name ON attachment_types (parent_id, name)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__attachments AS SELECT id, type_id, original_filename, path, show_in_table, name, last_modified, datetime_added, class_name, element_id FROM attachments');
|
||||
$this->addSql('DROP TABLE attachments');
|
||||
$this->addSql('CREATE TABLE attachments (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, type_id INTEGER NOT NULL, original_filename VARCHAR(255) DEFAULT NULL, path VARCHAR(255) NOT NULL, show_in_table BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, class_name VARCHAR(255) NOT NULL, element_id INTEGER NOT NULL, CONSTRAINT FK_47C4FAD6C54C8C93 FOREIGN KEY (type_id) REFERENCES "attachment_types" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO attachments (id, type_id, original_filename, path, show_in_table, name, last_modified, datetime_added, class_name, element_id) SELECT id, type_id, original_filename, path, show_in_table, name, last_modified, datetime_added, class_name, element_id FROM __temp__attachments');
|
||||
$this->addSql('DROP TABLE __temp__attachments');
|
||||
$this->addSql('CREATE INDEX IDX_47C4FAD61F1F2A24 ON attachments (element_id)');
|
||||
$this->addSql('CREATE INDEX IDX_47C4FAD6C54C8C93 ON attachments (type_id)');
|
||||
$this->addSql('CREATE INDEX attachments_idx_id_element_id_class_name ON attachments (id, element_id, class_name)');
|
||||
$this->addSql('CREATE INDEX attachments_idx_class_name_id ON attachments (class_name, id)');
|
||||
$this->addSql('CREATE INDEX attachment_name_idx ON attachments (name)');
|
||||
$this->addSql('CREATE INDEX attachment_element_idx ON attachments (class_name, element_id)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__categories AS SELECT id, parent_id, id_preview_attachement, partname_hint, partname_regex, disable_footprints, disable_manufacturers, disable_autodatasheets, disable_properties, default_description, default_comment, comment, not_selectable, name, last_modified, datetime_added FROM categories');
|
||||
$this->addSql('DROP TABLE categories');
|
||||
$this->addSql('CREATE TABLE categories (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, partname_hint CLOB NOT NULL, partname_regex CLOB NOT NULL, disable_footprints BOOLEAN NOT NULL, disable_manufacturers BOOLEAN NOT NULL, disable_autodatasheets BOOLEAN NOT NULL, disable_properties BOOLEAN NOT NULL, default_description CLOB NOT NULL, default_comment CLOB NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_3AF34668727ACA70 FOREIGN KEY (parent_id) REFERENCES "categories" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_3AF346686DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO categories (id, parent_id, id_preview_attachement, partname_hint, partname_regex, disable_footprints, disable_manufacturers, disable_autodatasheets, disable_properties, default_description, default_comment, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, partname_hint, partname_regex, disable_footprints, disable_manufacturers, disable_autodatasheets, disable_properties, default_description, default_comment, comment, not_selectable, name, last_modified, datetime_added FROM __temp__categories');
|
||||
$this->addSql('DROP TABLE __temp__categories');
|
||||
$this->addSql('CREATE INDEX IDX_3AF346686DEDCEC2 ON categories (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_3AF34668727ACA70 ON categories (parent_id)');
|
||||
$this->addSql('CREATE INDEX category_idx_name ON categories (name)');
|
||||
$this->addSql('CREATE INDEX category_idx_parent_name ON categories (parent_id, name)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__currencies AS SELECT id, parent_id, id_preview_attachement, exchange_rate, iso_code, comment, not_selectable, name, last_modified, datetime_added FROM currencies');
|
||||
$this->addSql('DROP TABLE currencies');
|
||||
$this->addSql('CREATE TABLE currencies (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, exchange_rate NUMERIC(11, 5) DEFAULT NULL --(DC2Type:big_decimal)
|
||||
, iso_code VARCHAR(255) NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_37C44693727ACA70 FOREIGN KEY (parent_id) REFERENCES currencies (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_37C446936DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO currencies (id, parent_id, id_preview_attachement, exchange_rate, iso_code, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, exchange_rate, iso_code, comment, not_selectable, name, last_modified, datetime_added FROM __temp__currencies');
|
||||
$this->addSql('DROP TABLE __temp__currencies');
|
||||
$this->addSql('CREATE INDEX IDX_37C446936DEDCEC2 ON currencies (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_37C44693727ACA70 ON currencies (parent_id)');
|
||||
$this->addSql('CREATE INDEX currency_idx_name ON currencies (name)');
|
||||
$this->addSql('CREATE INDEX currency_idx_parent_name ON currencies (parent_id, name)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__device_parts AS SELECT id, id_device, id_part, quantity, mountnames FROM device_parts');
|
||||
$this->addSql('DROP TABLE device_parts');
|
||||
$this->addSql('CREATE TABLE device_parts (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_device INTEGER DEFAULT NULL, id_part INTEGER DEFAULT NULL, quantity INTEGER NOT NULL, mountnames CLOB NOT NULL, CONSTRAINT FK_AFC547992F180363 FOREIGN KEY (id_device) REFERENCES "devices" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_AFC54799C22F6CC4 FOREIGN KEY (id_part) REFERENCES "parts" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO device_parts (id, id_device, id_part, quantity, mountnames) SELECT id, id_device, id_part, quantity, mountnames FROM __temp__device_parts');
|
||||
$this->addSql('DROP TABLE __temp__device_parts');
|
||||
$this->addSql('CREATE INDEX IDX_AFC54799C22F6CC4 ON device_parts (id_part)');
|
||||
$this->addSql('CREATE INDEX IDX_AFC547992F180363 ON device_parts (id_device)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__devices AS SELECT id, parent_id, id_preview_attachement, order_quantity, order_only_missing_parts, comment, not_selectable, name, last_modified, datetime_added FROM devices');
|
||||
$this->addSql('DROP TABLE devices');
|
||||
$this->addSql('CREATE TABLE devices (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, order_quantity INTEGER NOT NULL, order_only_missing_parts BOOLEAN NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_11074E9A727ACA70 FOREIGN KEY (parent_id) REFERENCES "devices" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_11074E9A6DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO devices (id, parent_id, id_preview_attachement, order_quantity, order_only_missing_parts, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, order_quantity, order_only_missing_parts, comment, not_selectable, name, last_modified, datetime_added FROM __temp__devices');
|
||||
$this->addSql('DROP TABLE __temp__devices');
|
||||
$this->addSql('CREATE INDEX IDX_11074E9A6DEDCEC2 ON devices (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_11074E9A727ACA70 ON devices (parent_id)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__footprints AS SELECT id, parent_id, id_footprint_3d, id_preview_attachement, comment, not_selectable, name, last_modified, datetime_added FROM footprints');
|
||||
$this->addSql('DROP TABLE footprints');
|
||||
$this->addSql('CREATE TABLE footprints (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_footprint_3d INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_A34D68A2727ACA70 FOREIGN KEY (parent_id) REFERENCES "footprints" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_A34D68A232A38C34 FOREIGN KEY (id_footprint_3d) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_A34D68A26DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO footprints (id, parent_id, id_footprint_3d, id_preview_attachement, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_footprint_3d, id_preview_attachement, comment, not_selectable, name, last_modified, datetime_added FROM __temp__footprints');
|
||||
$this->addSql('DROP TABLE __temp__footprints');
|
||||
$this->addSql('CREATE INDEX IDX_A34D68A26DEDCEC2 ON footprints (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_A34D68A232A38C34 ON footprints (id_footprint_3d)');
|
||||
$this->addSql('CREATE INDEX IDX_A34D68A2727ACA70 ON footprints (parent_id)');
|
||||
$this->addSql('CREATE INDEX footprint_idx_name ON footprints (name)');
|
||||
$this->addSql('CREATE INDEX footprint_idx_parent_name ON footprints (parent_id, name)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__groups AS SELECT id, parent_id, id_preview_attachement, enforce_2fa, comment, not_selectable, name, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels FROM groups');
|
||||
$this->addSql('DROP TABLE groups');
|
||||
$this->addSql('CREATE TABLE groups (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, enforce_2fa BOOLEAN NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, perms_system INTEGER NOT NULL, perms_groups INTEGER NOT NULL, perms_users INTEGER NOT NULL, perms_self INTEGER NOT NULL, perms_system_config INTEGER NOT NULL, perms_system_database INTEGER NOT NULL, perms_parts BIGINT NOT NULL, perms_parts_name SMALLINT NOT NULL, perms_parts_category SMALLINT NOT NULL, perms_parts_description SMALLINT NOT NULL, perms_parts_minamount SMALLINT NOT NULL, perms_parts_footprint SMALLINT NOT NULL, perms_parts_lots SMALLINT NOT NULL, perms_parts_tags SMALLINT NOT NULL, perms_parts_unit SMALLINT NOT NULL, perms_parts_mass SMALLINT NOT NULL, perms_parts_manufacturer SMALLINT NOT NULL, perms_parts_status SMALLINT NOT NULL, perms_parts_mpn SMALLINT NOT NULL, perms_parts_comment SMALLINT NOT NULL, perms_parts_order SMALLINT NOT NULL, perms_parts_orderdetails SMALLINT NOT NULL, perms_parts_prices SMALLINT NOT NULL, perms_parts_parameters SMALLINT NOT NULL, perms_parts_attachements SMALLINT NOT NULL, perms_devices INTEGER NOT NULL, perms_devices_parts INTEGER NOT NULL, perms_storelocations INTEGER NOT NULL, perms_footprints INTEGER NOT NULL, perms_categories INTEGER NOT NULL, perms_suppliers INTEGER NOT NULL, perms_manufacturers INTEGER NOT NULL, perms_attachement_types INTEGER NOT NULL, perms_currencies INTEGER NOT NULL, perms_measurement_units INTEGER NOT NULL, perms_tools INTEGER NOT NULL, perms_labels INTEGER NOT NULL, CONSTRAINT FK_F06D3970727ACA70 FOREIGN KEY (parent_id) REFERENCES "groups" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_F06D39706DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO groups (id, parent_id, id_preview_attachement, enforce_2fa, comment, not_selectable, name, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels) SELECT id, parent_id, id_preview_attachement, enforce_2fa, comment, not_selectable, name, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels FROM __temp__groups');
|
||||
$this->addSql('DROP TABLE __temp__groups');
|
||||
$this->addSql('CREATE INDEX IDX_F06D39706DEDCEC2 ON groups (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_F06D3970727ACA70 ON groups (parent_id)');
|
||||
$this->addSql('CREATE INDEX group_idx_name ON groups (name)');
|
||||
$this->addSql('CREATE INDEX group_idx_parent_name ON groups (parent_id, name)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__label_profiles AS SELECT id, id_preview_attachement, comment, show_in_dropdown, name, last_modified, datetime_added, options_width, options_height, options_barcode_type, options_picture_type, options_supported_element, options_additional_css, options_lines_mode, options_lines FROM label_profiles');
|
||||
$this->addSql('DROP TABLE label_profiles');
|
||||
$this->addSql('CREATE TABLE label_profiles (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_preview_attachement INTEGER DEFAULT NULL, comment CLOB NOT NULL, show_in_dropdown BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, options_width DOUBLE PRECISION NOT NULL, options_height DOUBLE PRECISION NOT NULL, options_barcode_type VARCHAR(255) NOT NULL, options_picture_type VARCHAR(255) NOT NULL, options_supported_element VARCHAR(255) NOT NULL, options_additional_css CLOB NOT NULL, options_lines_mode VARCHAR(255) NOT NULL, options_lines CLOB NOT NULL, CONSTRAINT FK_C93E9CF56DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO label_profiles (id, id_preview_attachement, comment, show_in_dropdown, name, last_modified, datetime_added, options_width, options_height, options_barcode_type, options_picture_type, options_supported_element, options_additional_css, options_lines_mode, options_lines) SELECT id, id_preview_attachement, comment, show_in_dropdown, name, last_modified, datetime_added, options_width, options_height, options_barcode_type, options_picture_type, options_supported_element, options_additional_css, options_lines_mode, options_lines FROM __temp__label_profiles');
|
||||
$this->addSql('DROP TABLE __temp__label_profiles');
|
||||
$this->addSql('CREATE INDEX IDX_C93E9CF56DEDCEC2 ON label_profiles (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__log AS SELECT id, id_user, datetime, level, target_id, target_type, extra, type FROM log');
|
||||
$this->addSql('DROP TABLE log');
|
||||
$this->addSql('CREATE TABLE log (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_user INTEGER NOT NULL, datetime DATETIME NOT NULL, level TINYINT(4) NOT NULL, target_id INTEGER NOT NULL, target_type SMALLINT NOT NULL, extra CLOB NOT NULL --(DC2Type:json)
|
||||
, type SMALLINT NOT NULL, CONSTRAINT FK_8F3F68C56B3CA4B FOREIGN KEY (id_user) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO log (id, id_user, datetime, level, target_id, target_type, extra, type) SELECT id, id_user, datetime, level, target_id, target_type, extra, type FROM __temp__log');
|
||||
$this->addSql('DROP TABLE __temp__log');
|
||||
$this->addSql('CREATE INDEX IDX_8F3F68C56B3CA4B ON log (id_user)');
|
||||
$this->addSql('CREATE INDEX log_idx_type ON log (type)');
|
||||
$this->addSql('CREATE INDEX log_idx_type_target ON log (type, target_type, target_id)');
|
||||
$this->addSql('CREATE INDEX log_idx_datetime ON log (datetime)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__manufacturers AS SELECT id, parent_id, id_preview_attachement, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added FROM manufacturers');
|
||||
$this->addSql('DROP TABLE manufacturers');
|
||||
$this->addSql('CREATE TABLE manufacturers (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, address VARCHAR(255) NOT NULL, phone_number VARCHAR(255) NOT NULL, fax_number VARCHAR(255) NOT NULL, email_address VARCHAR(255) NOT NULL, website VARCHAR(255) NOT NULL, auto_product_url VARCHAR(255) NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_94565B12727ACA70 FOREIGN KEY (parent_id) REFERENCES "manufacturers" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_94565B126DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO manufacturers (id, parent_id, id_preview_attachement, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added FROM __temp__manufacturers');
|
||||
$this->addSql('DROP TABLE __temp__manufacturers');
|
||||
$this->addSql('CREATE INDEX IDX_94565B126DEDCEC2 ON manufacturers (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_94565B12727ACA70 ON manufacturers (parent_id)');
|
||||
$this->addSql('CREATE INDEX manufacturer_name ON manufacturers (name)');
|
||||
$this->addSql('CREATE INDEX manufacturer_idx_parent_name ON manufacturers (parent_id, name)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__measurement_units AS SELECT id, parent_id, id_preview_attachement, unit, is_integer, use_si_prefix, comment, not_selectable, name, last_modified, datetime_added FROM measurement_units');
|
||||
$this->addSql('DROP TABLE measurement_units');
|
||||
$this->addSql('CREATE TABLE measurement_units (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, unit VARCHAR(255) DEFAULT NULL, is_integer BOOLEAN NOT NULL, use_si_prefix BOOLEAN NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_F5AF83CF727ACA70 FOREIGN KEY (parent_id) REFERENCES "measurement_units" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_F5AF83CF6DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO measurement_units (id, parent_id, id_preview_attachement, unit, is_integer, use_si_prefix, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, unit, is_integer, use_si_prefix, comment, not_selectable, name, last_modified, datetime_added FROM __temp__measurement_units');
|
||||
$this->addSql('DROP TABLE __temp__measurement_units');
|
||||
$this->addSql('CREATE INDEX IDX_F5AF83CF6DEDCEC2 ON measurement_units (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_F5AF83CF727ACA70 ON measurement_units (parent_id)');
|
||||
$this->addSql('CREATE INDEX unit_idx_name ON measurement_units (name)');
|
||||
$this->addSql('CREATE INDEX unit_idx_parent_name ON measurement_units (parent_id, name)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__orderdetails AS SELECT id, part_id, id_supplier, supplierpartnr, obsolete, supplier_product_url, last_modified, datetime_added FROM orderdetails');
|
||||
$this->addSql('DROP TABLE orderdetails');
|
||||
$this->addSql('CREATE TABLE orderdetails (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, part_id INTEGER NOT NULL, id_supplier INTEGER DEFAULT NULL, supplierpartnr VARCHAR(255) NOT NULL, obsolete BOOLEAN NOT NULL, supplier_product_url VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_489AFCDC4CE34BEC FOREIGN KEY (part_id) REFERENCES "parts" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_489AFCDCCBF180EB FOREIGN KEY (id_supplier) REFERENCES "suppliers" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO orderdetails (id, part_id, id_supplier, supplierpartnr, obsolete, supplier_product_url, last_modified, datetime_added) SELECT id, part_id, id_supplier, supplierpartnr, obsolete, supplier_product_url, last_modified, datetime_added FROM __temp__orderdetails');
|
||||
$this->addSql('DROP TABLE __temp__orderdetails');
|
||||
$this->addSql('CREATE INDEX IDX_489AFCDCCBF180EB ON orderdetails (id_supplier)');
|
||||
$this->addSql('CREATE INDEX IDX_489AFCDC4CE34BEC ON orderdetails (part_id)');
|
||||
$this->addSql('CREATE INDEX orderdetails_supplier_part_nr ON orderdetails (supplierpartnr)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__parameters AS SELECT id, symbol, value_min, value_typical, value_max, unit, value_text, param_group, name, last_modified, datetime_added, type, element_id FROM parameters');
|
||||
$this->addSql('DROP TABLE parameters');
|
||||
$this->addSql('CREATE TABLE parameters (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, symbol VARCHAR(255) NOT NULL, value_min DOUBLE PRECISION DEFAULT NULL, value_typical DOUBLE PRECISION DEFAULT NULL, value_max DOUBLE PRECISION DEFAULT NULL, unit VARCHAR(255) NOT NULL, value_text VARCHAR(255) NOT NULL, param_group VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, type SMALLINT NOT NULL, element_id INTEGER NOT NULL)');
|
||||
$this->addSql('INSERT INTO parameters (id, symbol, value_min, value_typical, value_max, unit, value_text, param_group, name, last_modified, datetime_added, type, element_id) SELECT id, symbol, value_min, value_typical, value_max, unit, value_text, param_group, name, last_modified, datetime_added, type, element_id FROM __temp__parameters');
|
||||
$this->addSql('DROP TABLE __temp__parameters');
|
||||
$this->addSql('CREATE INDEX IDX_69348FE1F1F2A24 ON parameters (element_id)');
|
||||
$this->addSql('CREATE INDEX parameter_name_idx ON parameters (name)');
|
||||
$this->addSql('CREATE INDEX parameter_group_idx ON parameters (param_group)');
|
||||
$this->addSql('CREATE INDEX parameter_type_element_idx ON parameters (type, element_id)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__part_lots AS SELECT id, id_store_location, id_part, description, comment, expiration_date, instock_unknown, amount, needs_refill, last_modified, datetime_added FROM part_lots');
|
||||
$this->addSql('DROP TABLE part_lots');
|
||||
$this->addSql('CREATE TABLE part_lots (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_store_location INTEGER DEFAULT NULL, id_part INTEGER NOT NULL, description CLOB NOT NULL, comment CLOB NOT NULL, expiration_date DATETIME DEFAULT NULL, instock_unknown BOOLEAN NOT NULL, amount DOUBLE PRECISION NOT NULL, needs_refill BOOLEAN NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_EBC8F9435D8F4B37 FOREIGN KEY (id_store_location) REFERENCES "storelocations" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EBC8F943C22F6CC4 FOREIGN KEY (id_part) REFERENCES "parts" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO part_lots (id, id_store_location, id_part, description, comment, expiration_date, instock_unknown, amount, needs_refill, last_modified, datetime_added) SELECT id, id_store_location, id_part, description, comment, expiration_date, instock_unknown, amount, needs_refill, last_modified, datetime_added FROM __temp__part_lots');
|
||||
$this->addSql('DROP TABLE __temp__part_lots');
|
||||
$this->addSql('CREATE INDEX IDX_EBC8F943C22F6CC4 ON part_lots (id_part)');
|
||||
$this->addSql('CREATE INDEX IDX_EBC8F9435D8F4B37 ON part_lots (id_store_location)');
|
||||
$this->addSql('CREATE INDEX part_lots_idx_instock_un_expiration_id_part ON part_lots (instock_unknown, expiration_date, id_part)');
|
||||
$this->addSql('CREATE INDEX part_lots_idx_needs_refill ON part_lots (needs_refill)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__parts AS SELECT id, id_preview_attachement, id_category, id_footprint, id_part_unit, id_manufacturer, order_orderdetails_id, datetime_added, name, last_modified, needs_review, tags, mass, description, comment, visible, favorite, minamount, manufacturer_product_url, manufacturer_product_number, manufacturing_status, order_quantity, manual_order FROM parts');
|
||||
$this->addSql('DROP TABLE parts');
|
||||
$this->addSql('CREATE TABLE parts (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_preview_attachement INTEGER DEFAULT NULL, id_category INTEGER NOT NULL, id_footprint INTEGER DEFAULT NULL, id_part_unit INTEGER DEFAULT NULL, id_manufacturer INTEGER DEFAULT NULL, order_orderdetails_id INTEGER DEFAULT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, needs_review BOOLEAN NOT NULL, tags CLOB NOT NULL, mass DOUBLE PRECISION DEFAULT NULL, description CLOB NOT NULL, comment CLOB NOT NULL, visible BOOLEAN NOT NULL, favorite BOOLEAN NOT NULL, minamount DOUBLE PRECISION NOT NULL, manufacturer_product_url VARCHAR(255) NOT NULL, manufacturer_product_number VARCHAR(255) NOT NULL, manufacturing_status VARCHAR(255) DEFAULT NULL, order_quantity INTEGER NOT NULL, manual_order BOOLEAN NOT NULL, CONSTRAINT FK_6940A7FE6DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_6940A7FE5697F554 FOREIGN KEY (id_category) REFERENCES "categories" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_6940A7FE7E371A10 FOREIGN KEY (id_footprint) REFERENCES "footprints" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_6940A7FE2626CEF9 FOREIGN KEY (id_part_unit) REFERENCES "measurement_units" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_6940A7FE1ECB93AE FOREIGN KEY (id_manufacturer) REFERENCES "manufacturers" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_6940A7FE81081E9B FOREIGN KEY (order_orderdetails_id) REFERENCES "orderdetails" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO parts (id, id_preview_attachement, id_category, id_footprint, id_part_unit, id_manufacturer, order_orderdetails_id, datetime_added, name, last_modified, needs_review, tags, mass, description, comment, visible, favorite, minamount, manufacturer_product_url, manufacturer_product_number, manufacturing_status, order_quantity, manual_order) SELECT id, id_preview_attachement, id_category, id_footprint, id_part_unit, id_manufacturer, order_orderdetails_id, datetime_added, name, last_modified, needs_review, tags, mass, description, comment, visible, favorite, minamount, manufacturer_product_url, manufacturer_product_number, manufacturing_status, order_quantity, manual_order FROM __temp__parts');
|
||||
$this->addSql('DROP TABLE __temp__parts');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_6940A7FE81081E9B ON parts (order_orderdetails_id)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE1ECB93AE ON parts (id_manufacturer)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE2626CEF9 ON parts (id_part_unit)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE7E371A10 ON parts (id_footprint)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE5697F554 ON parts (id_category)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE6DEDCEC2 ON parts (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX parts_idx_datet_name_last_id_needs ON parts (datetime_added, name, last_modified, id, needs_review)');
|
||||
$this->addSql('CREATE INDEX parts_idx_name ON parts (name)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__pricedetails AS SELECT id, id_currency, orderdetails_id, price, price_related_quantity, min_discount_quantity, manual_input, last_modified, datetime_added FROM pricedetails');
|
||||
$this->addSql('DROP TABLE pricedetails');
|
||||
$this->addSql('CREATE TABLE pricedetails (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_currency INTEGER DEFAULT NULL, orderdetails_id INTEGER NOT NULL, price NUMERIC(11, 5) NOT NULL --(DC2Type:big_decimal)
|
||||
, price_related_quantity DOUBLE PRECISION NOT NULL, min_discount_quantity DOUBLE PRECISION NOT NULL, manual_input BOOLEAN NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_C68C4459398D64AA FOREIGN KEY (id_currency) REFERENCES currencies (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_C68C44594A01DDC7 FOREIGN KEY (orderdetails_id) REFERENCES "orderdetails" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO pricedetails (id, id_currency, orderdetails_id, price, price_related_quantity, min_discount_quantity, manual_input, last_modified, datetime_added) SELECT id, id_currency, orderdetails_id, price, price_related_quantity, min_discount_quantity, manual_input, last_modified, datetime_added FROM __temp__pricedetails');
|
||||
$this->addSql('DROP TABLE __temp__pricedetails');
|
||||
$this->addSql('CREATE INDEX IDX_C68C44594A01DDC7 ON pricedetails (orderdetails_id)');
|
||||
$this->addSql('CREATE INDEX IDX_C68C4459398D64AA ON pricedetails (id_currency)');
|
||||
$this->addSql('CREATE INDEX pricedetails_idx_min_discount ON pricedetails (min_discount_quantity)');
|
||||
$this->addSql('CREATE INDEX pricedetails_idx_min_discount_price_qty ON pricedetails (min_discount_quantity, price_related_quantity)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__storelocations AS SELECT id, parent_id, storage_type_id, id_preview_attachement, is_full, only_single_part, limit_to_existing_parts, comment, not_selectable, name, last_modified, datetime_added FROM storelocations');
|
||||
$this->addSql('DROP TABLE storelocations');
|
||||
$this->addSql('CREATE TABLE storelocations (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, storage_type_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, is_full BOOLEAN NOT NULL, only_single_part BOOLEAN NOT NULL, limit_to_existing_parts BOOLEAN NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_7517020727ACA70 FOREIGN KEY (parent_id) REFERENCES "storelocations" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_7517020B270BFF1 FOREIGN KEY (storage_type_id) REFERENCES "measurement_units" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_75170206DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO storelocations (id, parent_id, storage_type_id, id_preview_attachement, is_full, only_single_part, limit_to_existing_parts, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, storage_type_id, id_preview_attachement, is_full, only_single_part, limit_to_existing_parts, comment, not_selectable, name, last_modified, datetime_added FROM __temp__storelocations');
|
||||
$this->addSql('DROP TABLE __temp__storelocations');
|
||||
$this->addSql('CREATE INDEX IDX_75170206DEDCEC2 ON storelocations (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_7517020B270BFF1 ON storelocations (storage_type_id)');
|
||||
$this->addSql('CREATE INDEX IDX_7517020727ACA70 ON storelocations (parent_id)');
|
||||
$this->addSql('CREATE INDEX location_idx_name ON storelocations (name)');
|
||||
$this->addSql('CREATE INDEX location_idx_parent_name ON storelocations (parent_id, name)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__suppliers AS SELECT id, parent_id, default_currency_id, id_preview_attachement, shipping_costs, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added FROM suppliers');
|
||||
$this->addSql('DROP TABLE suppliers');
|
||||
$this->addSql('CREATE TABLE suppliers (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, default_currency_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, shipping_costs NUMERIC(11, 5) DEFAULT NULL --(DC2Type:big_decimal)
|
||||
, address VARCHAR(255) NOT NULL, phone_number VARCHAR(255) NOT NULL, fax_number VARCHAR(255) NOT NULL, email_address VARCHAR(255) NOT NULL, website VARCHAR(255) NOT NULL, auto_product_url VARCHAR(255) NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_AC28B95C727ACA70 FOREIGN KEY (parent_id) REFERENCES "suppliers" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_AC28B95CECD792C0 FOREIGN KEY (default_currency_id) REFERENCES currencies (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_AC28B95C6DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO suppliers (id, parent_id, default_currency_id, id_preview_attachement, shipping_costs, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, default_currency_id, id_preview_attachement, shipping_costs, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added FROM __temp__suppliers');
|
||||
$this->addSql('DROP TABLE __temp__suppliers');
|
||||
$this->addSql('CREATE INDEX IDX_AC28B95C6DEDCEC2 ON suppliers (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_AC28B95CECD792C0 ON suppliers (default_currency_id)');
|
||||
$this->addSql('CREATE INDEX IDX_AC28B95C727ACA70 ON suppliers (parent_id)');
|
||||
$this->addSql('CREATE INDEX supplier_idx_name ON suppliers (name)');
|
||||
$this->addSql('CREATE INDEX supplier_idx_parent_name ON suppliers (parent_id, name)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__u2f_keys AS SELECT id, user_id, key_handle, public_key, certificate, counter, name, last_modified, datetime_added FROM u2f_keys');
|
||||
$this->addSql('DROP TABLE u2f_keys');
|
||||
$this->addSql('CREATE TABLE u2f_keys (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, key_handle VARCHAR(128) NOT NULL, public_key VARCHAR(255) NOT NULL, certificate CLOB NOT NULL, counter VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_4F4ADB4BA76ED395 FOREIGN KEY (user_id) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO u2f_keys (id, user_id, key_handle, public_key, certificate, counter, name, last_modified, datetime_added) SELECT id, user_id, key_handle, public_key, certificate, counter, name, last_modified, datetime_added FROM __temp__u2f_keys');
|
||||
$this->addSql('DROP TABLE __temp__u2f_keys');
|
||||
$this->addSql('CREATE UNIQUE INDEX user_unique ON u2f_keys (user_id, key_handle)');
|
||||
$this->addSql('CREATE INDEX IDX_4F4ADB4BA76ED395 ON u2f_keys (user_id)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__users AS SELECT id, group_id, currency_id, id_preview_attachement, disabled, config_theme, pw_reset_token, config_instock_comment_a, config_instock_comment_w, trusted_device_cookie_version, backup_codes, google_authenticator_secret, config_timezone, config_language, email, department, last_name, first_name, need_pw_change, password, name, settings, backup_codes_generation_date, pw_reset_expires, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels FROM users');
|
||||
$this->addSql('DROP TABLE users');
|
||||
$this->addSql('CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, group_id INTEGER DEFAULT NULL, currency_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, disabled BOOLEAN NOT NULL, config_theme VARCHAR(255) DEFAULT NULL, pw_reset_token VARCHAR(255) DEFAULT NULL, config_instock_comment_a CLOB NOT NULL, config_instock_comment_w CLOB NOT NULL, trusted_device_cookie_version INTEGER NOT NULL, backup_codes CLOB NOT NULL --(DC2Type:json)
|
||||
, google_authenticator_secret VARCHAR(255) DEFAULT NULL, config_timezone VARCHAR(255) DEFAULT NULL, config_language VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, department VARCHAR(255) DEFAULT NULL, last_name VARCHAR(255) DEFAULT NULL, first_name VARCHAR(255) DEFAULT NULL, need_pw_change BOOLEAN NOT NULL, password VARCHAR(255) DEFAULT NULL, name VARCHAR(180) NOT NULL, settings CLOB NOT NULL --(DC2Type:json)
|
||||
, backup_codes_generation_date DATETIME DEFAULT NULL, pw_reset_expires DATETIME DEFAULT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, perms_system INTEGER NOT NULL, perms_groups INTEGER NOT NULL, perms_users INTEGER NOT NULL, perms_self INTEGER NOT NULL, perms_system_config INTEGER NOT NULL, perms_system_database INTEGER NOT NULL, perms_parts BIGINT NOT NULL, perms_parts_name SMALLINT NOT NULL, perms_parts_category SMALLINT NOT NULL, perms_parts_description SMALLINT NOT NULL, perms_parts_minamount SMALLINT NOT NULL, perms_parts_footprint SMALLINT NOT NULL, perms_parts_lots SMALLINT NOT NULL, perms_parts_tags SMALLINT NOT NULL, perms_parts_unit SMALLINT NOT NULL, perms_parts_mass SMALLINT NOT NULL, perms_parts_manufacturer SMALLINT NOT NULL, perms_parts_status SMALLINT NOT NULL, perms_parts_mpn SMALLINT NOT NULL, perms_parts_comment SMALLINT NOT NULL, perms_parts_order SMALLINT NOT NULL, perms_parts_orderdetails SMALLINT NOT NULL, perms_parts_prices SMALLINT NOT NULL, perms_parts_parameters SMALLINT NOT NULL, perms_parts_attachements SMALLINT NOT NULL, perms_devices INTEGER NOT NULL, perms_devices_parts INTEGER NOT NULL, perms_storelocations INTEGER NOT NULL, perms_footprints INTEGER NOT NULL, perms_categories INTEGER NOT NULL, perms_suppliers INTEGER NOT NULL, perms_manufacturers INTEGER NOT NULL, perms_attachement_types INTEGER NOT NULL, perms_currencies INTEGER NOT NULL, perms_measurement_units INTEGER NOT NULL, perms_tools INTEGER NOT NULL, perms_labels INTEGER NOT NULL, CONSTRAINT FK_1483A5E9FE54D947 FOREIGN KEY (group_id) REFERENCES "groups" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_1483A5E938248176 FOREIGN KEY (currency_id) REFERENCES currencies (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_1483A5E96DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES "attachments" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO users (id, group_id, currency_id, id_preview_attachement, disabled, config_theme, pw_reset_token, config_instock_comment_a, config_instock_comment_w, trusted_device_cookie_version, backup_codes, google_authenticator_secret, config_timezone, config_language, email, department, last_name, first_name, need_pw_change, password, name, settings, backup_codes_generation_date, pw_reset_expires, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels) SELECT id, group_id, currency_id, id_preview_attachement, disabled, config_theme, pw_reset_token, config_instock_comment_a, config_instock_comment_w, trusted_device_cookie_version, backup_codes, google_authenticator_secret, config_timezone, config_language, email, department, last_name, first_name, need_pw_change, password, name, settings, backup_codes_generation_date, pw_reset_expires, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels FROM __temp__users');
|
||||
$this->addSql('DROP TABLE __temp__users');
|
||||
$this->addSql('CREATE INDEX IDX_1483A5E96DEDCEC2 ON users (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_1483A5E938248176 ON users (currency_id)');
|
||||
$this->addSql('CREATE INDEX IDX_1483A5E9FE54D947 ON users (group_id)');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_1483A5E95E237E06 ON users (name)');
|
||||
$this->addSql('CREATE INDEX user_idx_username ON users (name)');
|
||||
}
|
||||
|
||||
public function sqLiteDown(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__attachment_types AS SELECT id, parent_id, id_preview_attachement, filetype_filter, comment, not_selectable, name, last_modified, datetime_added FROM "attachment_types"');
|
||||
$this->addSql('DROP TABLE "attachment_types"');
|
||||
$this->addSql('CREATE TABLE "attachment_types" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, filetype_filter CLOB NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO "attachment_types" (id, parent_id, id_preview_attachement, filetype_filter, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, filetype_filter, comment, not_selectable, name, last_modified, datetime_added FROM __temp__attachment_types');
|
||||
$this->addSql('DROP TABLE __temp__attachment_types');
|
||||
$this->addSql('CREATE INDEX IDX_EFAED719727ACA70 ON "attachment_types" (parent_id)');
|
||||
$this->addSql('CREATE INDEX IDX_EFAED7196DEDCEC2 ON "attachment_types" (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__attachments AS SELECT id, type_id, original_filename, path, show_in_table, name, last_modified, datetime_added, class_name, element_id FROM "attachments"');
|
||||
$this->addSql('DROP TABLE "attachments"');
|
||||
$this->addSql('CREATE TABLE "attachments" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, type_id INTEGER DEFAULT NULL, original_filename VARCHAR(255) DEFAULT NULL, path VARCHAR(255) NOT NULL, show_in_table BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, class_name VARCHAR(255) NOT NULL, element_id INTEGER NOT NULL)');
|
||||
$this->addSql('INSERT INTO "attachments" (id, type_id, original_filename, path, show_in_table, name, last_modified, datetime_added, class_name, element_id) SELECT id, type_id, original_filename, path, show_in_table, name, last_modified, datetime_added, class_name, element_id FROM __temp__attachments');
|
||||
$this->addSql('DROP TABLE __temp__attachments');
|
||||
$this->addSql('CREATE INDEX IDX_47C4FAD6C54C8C93 ON "attachments" (type_id)');
|
||||
$this->addSql('CREATE INDEX IDX_47C4FAD61F1F2A24 ON "attachments" (element_id)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__categories AS SELECT id, parent_id, id_preview_attachement, partname_hint, partname_regex, disable_footprints, disable_manufacturers, disable_autodatasheets, disable_properties, default_description, default_comment, comment, not_selectable, name, last_modified, datetime_added FROM "categories"');
|
||||
$this->addSql('DROP TABLE "categories"');
|
||||
$this->addSql('CREATE TABLE "categories" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, partname_hint CLOB NOT NULL, partname_regex CLOB NOT NULL, disable_footprints BOOLEAN NOT NULL, disable_manufacturers BOOLEAN NOT NULL, disable_autodatasheets BOOLEAN NOT NULL, disable_properties BOOLEAN NOT NULL, default_description CLOB NOT NULL, default_comment CLOB NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO "categories" (id, parent_id, id_preview_attachement, partname_hint, partname_regex, disable_footprints, disable_manufacturers, disable_autodatasheets, disable_properties, default_description, default_comment, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, partname_hint, partname_regex, disable_footprints, disable_manufacturers, disable_autodatasheets, disable_properties, default_description, default_comment, comment, not_selectable, name, last_modified, datetime_added FROM __temp__categories');
|
||||
$this->addSql('DROP TABLE __temp__categories');
|
||||
$this->addSql('CREATE INDEX IDX_3AF34668727ACA70 ON "categories" (parent_id)');
|
||||
$this->addSql('CREATE INDEX IDX_3AF346686DEDCEC2 ON "categories" (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__currencies AS SELECT id, parent_id, id_preview_attachement, exchange_rate, iso_code, comment, not_selectable, name, last_modified, datetime_added FROM currencies');
|
||||
$this->addSql('DROP TABLE currencies');
|
||||
$this->addSql('CREATE TABLE currencies (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, exchange_rate NUMERIC(11, 5) DEFAULT NULL --
|
||||
(DC2Type:big_decimal)
|
||||
, iso_code VARCHAR(255) NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO currencies (id, parent_id, id_preview_attachement, exchange_rate, iso_code, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, exchange_rate, iso_code, comment, not_selectable, name, last_modified, datetime_added FROM __temp__currencies');
|
||||
$this->addSql('DROP TABLE __temp__currencies');
|
||||
$this->addSql('CREATE INDEX IDX_37C44693727ACA70 ON currencies (parent_id)');
|
||||
$this->addSql('CREATE INDEX IDX_37C446936DEDCEC2 ON currencies (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__device_parts AS SELECT id, id_device, id_part, quantity, mountnames FROM "device_parts"');
|
||||
$this->addSql('DROP TABLE "device_parts"');
|
||||
$this->addSql('CREATE TABLE "device_parts" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_device INTEGER DEFAULT NULL, id_part INTEGER DEFAULT NULL, quantity INTEGER NOT NULL, mountnames CLOB NOT NULL)');
|
||||
$this->addSql('INSERT INTO "device_parts" (id, id_device, id_part, quantity, mountnames) SELECT id, id_device, id_part, quantity, mountnames FROM __temp__device_parts');
|
||||
$this->addSql('DROP TABLE __temp__device_parts');
|
||||
$this->addSql('CREATE INDEX IDX_AFC547992F180363 ON "device_parts" (id_device)');
|
||||
$this->addSql('CREATE INDEX IDX_AFC54799C22F6CC4 ON "device_parts" (id_part)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__devices AS SELECT id, parent_id, id_preview_attachement, order_quantity, order_only_missing_parts, comment, not_selectable, name, last_modified, datetime_added FROM "devices"');
|
||||
$this->addSql('DROP TABLE "devices"');
|
||||
$this->addSql('CREATE TABLE "devices" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, order_quantity INTEGER NOT NULL, order_only_missing_parts BOOLEAN NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO "devices" (id, parent_id, id_preview_attachement, order_quantity, order_only_missing_parts, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, order_quantity, order_only_missing_parts, comment, not_selectable, name, last_modified, datetime_added FROM __temp__devices');
|
||||
$this->addSql('DROP TABLE __temp__devices');
|
||||
$this->addSql('CREATE INDEX IDX_11074E9A727ACA70 ON "devices" (parent_id)');
|
||||
$this->addSql('CREATE INDEX IDX_11074E9A6DEDCEC2 ON "devices" (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__footprints AS SELECT id, parent_id, id_footprint_3d, id_preview_attachement, comment, not_selectable, name, last_modified, datetime_added FROM "footprints"');
|
||||
$this->addSql('DROP TABLE "footprints"');
|
||||
$this->addSql('CREATE TABLE "footprints" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_footprint_3d INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO "footprints" (id, parent_id, id_footprint_3d, id_preview_attachement, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_footprint_3d, id_preview_attachement, comment, not_selectable, name, last_modified, datetime_added FROM __temp__footprints');
|
||||
$this->addSql('DROP TABLE __temp__footprints');
|
||||
$this->addSql('CREATE INDEX IDX_A34D68A2727ACA70 ON "footprints" (parent_id)');
|
||||
$this->addSql('CREATE INDEX IDX_A34D68A232A38C34 ON "footprints" (id_footprint_3d)');
|
||||
$this->addSql('CREATE INDEX IDX_A34D68A26DEDCEC2 ON "footprints" (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__groups AS SELECT id, parent_id, id_preview_attachement, enforce_2fa, comment, not_selectable, name, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels FROM "groups"');
|
||||
$this->addSql('DROP TABLE "groups"');
|
||||
$this->addSql('CREATE TABLE "groups" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, enforce_2fa BOOLEAN NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, perms_system INTEGER NOT NULL, perms_groups INTEGER NOT NULL, perms_users INTEGER NOT NULL, perms_self INTEGER NOT NULL, perms_system_config INTEGER NOT NULL, perms_system_database INTEGER NOT NULL, perms_parts BIGINT NOT NULL, perms_parts_name SMALLINT NOT NULL, perms_parts_category SMALLINT NOT NULL, perms_parts_description SMALLINT NOT NULL, perms_parts_minamount SMALLINT NOT NULL, perms_parts_footprint SMALLINT NOT NULL, perms_parts_lots SMALLINT NOT NULL, perms_parts_tags SMALLINT NOT NULL, perms_parts_unit SMALLINT NOT NULL, perms_parts_mass SMALLINT NOT NULL, perms_parts_manufacturer SMALLINT NOT NULL, perms_parts_status SMALLINT NOT NULL, perms_parts_mpn SMALLINT NOT NULL, perms_parts_comment SMALLINT NOT NULL, perms_parts_order SMALLINT NOT NULL, perms_parts_orderdetails SMALLINT NOT NULL, perms_parts_prices SMALLINT NOT NULL, perms_parts_parameters SMALLINT NOT NULL, perms_parts_attachements SMALLINT NOT NULL, perms_devices INTEGER NOT NULL, perms_devices_parts INTEGER NOT NULL, perms_storelocations INTEGER NOT NULL, perms_footprints INTEGER NOT NULL, perms_categories INTEGER NOT NULL, perms_suppliers INTEGER NOT NULL, perms_manufacturers INTEGER NOT NULL, perms_attachement_types INTEGER NOT NULL, perms_currencies INTEGER NOT NULL, perms_measurement_units INTEGER NOT NULL, perms_tools INTEGER NOT NULL, perms_labels INTEGER NOT NULL)');
|
||||
$this->addSql('INSERT INTO "groups" (id, parent_id, id_preview_attachement, enforce_2fa, comment, not_selectable, name, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels) SELECT id, parent_id, id_preview_attachement, enforce_2fa, comment, not_selectable, name, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels FROM __temp__groups');
|
||||
$this->addSql('DROP TABLE __temp__groups');
|
||||
$this->addSql('CREATE INDEX IDX_F06D3970727ACA70 ON "groups" (parent_id)');
|
||||
$this->addSql('CREATE INDEX IDX_F06D39706DEDCEC2 ON "groups" (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__label_profiles AS SELECT id, id_preview_attachement, comment, show_in_dropdown, name, last_modified, datetime_added, options_width, options_height, options_barcode_type, options_picture_type, options_supported_element, options_additional_css, options_lines_mode, options_lines FROM label_profiles');
|
||||
$this->addSql('DROP TABLE label_profiles');
|
||||
$this->addSql('CREATE TABLE label_profiles (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_preview_attachement INTEGER DEFAULT NULL, comment CLOB NOT NULL, show_in_dropdown BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, options_width DOUBLE PRECISION NOT NULL, options_height DOUBLE PRECISION NOT NULL, options_barcode_type VARCHAR(255) NOT NULL, options_picture_type VARCHAR(255) NOT NULL, options_supported_element VARCHAR(255) NOT NULL, options_additional_css CLOB NOT NULL, options_lines_mode VARCHAR(255) NOT NULL, options_lines CLOB NOT NULL)');
|
||||
$this->addSql('INSERT INTO label_profiles (id, id_preview_attachement, comment, show_in_dropdown, name, last_modified, datetime_added, options_width, options_height, options_barcode_type, options_picture_type, options_supported_element, options_additional_css, options_lines_mode, options_lines) SELECT id, id_preview_attachement, comment, show_in_dropdown, name, last_modified, datetime_added, options_width, options_height, options_barcode_type, options_picture_type, options_supported_element, options_additional_css, options_lines_mode, options_lines FROM __temp__label_profiles');
|
||||
$this->addSql('DROP TABLE __temp__label_profiles');
|
||||
$this->addSql('CREATE INDEX IDX_C93E9CF56DEDCEC2 ON label_profiles (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__log AS SELECT id, id_user, datetime, level, target_id, target_type, extra, type FROM log');
|
||||
$this->addSql('DROP TABLE log');
|
||||
$this->addSql('CREATE TABLE log (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_user INTEGER NOT NULL, datetime DATETIME NOT NULL, level BOOLEAN NOT NULL, target_id INTEGER NOT NULL, target_type SMALLINT NOT NULL, extra CLOB NOT NULL --
|
||||
(DC2Type:json)
|
||||
, type SMALLINT NOT NULL)');
|
||||
$this->addSql('INSERT INTO log (id, id_user, datetime, level, target_id, target_type, extra, type) SELECT id, id_user, datetime, level, target_id, target_type, extra, type FROM __temp__log');
|
||||
$this->addSql('DROP TABLE __temp__log');
|
||||
$this->addSql('CREATE INDEX IDX_8F3F68C56B3CA4B ON log (id_user)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__manufacturers AS SELECT id, parent_id, id_preview_attachement, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added FROM "manufacturers"');
|
||||
$this->addSql('DROP TABLE "manufacturers"');
|
||||
$this->addSql('CREATE TABLE "manufacturers" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, address VARCHAR(255) NOT NULL, phone_number VARCHAR(255) NOT NULL, fax_number VARCHAR(255) NOT NULL, email_address VARCHAR(255) NOT NULL, website VARCHAR(255) NOT NULL, auto_product_url VARCHAR(255) NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO "manufacturers" (id, parent_id, id_preview_attachement, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added FROM __temp__manufacturers');
|
||||
$this->addSql('DROP TABLE __temp__manufacturers');
|
||||
$this->addSql('CREATE INDEX IDX_94565B12727ACA70 ON "manufacturers" (parent_id)');
|
||||
$this->addSql('CREATE INDEX IDX_94565B126DEDCEC2 ON "manufacturers" (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__measurement_units AS SELECT id, parent_id, id_preview_attachement, unit, is_integer, use_si_prefix, comment, not_selectable, name, last_modified, datetime_added FROM "measurement_units"');
|
||||
$this->addSql('DROP TABLE "measurement_units"');
|
||||
$this->addSql('CREATE TABLE "measurement_units" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, unit VARCHAR(255) DEFAULT NULL, is_integer BOOLEAN NOT NULL, use_si_prefix BOOLEAN NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO "measurement_units" (id, parent_id, id_preview_attachement, unit, is_integer, use_si_prefix, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, id_preview_attachement, unit, is_integer, use_si_prefix, comment, not_selectable, name, last_modified, datetime_added FROM __temp__measurement_units');
|
||||
$this->addSql('DROP TABLE __temp__measurement_units');
|
||||
$this->addSql('CREATE INDEX IDX_F5AF83CF727ACA70 ON "measurement_units" (parent_id)');
|
||||
$this->addSql('CREATE INDEX IDX_F5AF83CF6DEDCEC2 ON "measurement_units" (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__orderdetails AS SELECT id, part_id, id_supplier, supplierpartnr, obsolete, supplier_product_url, last_modified, datetime_added FROM "orderdetails"');
|
||||
$this->addSql('DROP TABLE "orderdetails"');
|
||||
$this->addSql('CREATE TABLE "orderdetails" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, part_id INTEGER NOT NULL, id_supplier INTEGER DEFAULT NULL, supplierpartnr VARCHAR(255) NOT NULL, obsolete BOOLEAN NOT NULL, supplier_product_url VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO "orderdetails" (id, part_id, id_supplier, supplierpartnr, obsolete, supplier_product_url, last_modified, datetime_added) SELECT id, part_id, id_supplier, supplierpartnr, obsolete, supplier_product_url, last_modified, datetime_added FROM __temp__orderdetails');
|
||||
$this->addSql('DROP TABLE __temp__orderdetails');
|
||||
$this->addSql('CREATE INDEX IDX_489AFCDC4CE34BEC ON "orderdetails" (part_id)');
|
||||
$this->addSql('CREATE INDEX IDX_489AFCDCCBF180EB ON "orderdetails" (id_supplier)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__parameters AS SELECT id, symbol, value_min, value_typical, value_max, unit, value_text, param_group, name, last_modified, datetime_added, type, element_id FROM parameters');
|
||||
$this->addSql('DROP TABLE parameters');
|
||||
$this->addSql('CREATE TABLE parameters (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, symbol VARCHAR(255) NOT NULL, value_min DOUBLE PRECISION DEFAULT NULL, value_typical DOUBLE PRECISION DEFAULT NULL, value_max DOUBLE PRECISION DEFAULT NULL, unit VARCHAR(255) NOT NULL, value_text VARCHAR(255) NOT NULL, param_group VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, type SMALLINT NOT NULL, element_id INTEGER NOT NULL)');
|
||||
$this->addSql('INSERT INTO parameters (id, symbol, value_min, value_typical, value_max, unit, value_text, param_group, name, last_modified, datetime_added, type, element_id) SELECT id, symbol, value_min, value_typical, value_max, unit, value_text, param_group, name, last_modified, datetime_added, type, element_id FROM __temp__parameters');
|
||||
$this->addSql('DROP TABLE __temp__parameters');
|
||||
$this->addSql('CREATE INDEX IDX_69348FE1F1F2A24 ON parameters (element_id)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__part_lots AS SELECT id, id_store_location, id_part, description, comment, expiration_date, instock_unknown, amount, needs_refill, last_modified, datetime_added FROM part_lots');
|
||||
$this->addSql('DROP TABLE part_lots');
|
||||
$this->addSql('CREATE TABLE part_lots (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_store_location INTEGER DEFAULT NULL, id_part INTEGER NOT NULL, description CLOB NOT NULL, comment CLOB NOT NULL, expiration_date DATETIME DEFAULT NULL, instock_unknown BOOLEAN NOT NULL, amount DOUBLE PRECISION NOT NULL, needs_refill BOOLEAN NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO part_lots (id, id_store_location, id_part, description, comment, expiration_date, instock_unknown, amount, needs_refill, last_modified, datetime_added) SELECT id, id_store_location, id_part, description, comment, expiration_date, instock_unknown, amount, needs_refill, last_modified, datetime_added FROM __temp__part_lots');
|
||||
$this->addSql('DROP TABLE __temp__part_lots');
|
||||
$this->addSql('CREATE INDEX IDX_EBC8F9435D8F4B37 ON part_lots (id_store_location)');
|
||||
$this->addSql('CREATE INDEX IDX_EBC8F943C22F6CC4 ON part_lots (id_part)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__parts AS SELECT id, id_preview_attachement, id_category, id_footprint, id_part_unit, id_manufacturer, order_orderdetails_id, datetime_added, name, last_modified, needs_review, tags, mass, description, comment, visible, favorite, minamount, manufacturer_product_url, manufacturer_product_number, manufacturing_status, order_quantity, manual_order FROM "parts"');
|
||||
$this->addSql('DROP TABLE "parts"');
|
||||
$this->addSql('CREATE TABLE "parts" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_preview_attachement INTEGER DEFAULT NULL, id_category INTEGER NOT NULL, id_footprint INTEGER DEFAULT NULL, id_part_unit INTEGER DEFAULT NULL, id_manufacturer INTEGER DEFAULT NULL, order_orderdetails_id INTEGER DEFAULT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, needs_review BOOLEAN NOT NULL, tags CLOB NOT NULL, mass DOUBLE PRECISION DEFAULT NULL, description CLOB NOT NULL, comment CLOB NOT NULL, visible BOOLEAN NOT NULL, favorite BOOLEAN NOT NULL, minamount DOUBLE PRECISION NOT NULL, manufacturer_product_url VARCHAR(255) NOT NULL, manufacturer_product_number VARCHAR(255) NOT NULL, manufacturing_status VARCHAR(255) DEFAULT NULL, order_quantity INTEGER NOT NULL, manual_order BOOLEAN NOT NULL)');
|
||||
$this->addSql('INSERT INTO "parts" (id, id_preview_attachement, id_category, id_footprint, id_part_unit, id_manufacturer, order_orderdetails_id, datetime_added, name, last_modified, needs_review, tags, mass, description, comment, visible, favorite, minamount, manufacturer_product_url, manufacturer_product_number, manufacturing_status, order_quantity, manual_order) SELECT id, id_preview_attachement, id_category, id_footprint, id_part_unit, id_manufacturer, order_orderdetails_id, datetime_added, name, last_modified, needs_review, tags, mass, description, comment, visible, favorite, minamount, manufacturer_product_url, manufacturer_product_number, manufacturing_status, order_quantity, manual_order FROM __temp__parts');
|
||||
$this->addSql('DROP TABLE __temp__parts');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE6DEDCEC2 ON "parts" (id_preview_attachement)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE5697F554 ON "parts" (id_category)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE7E371A10 ON "parts" (id_footprint)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE2626CEF9 ON "parts" (id_part_unit)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE1ECB93AE ON "parts" (id_manufacturer)');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_6940A7FE81081E9B ON "parts" (order_orderdetails_id)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__pricedetails AS SELECT id, id_currency, orderdetails_id, price, price_related_quantity, min_discount_quantity, manual_input, last_modified, datetime_added FROM "pricedetails"');
|
||||
$this->addSql('DROP TABLE "pricedetails"');
|
||||
$this->addSql('CREATE TABLE "pricedetails" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id_currency INTEGER DEFAULT NULL, orderdetails_id INTEGER NOT NULL, price NUMERIC(11, 5) NOT NULL --
|
||||
(DC2Type:big_decimal)
|
||||
, price_related_quantity DOUBLE PRECISION NOT NULL, min_discount_quantity DOUBLE PRECISION NOT NULL, manual_input BOOLEAN NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO "pricedetails" (id, id_currency, orderdetails_id, price, price_related_quantity, min_discount_quantity, manual_input, last_modified, datetime_added) SELECT id, id_currency, orderdetails_id, price, price_related_quantity, min_discount_quantity, manual_input, last_modified, datetime_added FROM __temp__pricedetails');
|
||||
$this->addSql('DROP TABLE __temp__pricedetails');
|
||||
$this->addSql('CREATE INDEX IDX_C68C4459398D64AA ON "pricedetails" (id_currency)');
|
||||
$this->addSql('CREATE INDEX IDX_C68C44594A01DDC7 ON "pricedetails" (orderdetails_id)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__storelocations AS SELECT id, parent_id, storage_type_id, id_preview_attachement, is_full, only_single_part, limit_to_existing_parts, comment, not_selectable, name, last_modified, datetime_added FROM "storelocations"');
|
||||
$this->addSql('DROP TABLE "storelocations"');
|
||||
$this->addSql('CREATE TABLE "storelocations" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, storage_type_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, is_full BOOLEAN NOT NULL, only_single_part BOOLEAN NOT NULL, limit_to_existing_parts BOOLEAN NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO "storelocations" (id, parent_id, storage_type_id, id_preview_attachement, is_full, only_single_part, limit_to_existing_parts, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, storage_type_id, id_preview_attachement, is_full, only_single_part, limit_to_existing_parts, comment, not_selectable, name, last_modified, datetime_added FROM __temp__storelocations');
|
||||
$this->addSql('DROP TABLE __temp__storelocations');
|
||||
$this->addSql('CREATE INDEX IDX_7517020727ACA70 ON "storelocations" (parent_id)');
|
||||
$this->addSql('CREATE INDEX IDX_7517020B270BFF1 ON "storelocations" (storage_type_id)');
|
||||
$this->addSql('CREATE INDEX IDX_75170206DEDCEC2 ON "storelocations" (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__suppliers AS SELECT id, parent_id, default_currency_id, id_preview_attachement, shipping_costs, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added FROM "suppliers"');
|
||||
$this->addSql('DROP TABLE "suppliers"');
|
||||
$this->addSql('CREATE TABLE "suppliers" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, parent_id INTEGER DEFAULT NULL, default_currency_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, shipping_costs NUMERIC(11, 5) DEFAULT NULL --
|
||||
(DC2Type:big_decimal)
|
||||
, address VARCHAR(255) NOT NULL, phone_number VARCHAR(255) NOT NULL, fax_number VARCHAR(255) NOT NULL, email_address VARCHAR(255) NOT NULL, website VARCHAR(255) NOT NULL, auto_product_url VARCHAR(255) NOT NULL, comment CLOB NOT NULL, not_selectable BOOLEAN NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO "suppliers" (id, parent_id, default_currency_id, id_preview_attachement, shipping_costs, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added) SELECT id, parent_id, default_currency_id, id_preview_attachement, shipping_costs, address, phone_number, fax_number, email_address, website, auto_product_url, comment, not_selectable, name, last_modified, datetime_added FROM __temp__suppliers');
|
||||
$this->addSql('DROP TABLE __temp__suppliers');
|
||||
$this->addSql('CREATE INDEX IDX_AC28B95C727ACA70 ON "suppliers" (parent_id)');
|
||||
$this->addSql('CREATE INDEX IDX_AC28B95CECD792C0 ON "suppliers" (default_currency_id)');
|
||||
$this->addSql('CREATE INDEX IDX_AC28B95C6DEDCEC2 ON "suppliers" (id_preview_attachement)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__u2f_keys AS SELECT id, user_id, key_handle, public_key, certificate, counter, name, last_modified, datetime_added FROM u2f_keys');
|
||||
$this->addSql('DROP TABLE u2f_keys');
|
||||
$this->addSql('CREATE TABLE u2f_keys (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, key_handle VARCHAR(128) NOT NULL, public_key VARCHAR(255) NOT NULL, certificate CLOB NOT NULL, counter VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL)');
|
||||
$this->addSql('INSERT INTO u2f_keys (id, user_id, key_handle, public_key, certificate, counter, name, last_modified, datetime_added) SELECT id, user_id, key_handle, public_key, certificate, counter, name, last_modified, datetime_added FROM __temp__u2f_keys');
|
||||
$this->addSql('DROP TABLE __temp__u2f_keys');
|
||||
$this->addSql('CREATE INDEX IDX_4F4ADB4BA76ED395 ON u2f_keys (user_id)');
|
||||
$this->addSql('CREATE UNIQUE INDEX user_unique ON u2f_keys (user_id, key_handle)');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__users AS SELECT id, group_id, currency_id, id_preview_attachement, disabled, config_theme, pw_reset_token, config_instock_comment_a, config_instock_comment_w, trusted_device_cookie_version, backup_codes, google_authenticator_secret, config_timezone, config_language, email, department, last_name, first_name, need_pw_change, password, name, settings, backup_codes_generation_date, pw_reset_expires, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels FROM "users"');
|
||||
$this->addSql('DROP TABLE "users"');
|
||||
$this->addSql('CREATE TABLE "users" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, group_id INTEGER DEFAULT NULL, currency_id INTEGER DEFAULT NULL, id_preview_attachement INTEGER DEFAULT NULL, disabled BOOLEAN NOT NULL, config_theme VARCHAR(255) DEFAULT NULL, pw_reset_token VARCHAR(255) DEFAULT NULL, config_instock_comment_a CLOB NOT NULL, config_instock_comment_w CLOB NOT NULL, trusted_device_cookie_version INTEGER NOT NULL, backup_codes CLOB NOT NULL --
|
||||
(DC2Type:json)
|
||||
, google_authenticator_secret VARCHAR(255) DEFAULT NULL, config_timezone VARCHAR(255) DEFAULT NULL, config_language VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, department VARCHAR(255) DEFAULT NULL, last_name VARCHAR(255) DEFAULT NULL, first_name VARCHAR(255) DEFAULT NULL, need_pw_change BOOLEAN NOT NULL, password VARCHAR(255) DEFAULT NULL, name VARCHAR(180) NOT NULL, settings CLOB NOT NULL --
|
||||
(DC2Type:json)
|
||||
, backup_codes_generation_date DATETIME DEFAULT NULL, pw_reset_expires DATETIME DEFAULT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, perms_system INTEGER NOT NULL, perms_groups INTEGER NOT NULL, perms_users INTEGER NOT NULL, perms_self INTEGER NOT NULL, perms_system_config INTEGER NOT NULL, perms_system_database INTEGER NOT NULL, perms_parts BIGINT NOT NULL, perms_parts_name SMALLINT NOT NULL, perms_parts_category SMALLINT NOT NULL, perms_parts_description SMALLINT NOT NULL, perms_parts_minamount SMALLINT NOT NULL, perms_parts_footprint SMALLINT NOT NULL, perms_parts_lots SMALLINT NOT NULL, perms_parts_tags SMALLINT NOT NULL, perms_parts_unit SMALLINT NOT NULL, perms_parts_mass SMALLINT NOT NULL, perms_parts_manufacturer SMALLINT NOT NULL, perms_parts_status SMALLINT NOT NULL, perms_parts_mpn SMALLINT NOT NULL, perms_parts_comment SMALLINT NOT NULL, perms_parts_order SMALLINT NOT NULL, perms_parts_orderdetails SMALLINT NOT NULL, perms_parts_prices SMALLINT NOT NULL, perms_parts_parameters SMALLINT NOT NULL, perms_parts_attachements SMALLINT NOT NULL, perms_devices INTEGER NOT NULL, perms_devices_parts INTEGER NOT NULL, perms_storelocations INTEGER NOT NULL, perms_footprints INTEGER NOT NULL, perms_categories INTEGER NOT NULL, perms_suppliers INTEGER NOT NULL, perms_manufacturers INTEGER NOT NULL, perms_attachement_types INTEGER NOT NULL, perms_currencies INTEGER NOT NULL, perms_measurement_units INTEGER NOT NULL, perms_tools INTEGER NOT NULL, perms_labels INTEGER NOT NULL)');
|
||||
$this->addSql('INSERT INTO "users" (id, group_id, currency_id, id_preview_attachement, disabled, config_theme, pw_reset_token, config_instock_comment_a, config_instock_comment_w, trusted_device_cookie_version, backup_codes, google_authenticator_secret, config_timezone, config_language, email, department, last_name, first_name, need_pw_change, password, name, settings, backup_codes_generation_date, pw_reset_expires, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels) SELECT id, group_id, currency_id, id_preview_attachement, disabled, config_theme, pw_reset_token, config_instock_comment_a, config_instock_comment_w, trusted_device_cookie_version, backup_codes, google_authenticator_secret, config_timezone, config_language, email, department, last_name, first_name, need_pw_change, password, name, settings, backup_codes_generation_date, pw_reset_expires, last_modified, datetime_added, perms_system, perms_groups, perms_users, perms_self, perms_system_config, perms_system_database, perms_parts, perms_parts_name, perms_parts_category, perms_parts_description, perms_parts_minamount, perms_parts_footprint, perms_parts_lots, perms_parts_tags, perms_parts_unit, perms_parts_mass, perms_parts_manufacturer, perms_parts_status, perms_parts_mpn, perms_parts_comment, perms_parts_order, perms_parts_orderdetails, perms_parts_prices, perms_parts_parameters, perms_parts_attachements, perms_devices, perms_devices_parts, perms_storelocations, perms_footprints, perms_categories, perms_suppliers, perms_manufacturers, perms_attachement_types, perms_currencies, perms_measurement_units, perms_tools, perms_labels FROM __temp__users');
|
||||
$this->addSql('DROP TABLE __temp__users');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_1483A5E95E237E06 ON "users" (name)');
|
||||
$this->addSql('CREATE INDEX IDX_1483A5E9FE54D947 ON "users" (group_id)');
|
||||
$this->addSql('CREATE INDEX IDX_1483A5E938248176 ON "users" (currency_id)');
|
||||
$this->addSql('CREATE INDEX IDX_1483A5E96DEDCEC2 ON "users" (id_preview_attachement)');
|
||||
}
|
||||
}
|
50
migrations/Version20221003212851.php
Normal file
50
migrations/Version20221003212851.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use App\Migration\AbstractMultiPlatformMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20221003212851 extends AbstractMultiPlatformMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add Tables for Webauthn Keys';
|
||||
}
|
||||
|
||||
public function mySQLUp(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE webauthn_keys (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, public_key_credential_id LONGTEXT NOT NULL COMMENT \'(DC2Type:base64)\', type VARCHAR(255) NOT NULL, transports LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', attestation_type VARCHAR(255) NOT NULL, trust_path LONGTEXT NOT NULL COMMENT \'(DC2Type:trust_path)\', aaguid TINYTEXT NOT NULL COMMENT \'(DC2Type:aaguid)\', credential_public_key LONGTEXT NOT NULL COMMENT \'(DC2Type:base64)\', user_handle VARCHAR(255) NOT NULL, counter INT NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, INDEX IDX_799FD143A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE webauthn_keys ADD CONSTRAINT FK_799FD143A76ED395 FOREIGN KEY (user_id) REFERENCES `users` (id)');
|
||||
}
|
||||
|
||||
public function mySQLDown(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE webauthn_keys DROP FOREIGN KEY FK_799FD143A76ED395');
|
||||
$this->addSql('DROP TABLE webauthn_keys');
|
||||
}
|
||||
|
||||
public function sqLiteUp(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE TABLE webauthn_keys (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, public_key_credential_id CLOB NOT NULL --(DC2Type:base64)
|
||||
, type VARCHAR(255) NOT NULL, transports CLOB NOT NULL --(DC2Type:array)
|
||||
, attestation_type VARCHAR(255) NOT NULL, trust_path CLOB NOT NULL --(DC2Type:trust_path)
|
||||
, aaguid CLOB NOT NULL --(DC2Type:aaguid)
|
||||
, credential_public_key CLOB NOT NULL --(DC2Type:base64)
|
||||
, user_handle VARCHAR(255) NOT NULL, counter INTEGER NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_799FD143A76ED395 FOREIGN KEY (user_id) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('CREATE INDEX IDX_799FD143A76ED395 ON webauthn_keys (user_id)');
|
||||
}
|
||||
|
||||
public function sqLiteDown(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP TABLE webauthn_keys');
|
||||
}
|
||||
}
|
|
@ -1,18 +1,22 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.19.6",
|
||||
"@babel/preset-env": "^7.19.4",
|
||||
"@fortawesome/fontawesome-free": "^6.1.1",
|
||||
"@hotwired/stimulus": "^3.0.0",
|
||||
"@hotwired/turbo": "^7.0.1",
|
||||
"@popperjs/core": "^2.10.2",
|
||||
"@symfony/stimulus-bridge": "^3.2.0",
|
||||
"@symfony/ux-turbo": "file:vendor/symfony/ux-turbo/Resources/assets",
|
||||
"@symfony/webpack-encore": "^3.0.0",
|
||||
"@symfony/webpack-encore": "^4.1.0",
|
||||
"bootstrap": "^5.1.3",
|
||||
"core-js": "^3.23.0",
|
||||
"jquery": "^3.5.1",
|
||||
"popper.js": "^1.14.7",
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"webpack": "^5.74.0",
|
||||
"webpack-bundle-analyzer": "^4.3.0",
|
||||
"webpack-cli": "^4.10.0",
|
||||
"webpack-notifier": "^1.15.0"
|
||||
},
|
||||
"license": "AGPL-3.0-or-later",
|
||||
|
@ -83,7 +87,6 @@
|
|||
"stimulus-use": "^0.50.0",
|
||||
"tom-select": "^2.1.0",
|
||||
"ts-loader": "^9.2.6",
|
||||
"typescript": "^4.0.2",
|
||||
"u2f-api": "^1.1.1"
|
||||
"typescript": "^4.0.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,8 @@ use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
|||
use Symfony\Component\Validator\ConstraintViolationList;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function Symfony\Component\Translation\t;
|
||||
|
||||
abstract class BaseAdminController extends AbstractController
|
||||
{
|
||||
protected $entity_class = '';
|
||||
|
@ -419,7 +421,7 @@ abstract class BaseAdminController extends AbstractController
|
|||
/** @var AbstractPartsContainingRepository $repo */
|
||||
$repo = $this->entityManager->getRepository($this->entity_class);
|
||||
if ($repo->getPartsCount($entity) > 0) {
|
||||
$this->addFlash('error', 'entity.delete.must_not_contain_parts');
|
||||
$this->addFlash('error', t('entity.delete.must_not_contain_parts', ['%PATH%' => $entity->getFullPath()]));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -442,7 +444,18 @@ abstract class BaseAdminController extends AbstractController
|
|||
|
||||
//Check if we need to remove recursively
|
||||
if ($entity instanceof AbstractStructuralDBElement && $request->get('delete_recursive', false)) {
|
||||
$recursionHelper->delete($entity, false);
|
||||
$can_delete = true;
|
||||
//Check if any of the children can not be deleted, cause it contains parts
|
||||
$recursionHelper->execute($entity, function (AbstractStructuralDBElement $element) use (&$can_delete) {
|
||||
if(!$this->deleteCheck($element)) {
|
||||
$can_delete = false;
|
||||
}
|
||||
});
|
||||
if($can_delete) {
|
||||
$recursionHelper->delete($entity, false);
|
||||
} else {
|
||||
return $this->redirectToRoute($this->route_base.'_edit', ['id' => $entity->getID()]);
|
||||
}
|
||||
} else {
|
||||
if ($entity instanceof AbstractStructuralDBElement) {
|
||||
$parent = $entity->getParent();
|
||||
|
|
|
@ -80,6 +80,8 @@ class PartListsController extends AbstractController
|
|||
*/
|
||||
public function tableAction(Request $request, PartsTableActionHandler $actionHandler): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('@parts.edit');
|
||||
|
||||
$redirect = $request->request->get('redirect_back');
|
||||
$ids = $request->request->get('ids');
|
||||
$action = $request->request->get('action');
|
||||
|
@ -137,6 +139,8 @@ class PartListsController extends AbstractController
|
|||
*/
|
||||
protected function showListWithFilter(Request $request, string $template, ?callable $filter_changer = null, ?callable $form_changer = null, array $additonal_template_vars = [], array $additional_table_vars = []): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('@parts.read');
|
||||
|
||||
$formRequest = clone $request;
|
||||
$formRequest->setMethod('GET');
|
||||
$filter = new PartFilter($this->nodesListBuilder);
|
||||
|
|
|
@ -113,7 +113,10 @@ class UserController extends AdminPages\BaseAdminController
|
|||
$entity->setGoogleAuthenticatorSecret(null);
|
||||
$entity->setBackupCodes([]);
|
||||
//Remove all U2F keys
|
||||
foreach ($entity->getU2FKeys() as $key) {
|
||||
foreach ($entity->getLegacyU2FKeys() as $key) {
|
||||
$em->remove($key);
|
||||
}
|
||||
foreach ($entity->getWebAuthnKeys() as $key) {
|
||||
$em->remove($key);
|
||||
}
|
||||
//Invalidate trusted devices
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace App\Controller;
|
|||
|
||||
use App\Entity\UserSystem\U2FKey;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Entity\UserSystem\WebauthnKey;
|
||||
use App\Events\SecurityEvent;
|
||||
use App\Events\SecurityEvents;
|
||||
use App\Form\TFAGoogleSettingsType;
|
||||
|
@ -130,6 +131,7 @@ class UserSettingsController extends AbstractController
|
|||
}
|
||||
|
||||
if ($this->isCsrfTokenValid('delete'.$user->getId(), $request->request->get('_token'))) {
|
||||
//Handle U2F key removal
|
||||
if ($request->request->has('key_id')) {
|
||||
$key_id = $request->request->get('key_id');
|
||||
$key_repo = $entityManager->getRepository(U2FKey::class);
|
||||
|
@ -138,14 +140,14 @@ class UserSettingsController extends AbstractController
|
|||
if (null === $u2f) {
|
||||
$this->addFlash('danger', 'tfa_u2f.u2f_delete.not_existing');
|
||||
|
||||
throw new RuntimeException('Key not existing!');
|
||||
return $this->redirectToRoute('user_settings');
|
||||
}
|
||||
|
||||
//User can only delete its own U2F keys
|
||||
if ($u2f->getUser() !== $user) {
|
||||
$this->addFlash('danger', 'tfa_u2f.u2f_delete.access_denied');
|
||||
|
||||
throw new RuntimeException('You can only delete your own U2F keys!');
|
||||
return $this->redirectToRoute('user_settings');
|
||||
}
|
||||
|
||||
$backupCodeManager->disableBackupCodesIfUnused($user);
|
||||
|
@ -153,6 +155,31 @@ class UserSettingsController extends AbstractController
|
|||
$entityManager->flush();
|
||||
$this->addFlash('success', 'tfa.u2f.u2f_delete.success');
|
||||
|
||||
$security_event = new SecurityEvent($user);
|
||||
$this->eventDispatcher->dispatch($security_event, SecurityEvents::U2F_REMOVED);
|
||||
} else if ($request->request->has('webauthn_key_id')) {
|
||||
$key_id = $request->request->get('webauthn_key_id');
|
||||
$key_repo = $entityManager->getRepository(WebauthnKey::class);
|
||||
/** @var WebauthnKey|null $key */
|
||||
$key = $key_repo->find($key_id);
|
||||
if (null === $key) {
|
||||
$this->addFlash('error', 'tfa_u2f.u2f_delete.not_existing');
|
||||
|
||||
return $this->redirectToRoute('user_settings');
|
||||
}
|
||||
|
||||
//User can only delete its own U2F keys
|
||||
if ($key->getUser() !== $user) {
|
||||
$this->addFlash('error', 'tfa_u2f.u2f_delete.access_denied');
|
||||
|
||||
return $this->redirectToRoute('user_settings');
|
||||
}
|
||||
|
||||
$backupCodeManager->disableBackupCodesIfUnused($user);
|
||||
$entityManager->remove($key);
|
||||
$entityManager->flush();
|
||||
$this->addFlash('success', 'tfa.u2f.u2f_delete.success');
|
||||
|
||||
$security_event = new SecurityEvent($user);
|
||||
$this->eventDispatcher->dispatch($security_event, SecurityEvents::U2F_REMOVED);
|
||||
}
|
||||
|
|
60
src/Controller/WebauthnKeyRegistrationController.php
Normal file
60
src/Controller/WebauthnKeyRegistrationController.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\UserSystem\WebauthnKey;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Jbtronics\TFAWebauthn\Services\TFAWebauthnRegistrationHelper;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use function Symfony\Component\Translation\t;
|
||||
|
||||
class WebauthnKeyRegistrationController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/webauthn/register", name="webauthn_register")
|
||||
*/
|
||||
public function register(Request $request, TFAWebauthnRegistrationHelper $registrationHelper, EntityManagerInterface $em)
|
||||
{
|
||||
|
||||
//If form was submitted, check the auth response
|
||||
if ($request->getMethod() === 'POST') {
|
||||
$webauthnResponse = $request->request->get('_auth_code');
|
||||
|
||||
//Retrieve other data from the form, that you want to store with the key
|
||||
$keyName = $request->request->get('keyName');
|
||||
if (empty($keyName)) {
|
||||
$keyName = 'Key ' . date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
//Check the response
|
||||
try {
|
||||
$new_key = $registrationHelper->checkRegistrationResponse($webauthnResponse);
|
||||
} catch (\Exception $exception) {
|
||||
$this->addFlash('error', t('tfa_u2f.add_key.registration_error'));
|
||||
return $this->redirectToRoute('webauthn_register');
|
||||
}
|
||||
|
||||
$keyEntity = WebauthnKey::fromRegistration($new_key);
|
||||
$keyEntity->setName($keyName);
|
||||
$keyEntity->setUser($this->getUser());
|
||||
|
||||
$em->persist($keyEntity);
|
||||
$em->flush();
|
||||
|
||||
|
||||
$this->addFlash('success', 'Key registered successfully');
|
||||
return $this->redirectToRoute('user_settings');
|
||||
}
|
||||
|
||||
|
||||
return $this->render(
|
||||
'Security/Webauthn/webauthn_register.html.twig',
|
||||
[
|
||||
'registrationRequest' => $registrationHelper->generateRegistrationRequestAsJSON(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
|
@ -226,7 +226,7 @@ final class AttachmentDataTable implements DataTableTypeInterface
|
|||
|
||||
private function getQuery(QueryBuilder $builder): void
|
||||
{
|
||||
$builder->distinct()->select('attachment')
|
||||
$builder->select('attachment')
|
||||
->addSelect('attachment_type')
|
||||
//->addSelect('element')
|
||||
->from(Attachment::class, 'attachment')
|
||||
|
|
|
@ -297,7 +297,7 @@ class LogDataTable implements DataTableTypeInterface
|
|||
|
||||
protected function getQuery(QueryBuilder $builder, array $options): void
|
||||
{
|
||||
$builder->distinct()->select('log')
|
||||
$builder->select('log')
|
||||
->addSelect('user')
|
||||
->from(AbstractLogEntry::class, 'log')
|
||||
->leftJoin('log.user', 'user');
|
||||
|
|
|
@ -292,8 +292,8 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
|
||||
private function getQuery(QueryBuilder $builder): void
|
||||
{
|
||||
|
||||
$builder->distinct()->select('part')
|
||||
//Distinct is very slow here, do not add this here (also I think this is not needed here, as the id column is always distinct)
|
||||
$builder->select('part')
|
||||
->addSelect('category')
|
||||
->addSelect('footprint')
|
||||
->addSelect('manufacturer')
|
||||
|
|
|
@ -34,7 +34,12 @@ use LogicException;
|
|||
* Class Attachment.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\AttachmentRepository")
|
||||
* @ORM\Table(name="`attachments`")
|
||||
* @ORM\Table(name="`attachments`", indexes={
|
||||
* @ORM\Index(name="attachments_idx_id_element_id_class_name", columns={"id", "element_id", "class_name"}),
|
||||
* @ORM\Index(name="attachments_idx_class_name_id", columns={"class_name", "id"}),
|
||||
* @ORM\Index(name="attachment_name_idx", columns={"name"}),
|
||||
* @ORM\Index(name="attachment_element_idx", columns={"class_name", "element_id"})
|
||||
* })
|
||||
* @ORM\InheritanceType("SINGLE_TABLE")
|
||||
* @ORM\DiscriminatorColumn(name="class_name", type="string")
|
||||
* @ORM\DiscriminatorMap({
|
||||
|
@ -104,7 +109,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
/**
|
||||
* @var AttachmentType
|
||||
* @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type")
|
||||
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
|
||||
* @ORM\JoinColumn(name="type_id", referencedColumnName="id", nullable=false)
|
||||
* @Selectable()
|
||||
* @Assert\NotNull(message="validator.attachment.must_not_be_null")
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* Class AttachmentType.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
* @ORM\Table(name="`attachment_types`")
|
||||
* @ORM\Table(name="`attachment_types`", indexes={
|
||||
* @ORM\Index(name="attachment_types_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="attachment_types_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
*/
|
||||
class AttachmentType extends AbstractStructuralDBElement
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
* @NoneOfItsChildren()
|
||||
* @Groups({"include_parents"})
|
||||
*/
|
||||
protected $parent;
|
||||
protected $parent = null;
|
||||
|
||||
/** @var string[] all names of all parent elements as a array of strings,
|
||||
* the last array element is the name of the element itself
|
||||
|
@ -271,16 +271,17 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
*/
|
||||
public function getSubelements(): iterable
|
||||
{
|
||||
return $this->children;
|
||||
return $this->children ?? new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see getSubelements()
|
||||
* @return Collection<static>|iterable
|
||||
* @psalm-return Collection<int, static>
|
||||
*/
|
||||
public function getChildren(): iterable
|
||||
{
|
||||
return $this->children;
|
||||
return $this->getSubelements();
|
||||
}
|
||||
|
||||
public function isNotSelectable(): bool
|
||||
|
|
|
@ -78,12 +78,12 @@ class DevicePart extends AbstractDBElement
|
|||
* @ORM\ManyToOne(targetEntity="Device", inversedBy="parts")
|
||||
* @ORM\JoinColumn(name="id_device", referencedColumnName="id")
|
||||
*/
|
||||
protected Device $device;
|
||||
protected ?Device $device = null;
|
||||
|
||||
/**
|
||||
* @var Part
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part")
|
||||
* @ORM\JoinColumn(name="id_part", referencedColumnName="id")
|
||||
*/
|
||||
protected Part $part;
|
||||
protected ?Part $part = null;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,11 @@ use Psr\Log\LogLevel;
|
|||
* This entity describes a entry in the event log.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\LogEntryRepository")
|
||||
* @ORM\Table("log")
|
||||
* @ORM\Table("log", indexes={
|
||||
* @ORM\Index(name="log_idx_type", columns={"type"}),
|
||||
* @ORM\Index(name="log_idx_type_target", columns={"type", "target_type", "target_id"}),
|
||||
* @ORM\Index(name="log_idx_datetime", columns={"datetime"}),
|
||||
* })
|
||||
* @ORM\InheritanceType("SINGLE_TABLE")
|
||||
* @ORM\DiscriminatorColumn(name="type", type="smallint")
|
||||
* @ORM\DiscriminatorMap({
|
||||
|
|
|
@ -34,7 +34,11 @@ use function sprintf;
|
|||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @ORM\Table("parameters")
|
||||
* @ORM\Table("parameters", indexes={
|
||||
* @ORM\Index(name="parameter_name_idx", columns={"name"}),
|
||||
* @ORM\Index(name="parameter_group_idx", columns={"param_group"}),
|
||||
* @ORM\Index(name="parameter_type_element_idx", columns={"type", "element_id"})
|
||||
* })
|
||||
* @ORM\InheritanceType("SINGLE_TABLE")
|
||||
* @ORM\DiscriminatorColumn(name="type", type="smallint")
|
||||
* @ORM\DiscriminatorMap({
|
||||
|
@ -91,7 +95,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* @var string The unit in which the value values are given (e.g. V)
|
||||
* @Assert\Length(max=5)
|
||||
* @ORM\Column(type="string", nullable=false)
|
||||
*/
|
||||
protected string $unit = '';
|
||||
|
|
|
@ -33,7 +33,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* Class AttachmentType.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\Parts\CategoryRepository")
|
||||
* @ORM\Table(name="`categories`")
|
||||
* @ORM\Table(name="`categories`", indexes={
|
||||
* @ORM\Index(name="category_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="category_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
*/
|
||||
class Category extends AbstractPartsContainingDBElement
|
||||
{
|
||||
|
|
|
@ -61,7 +61,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* Class Footprint.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\Parts\FootprintRepository")
|
||||
* @ORM\Table("`footprints`")
|
||||
* @ORM\Table("`footprints`", indexes={
|
||||
* @ORM\Index(name="footprint_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="footprint_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
*/
|
||||
class Footprint extends AbstractPartsContainingDBElement
|
||||
{
|
||||
|
|
|
@ -61,7 +61,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* Class Manufacturer.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\Parts\ManufacturerRepository")
|
||||
* @ORM\Table("`manufacturers`")
|
||||
* @ORM\Table("`manufacturers`", indexes={
|
||||
* @ORM\Index(name="manufacturer_name", columns={"name"}),
|
||||
* @ORM\Index(name="manufacturer_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
*/
|
||||
class Manufacturer extends AbstractCompany
|
||||
{
|
||||
|
|
|
@ -55,7 +55,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* This could be something like N, grams, meters, etc...
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\Parts\MeasurementUnitRepository")
|
||||
* @ORM\Table(name="`measurement_units`")
|
||||
* @ORM\Table(name="`measurement_units`", indexes={
|
||||
* @ORM\Index(name="unit_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="unit_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
* @UniqueEntity("unit")
|
||||
*/
|
||||
class MeasurementUnit extends AbstractPartsContainingDBElement
|
||||
|
@ -66,7 +69,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
* @ORM\Column(type="string", name="unit", nullable=true)
|
||||
* @Assert\Length(max=10)
|
||||
*/
|
||||
protected string $unit;
|
||||
protected ?string $unit = null;
|
||||
|
||||
/**
|
||||
* @var bool Determines if the amount value associated with this unit should be treated as integer.
|
||||
|
|
|
@ -74,7 +74,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* Otherwise this class would be too big, to be maintained.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\PartRepository")
|
||||
* @ORM\Table("`parts`")
|
||||
* @ORM\Table("`parts`", indexes={
|
||||
* @ORM\Index(name="parts_idx_datet_name_last_id_needs", columns={"datetime_added", "name", "last_modified", "id", "needs_review"}),
|
||||
* @ORM\Index(name="parts_idx_name", columns={"name"}),
|
||||
* })
|
||||
*/
|
||||
class Part extends AttachmentContainingDBElement
|
||||
{
|
||||
|
|
|
@ -58,7 +58,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* It is the connection between a part and its store locations.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="part_lots")
|
||||
* @ORM\Table(name="part_lots", indexes={
|
||||
* @ORM\Index(name="part_lots_idx_instock_un_expiration_id_part", columns={"instock_unknown", "expiration_date", "id_part"}),
|
||||
* @ORM\Index(name="part_lots_idx_needs_refill", columns={"needs_refill"}),
|
||||
* })
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
* @ValidPartLot()
|
||||
*/
|
||||
|
|
|
@ -79,7 +79,7 @@ trait ManufacturerTrait
|
|||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""})
|
||||
*/
|
||||
protected string $manufacturing_status = '';
|
||||
protected ?string $manufacturing_status = '';
|
||||
|
||||
/**
|
||||
* Get the link to the website of the article on the manufacturers website
|
||||
|
|
|
@ -79,7 +79,7 @@ trait OrderTrait
|
|||
* @ORM\OneToOne(targetEntity="App\Entity\PriceInformations\Orderdetail")
|
||||
* @ORM\JoinColumn(name="order_orderdetails_id", referencedColumnName="id")
|
||||
*/
|
||||
protected Orderdetail $order_orderdetail;
|
||||
protected ?Orderdetail $order_orderdetail = null;
|
||||
|
||||
/**
|
||||
* Get the selected order orderdetails of this part.
|
||||
|
|
|
@ -61,7 +61,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* Class Store location.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\Parts\StorelocationRepository")
|
||||
* @ORM\Table("`storelocations`")
|
||||
* @ORM\Table("`storelocations`", indexes={
|
||||
* @ORM\Index(name="location_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="location_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
*/
|
||||
class Storelocation extends AbstractPartsContainingDBElement
|
||||
{
|
||||
|
|
|
@ -65,7 +65,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* Class Supplier.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\Parts\SupplierRepository")
|
||||
* @ORM\Table("`suppliers`")
|
||||
* @ORM\Table("`suppliers`", indexes={
|
||||
* @ORM\Index(name="supplier_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="supplier_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
*/
|
||||
class Supplier extends AbstractCompany
|
||||
{
|
||||
|
|
|
@ -59,7 +59,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
*
|
||||
* @UniqueEntity("iso_code")
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="currencies")
|
||||
* @ORM\Table(name="currencies", indexes={
|
||||
* @ORM\Index(name="currency_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="currency_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
*/
|
||||
class Currency extends AbstractStructuralDBElement
|
||||
{
|
||||
|
@ -78,7 +81,7 @@ class Currency extends AbstractStructuralDBElement
|
|||
* @ORM\Column(type="string")
|
||||
* @Assert\Currency()
|
||||
*/
|
||||
protected string $iso_code;
|
||||
protected string $iso_code = "";
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Currency", mappedBy="parent", cascade={"persist"})
|
||||
|
|
|
@ -66,7 +66,9 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
/**
|
||||
* Class Orderdetail.
|
||||
*
|
||||
* @ORM\Table("`orderdetails`")
|
||||
* @ORM\Table("`orderdetails`", indexes={
|
||||
* @ORM\Index(name="orderdetails_supplier_part_nr", columns={"supplierpartnr"}),
|
||||
* })
|
||||
* @ORM\Entity()
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
* @UniqueEntity({"supplierpartnr", "supplier", "part"})
|
||||
|
|
|
@ -66,7 +66,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* Class Pricedetail.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table("`pricedetails`")
|
||||
* @ORM\Table("`pricedetails`", indexes={
|
||||
* @ORM\Index(name="pricedetails_idx_min_discount", columns={"min_discount_quantity"}),
|
||||
* @ORM\Index(name="pricedetails_idx_min_discount_price_qty", columns={"min_discount_quantity", "price_related_quantity"}),
|
||||
* })
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
* @UniqueEntity(fields={"min_discount_quantity", "orderdetail"})
|
||||
*/
|
||||
|
|
|
@ -56,7 +56,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* This entity represents an user group.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table("`groups`")
|
||||
* @ORM\Table("`groups`", indexes={
|
||||
* @ORM\Index(name="group_idx_name", columns={"name"}),
|
||||
* @ORM\Index(name="group_idx_parent_name", columns={"parent_id", "name"}),
|
||||
* })
|
||||
*/
|
||||
class Group extends AbstractStructuralDBElement implements HasPermissionsInterface
|
||||
{
|
||||
|
@ -75,8 +78,9 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="User", mappedBy="group")
|
||||
* @var Collection<User>
|
||||
*/
|
||||
protected Collection $users;
|
||||
protected $users;
|
||||
|
||||
/**
|
||||
* @var bool If true all users associated with this group must have enabled some kind of 2 factor authentication
|
||||
|
@ -85,7 +89,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
protected $enforce2FA = false;
|
||||
/**
|
||||
* @var Collection<int, GroupAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\GroupAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
|
|
|
@ -44,8 +44,7 @@ namespace App\Entity\UserSystem;
|
|||
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorKeyInterface;
|
||||
use u2flib_server\Registration;
|
||||
use Jbtronics\TFAWebauthn\Model\LegacyU2FKeyInterface;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
|
@ -56,7 +55,7 @@ use u2flib_server\Registration;
|
|||
* })
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class U2FKey implements TwoFactorKeyInterface
|
||||
class U2FKey implements LegacyU2FKeyInterface
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
||||
|
@ -110,14 +109,6 @@ class U2FKey implements TwoFactorKeyInterface
|
|||
**/
|
||||
protected ?User $user = null;
|
||||
|
||||
public function fromRegistrationData(Registration $data): void
|
||||
{
|
||||
$this->keyHandle = $data->keyHandle;
|
||||
$this->publicKey = $data->publicKey;
|
||||
$this->certificate = $data->certificate;
|
||||
$this->counter = $data->counter;
|
||||
}
|
||||
|
||||
public function getKeyHandle(): string
|
||||
{
|
||||
return $this->keyHandle;
|
||||
|
|
|
@ -57,7 +57,9 @@ use App\Entity\PriceInformations\Currency;
|
|||
use App\Security\Interfaces\HasPermissionsInterface;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use App\Validator\Constraints\ValidPermission;
|
||||
use Jbtronics\TFAWebauthn\Model\LegacyU2FKeyInterface;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Webauthn\PublicKeyCredentialUserEntity;
|
||||
use function count;
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
@ -65,8 +67,6 @@ use Doctrine\Common\Collections\Collection;
|
|||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Exception;
|
||||
use function in_array;
|
||||
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface as U2FTwoFactorInterface;
|
||||
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorKeyInterface;
|
||||
use Scheb\TwoFactorBundle\Model\BackupCodeInterface;
|
||||
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface;
|
||||
use Scheb\TwoFactorBundle\Model\PreferredProviderInterface;
|
||||
|
@ -74,17 +74,20 @@ use Scheb\TwoFactorBundle\Model\TrustedDeviceInterface;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface;
|
||||
|
||||
/**
|
||||
* This entity represents a user, which can log in and have permissions.
|
||||
* Also this entity is able to save some informations about the user, like the names, email-address and other info.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
|
||||
* @ORM\Table("`users`")
|
||||
* @ORM\Table("`users`", indexes={
|
||||
* @ORM\Index(name="user_idx_username", columns={"name"})
|
||||
* })
|
||||
* @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"})
|
||||
* @UniqueEntity("name", message="validator.user.username_already_used")
|
||||
*/
|
||||
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, U2FTwoFactorInterface, PreferredProviderInterface, PasswordAuthenticatedUserInterface
|
||||
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, WebauthnTwoFactorInterface, PreferredProviderInterface, PasswordAuthenticatedUserInterface
|
||||
{
|
||||
//use MasterAttachmentTrait;
|
||||
|
||||
|
@ -146,7 +149,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* @var Group|null the group this user belongs to
|
||||
* @ORM\ManyToOne(targetEntity="Group", inversedBy="users", fetch="EAGER")
|
||||
* DO NOT PUT A fetch eager here! Otherwise you can not unset the group of a user! This seems to be some kind of bug in doctrine. Maybe this is fixed in future versions.
|
||||
* @ORM\ManyToOne(targetEntity="Group", inversedBy="users")
|
||||
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
*/
|
||||
|
@ -239,11 +243,17 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
protected ?DateTime $backupCodesGenerationDate = null;
|
||||
|
||||
/** @var Collection<int, TwoFactorKeyInterface>
|
||||
/** @var Collection<int, LegacyU2FKeyInterface>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\UserSystem\U2FKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $u2fKeys;
|
||||
|
||||
/**
|
||||
* @var Collection<int, WebauthnKey>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\UserSystem\WebauthnKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $webauthn_keys;
|
||||
|
||||
/**
|
||||
* @var Currency|null The currency the user wants to see prices in.
|
||||
* Dont use fetch=EAGER here, this will cause problems with setting the currency setting.
|
||||
|
@ -272,6 +282,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
parent::__construct();
|
||||
$this->permissions = new PermissionsEmbed();
|
||||
$this->u2fKeys = new ArrayCollection();
|
||||
$this->webauthn_keys = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -762,7 +773,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
public function isBackupCode(string $code): bool
|
||||
{
|
||||
return in_array($code, $this->backupCodes, true);
|
||||
return in_array($code, $this->getBackupCodes(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -772,7 +783,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
public function invalidateBackupCode(string $code): void
|
||||
{
|
||||
$key = array_search($code, $this->backupCodes, true);
|
||||
$key = array_search($code, $this->getBackupCodes(), true);
|
||||
if (false !== $key) {
|
||||
unset($this->backupCodes[$key]);
|
||||
}
|
||||
|
@ -836,48 +847,48 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
++$this->trustedDeviceCookieVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if U2F is enabled.
|
||||
*/
|
||||
public function isU2FAuthEnabled(): bool
|
||||
{
|
||||
return count($this->u2fKeys) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all U2F Keys that are associated with this user.
|
||||
*
|
||||
* @psalm-return Collection<int, TwoFactorKeyInterface>
|
||||
*/
|
||||
public function getU2FKeys(): Collection
|
||||
{
|
||||
return $this->u2fKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a U2F key to this user.
|
||||
*/
|
||||
public function addU2FKey(TwoFactorKeyInterface $key): void
|
||||
{
|
||||
$this->u2fKeys->add($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a U2F key from this user.
|
||||
*/
|
||||
public function removeU2FKey(TwoFactorKeyInterface $key): void
|
||||
{
|
||||
$this->u2fKeys->removeElement($key);
|
||||
}
|
||||
|
||||
public function getPreferredTwoFactorProvider(): ?string
|
||||
{
|
||||
//If U2F is available then prefer it
|
||||
if ($this->isU2FAuthEnabled()) {
|
||||
return 'u2f_two_factor';
|
||||
//if ($this->isU2FAuthEnabled()) {
|
||||
// return 'u2f_two_factor';
|
||||
//}
|
||||
|
||||
if ($this->isWebAuthnAuthenticatorEnabled()) {
|
||||
return 'webauthn_two_factor_provider';
|
||||
}
|
||||
|
||||
//Otherwise use other methods
|
||||
return null;
|
||||
}
|
||||
|
||||
public function isWebAuthnAuthenticatorEnabled(): bool
|
||||
{
|
||||
return count($this->u2fKeys) > 0
|
||||
|| count($this->webauthn_keys) > 0;
|
||||
}
|
||||
|
||||
public function getLegacyU2FKeys(): iterable
|
||||
{
|
||||
return $this->u2fKeys;
|
||||
}
|
||||
|
||||
public function getWebAuthnUser(): PublicKeyCredentialUserEntity
|
||||
{
|
||||
return new PublicKeyCredentialUserEntity(
|
||||
$this->getUsername(),
|
||||
(string) $this->getId(),
|
||||
$this->getFullName(),
|
||||
);
|
||||
}
|
||||
|
||||
public function getWebauthnKeys(): iterable
|
||||
{
|
||||
return $this->webauthn_keys;
|
||||
}
|
||||
|
||||
public function addWebauthnKey(WebauthnKey $webauthnKey): void
|
||||
{
|
||||
$this->webauthn_keys->add($webauthnKey);
|
||||
}
|
||||
}
|
||||
|
|
98
src/Entity/UserSystem/WebauthnKey.php
Normal file
98
src/Entity/UserSystem/WebauthnKey.php
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity\UserSystem;
|
||||
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Webauthn\PublicKeyCredentialSource as BasePublicKeyCredentialSource;
|
||||
|
||||
/**
|
||||
* @ORM\Table(name="webauthn_keys")
|
||||
* @ORM\Entity()
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class WebauthnKey extends BasePublicKeyCredentialSource
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected int $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
protected string $name;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="webauthn_keys")
|
||||
**/
|
||||
protected ?User $user = null;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return WebauthnKey
|
||||
*/
|
||||
public function setName(string $name): WebauthnKey
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User|null
|
||||
*/
|
||||
public function getUser(): ?User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User|null $user
|
||||
* @return WebauthnKey
|
||||
*/
|
||||
public function setUser(?User $user): WebauthnKey
|
||||
{
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function fromRegistration(BasePublicKeyCredentialSource $registration): self
|
||||
{
|
||||
return new self(
|
||||
$registration->getPublicKeyCredentialId(),
|
||||
$registration->getType(),
|
||||
$registration->getTransports(),
|
||||
$registration->getAttestationType(),
|
||||
$registration->getTrustPath(),
|
||||
$registration->getAaguid(),
|
||||
$registration->getCredentialPublicKey(),
|
||||
$registration->getUserHandle(),
|
||||
$registration->getCounter(),
|
||||
$registration->getOtherUI()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -75,6 +75,11 @@ class TreeCacheInvalidationListener
|
|||
if ($element instanceof AbstractStructuralDBElement || $element instanceof LabelProfile) {
|
||||
$secure_class_name = str_replace('\\', '_', get_class($element));
|
||||
$this->cache->invalidateTags([$secure_class_name]);
|
||||
|
||||
//Trigger a sidebar reload for all users (see SidebarTreeUpdater service)
|
||||
if(!$element instanceof LabelProfile) {
|
||||
$this->cache->invalidateTags(['sidebar_tree_update']);
|
||||
}
|
||||
}
|
||||
|
||||
//If a user change, then invalidate all cached trees for him
|
||||
|
|
|
@ -146,7 +146,7 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
|||
*/
|
||||
public static function TFARedirectNeeded(User $user): bool
|
||||
{
|
||||
$tfa_enabled = $user->isU2FAuthEnabled() || $user->isGoogleAuthenticatorEnabled();
|
||||
$tfa_enabled = $user->isWebAuthnAuthenticatorEnabled() || $user->isGoogleAuthenticatorEnabled();
|
||||
|
||||
return null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled;
|
||||
}
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\EventSubscriber\UserSystem;
|
||||
|
||||
use App\Entity\UserSystem\U2FKey;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Events\SecurityEvent;
|
||||
use App\Events\SecurityEvents;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use R\U2FTwoFactorBundle\Event\RegisterEvent;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
/**
|
||||
* This subscriber is used to write U2F keys to DB, after user added them via GUI.
|
||||
*/
|
||||
final class RegisterU2FSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private bool $demo_mode;
|
||||
private FlashBagInterface $flashBag;
|
||||
private UrlGeneratorInterface $router;
|
||||
|
||||
/**
|
||||
* @var EventDispatcher
|
||||
*/
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
public function __construct(UrlGeneratorInterface $router, EntityManagerInterface $entityManager, SessionInterface $session, EventDispatcherInterface $eventDispatcher, bool $demo_mode)
|
||||
{
|
||||
/** @var Session $session */
|
||||
$this->router = $router;
|
||||
$this->em = $entityManager;
|
||||
$this->demo_mode = $demo_mode;
|
||||
$this->flashBag = $session->getFlashBag();
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'r_u2f_two_factor.register' => 'onRegister',
|
||||
];
|
||||
}
|
||||
|
||||
public function onRegister(RegisterEvent $event): void
|
||||
{
|
||||
//Skip adding of U2F key on demo mode
|
||||
if (!$this->demo_mode) {
|
||||
$user = $event->getUser();
|
||||
if (!$user instanceof User) {
|
||||
throw new \InvalidArgumentException('Only User objects can be registered for U2F!');
|
||||
}
|
||||
|
||||
$registration = $event->getRegistration();
|
||||
$newKey = new U2FKey();
|
||||
$newKey->fromRegistrationData($registration);
|
||||
$newKey->setUser($user);
|
||||
$newKey->setName($event->getKeyName());
|
||||
|
||||
// persist the new key
|
||||
$this->em->persist($newKey);
|
||||
$this->em->flush();
|
||||
$this->flashBag->add('success', 'tfa_u2f.key_added_successful');
|
||||
|
||||
$security_event = new SecurityEvent($user);
|
||||
$this->eventDispatcher->dispatch($security_event, SecurityEvents::U2F_ADDED);
|
||||
}
|
||||
|
||||
// generate new response, here we redirect the user to the fos user
|
||||
// profile
|
||||
$response = new RedirectResponse($this->router->generate('user_settings'));
|
||||
$event->setResponse($response);
|
||||
}
|
||||
}
|
|
@ -106,6 +106,7 @@ class LabelOptionsType extends AbstractType
|
|||
'mode' => 'html-label',
|
||||
'attr' => [
|
||||
'rows' => 4,
|
||||
'data-ck-class' => 'ck-html-label'
|
||||
],
|
||||
]);
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ class StructuralEntityType extends AbstractType
|
|||
$html .= $this->getElementNameWithLevelWhitespace($choice, $options, '<span class="picker-level"></span>');
|
||||
|
||||
if ($options['show_fullpath_in_subtext'] && null !== $choice->getParent()) {
|
||||
$html .= '<span class="ms-3 badge rounded-pill bg-secondary float-end"><i class="fa-solid fa-folder-tree"></i> ' . trim(htmlspecialchars($choice->getParent()->getFullPath())) . '</span>';
|
||||
$html .= '<span class="ms-3 badge rounded-pill bg-secondary float-end picker-us"><i class="fa-solid fa-folder-tree"></i> ' . trim(htmlspecialchars($choice->getParent()->getFullPath())) . '</span>';
|
||||
}
|
||||
|
||||
if ($choice instanceof AttachmentType && !empty($choice->getFiletypeFilter())) {
|
||||
|
|
|
@ -45,6 +45,23 @@ abstract class AbstractPartsContainingRepository extends StructuralDBElementRepo
|
|||
*/
|
||||
abstract public function getPartsCount(object $element): int;
|
||||
|
||||
/**
|
||||
* Returns the count of the parts associated with this element and all its children.
|
||||
* Please be aware that this function is pretty slow on large trees!
|
||||
* @param AbstractPartsContainingDBElement $element
|
||||
* @return int
|
||||
*/
|
||||
public function getPartsCountRecursive(AbstractPartsContainingDBElement $element): int
|
||||
{
|
||||
$count = $this->getPartsCount($element);
|
||||
|
||||
foreach ($element->getChildren() as $child) {
|
||||
$count += $this->getPartsCountRecursive($child);
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
protected function getPartsByField(object $element, array $order_by, string $field_name): array
|
||||
{
|
||||
if (!$element instanceof AbstractPartsContainingDBElement) {
|
||||
|
|
|
@ -27,16 +27,50 @@ use App\Entity\LabelSystem\LabelOptions;
|
|||
use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator;
|
||||
use Com\Tecnick\Barcode\Barcode;
|
||||
use InvalidArgumentException;
|
||||
use PhpParser\Node\Stmt\Label;
|
||||
use Symfony\Component\Mime\MimeTypes;
|
||||
use Twig\Extra\Html\HtmlExtension;
|
||||
|
||||
final class BarcodeGenerator
|
||||
{
|
||||
private BarcodeContentGenerator $barcodeContentGenerator;
|
||||
|
||||
|
||||
public function __construct(BarcodeContentGenerator $barcodeContentGenerator)
|
||||
{
|
||||
$this->barcodeContentGenerator = $barcodeContentGenerator;
|
||||
}
|
||||
|
||||
public function generateHTMLBarcode(LabelOptions $options, object $target): ?string
|
||||
{
|
||||
$svg = $this->generateSVG($options, $target);
|
||||
$base64 = $this->dataUri($svg, 'image/svg+xml');
|
||||
return '<img src="'.$base64.'" width="100%" style="min-height: 25px;" alt="'. $this->getContent($options, $target) . '" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a data URI (RFC 2397).
|
||||
* Based on the Twig implementaion from HTMLExtension
|
||||
*
|
||||
* Length validation is not performed on purpose, validation should
|
||||
* be done before calling this filter.
|
||||
*
|
||||
* @return string The generated data URI
|
||||
*/
|
||||
private function dataUri(string $data, string $mime): string
|
||||
{
|
||||
$repr = 'data:';
|
||||
|
||||
$repr .= $mime;
|
||||
if (0 === strpos($mime, 'text/')) {
|
||||
$repr .= ','.rawurlencode($data);
|
||||
} else {
|
||||
$repr .= ';base64,'.base64_encode($data);
|
||||
}
|
||||
|
||||
return $repr;
|
||||
}
|
||||
|
||||
public function generateSVG(LabelOptions $options, object $target): ?string
|
||||
{
|
||||
$barcode = new Barcode();
|
||||
|
|
|
@ -71,7 +71,7 @@ final class LabelTextReplacer
|
|||
public function replace(string $lines, object $target): string
|
||||
{
|
||||
$patterns = [
|
||||
'/(\[\[[A-Z_]+\]\])/' => function ($match) use ($target) {
|
||||
'/(\[\[[A-Z_0-9]+\]\])/' => function ($match) use ($target) {
|
||||
return $this->handlePlaceholder($match[0], $target);
|
||||
},
|
||||
];
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services\LabelSystem\PlaceholderProviders;
|
||||
|
||||
use App\Entity\LabelSystem\LabelOptions;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Services\LabelSystem\BarcodeGenerator;
|
||||
use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator;
|
||||
|
||||
final class BarcodeProvider implements PlaceholderProviderInterface
|
||||
{
|
||||
private BarcodeGenerator $barcodeGenerator;
|
||||
private BarcodeContentGenerator $barcodeContentGenerator;
|
||||
|
||||
public function __construct(BarcodeGenerator $barcodeGenerator, BarcodeContentGenerator $barcodeContentGenerator)
|
||||
{
|
||||
$this->barcodeGenerator = $barcodeGenerator;
|
||||
$this->barcodeContentGenerator = $barcodeContentGenerator;
|
||||
}
|
||||
|
||||
public function replace(string $placeholder, object $label_target, array $options = []): ?string
|
||||
{
|
||||
if ('[[1D_CONTENT]]' === $placeholder) {
|
||||
try {
|
||||
return $this->barcodeContentGenerator->get1DBarcodeContent($label_target);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
return 'ERROR!';
|
||||
}
|
||||
}
|
||||
|
||||
if ('[[2D_CONTENT]]' === $placeholder) {
|
||||
try {
|
||||
return $this->barcodeContentGenerator->getURLContent($label_target);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
return 'ERROR!';
|
||||
}
|
||||
}
|
||||
|
||||
if ('[[BARCODE_QR]]' === $placeholder) {
|
||||
$label_options = new LabelOptions();
|
||||
$label_options->setBarcodeType('qr');
|
||||
return $this->barcodeGenerator->generateHTMLBarcode($label_options, $label_target);
|
||||
}
|
||||
|
||||
if ('[[BARCODE_C39]]' === $placeholder) {
|
||||
$label_options = new LabelOptions();
|
||||
$label_options->setBarcodeType('code39');
|
||||
return $this->barcodeGenerator->generateHTMLBarcode($label_options, $label_target);
|
||||
}
|
||||
|
||||
if ('[[BARCODE_C128]]' === $placeholder) {
|
||||
$label_options = new LabelOptions();
|
||||
$label_options->setBarcodeType('code128');
|
||||
return $this->barcodeGenerator->generateHTMLBarcode($label_options, $label_target);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -27,6 +27,8 @@ use App\Entity\UserSystem\User;
|
|||
use DateTime;
|
||||
use IntlDateFormatter;
|
||||
use Locale;
|
||||
use Symfony\Component\Routing\Generator\UrlGenerator;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
|
@ -36,11 +38,13 @@ final class GlobalProviders implements PlaceholderProviderInterface
|
|||
{
|
||||
private string $partdb_title;
|
||||
private Security $security;
|
||||
private UrlGeneratorInterface $url_generator;
|
||||
|
||||
public function __construct(string $partdb_title, Security $security)
|
||||
public function __construct(string $partdb_title, Security $security, UrlGeneratorInterface $url_generator)
|
||||
{
|
||||
$this->partdb_title = $partdb_title;
|
||||
$this->security = $security;
|
||||
$this->url_generator = $url_generator;
|
||||
}
|
||||
|
||||
public function replace(string $placeholder, object $label_target, array $options = []): ?string
|
||||
|
@ -101,6 +105,10 @@ final class GlobalProviders implements PlaceholderProviderInterface
|
|||
return $formatter->format($now);
|
||||
}
|
||||
|
||||
if ('[[INSTANCE_URL]]' === $placeholder) {
|
||||
return $this->url_generator->generate('homepage', [], UrlGenerator::ABSOLUTE_URL);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ use Doctrine\Common\Collections\Collection;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use DoctrineExtensions\Query\Mysql\Date;
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use ReflectionClass;
|
||||
|
@ -171,6 +172,22 @@ class TimeTravel
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function decodes the array which is created during the json_encode of a datetime object and returns a DateTime object.
|
||||
* @param array $input
|
||||
* @return DateTime
|
||||
* @throws Exception
|
||||
*/
|
||||
private function dateTimeDecode(?array $input): ?\DateTime
|
||||
{
|
||||
//Allow null values
|
||||
if ($input === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new \DateTime($input['date'], new \DateTimeZone($input['timezone']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the changeset in the given LogEntry to the element.
|
||||
*
|
||||
|
@ -195,6 +212,10 @@ class TimeTravel
|
|||
$data = BigDecimal::of($data);
|
||||
}
|
||||
|
||||
if (!$data instanceof DateTime && ('datetime' === $metadata->getFieldMapping($field)['type'])) {
|
||||
$data = $this->dateTimeDecode($data);
|
||||
}
|
||||
|
||||
$this->setField($element, $field, $data);
|
||||
}
|
||||
if ($metadata->hasAssociation($field)) {
|
||||
|
|
|
@ -76,6 +76,10 @@ class BackupCodeManager
|
|||
return;
|
||||
}
|
||||
|
||||
if ($user->isWebAuthnAuthenticatorEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user->setBackupCodes([]);
|
||||
}
|
||||
|
||||
|
|
37
src/Services/Trees/SidebarTreeUpdater.php
Normal file
37
src/Services/Trees/SidebarTreeUpdater.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services\Trees;
|
||||
|
||||
use Symfony\Contracts\Cache\CacheInterface;
|
||||
use Symfony\Contracts\Cache\ItemInterface;
|
||||
use Symfony\Contracts\Cache\TagAwareCacheInterface;
|
||||
|
||||
final class SidebarTreeUpdater
|
||||
{
|
||||
private const CACHE_KEY = 'sidebar_tree_updated';
|
||||
private const TTL = 60 * 60 * 24; // 24 hours
|
||||
|
||||
private CacheInterface $cache;
|
||||
|
||||
public function __construct(TagAwareCacheInterface $treeCache)
|
||||
{
|
||||
$this->cache = $treeCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time when the sidebar tree was updated the last time.
|
||||
* The frontend uses this information to reload the sidebar tree.
|
||||
* @return \DateTimeInterface
|
||||
*/
|
||||
public function getLastTreeUpdate(): \DateTimeInterface
|
||||
{
|
||||
return $this->cache->get(self::CACHE_KEY, function (ItemInterface $item) {
|
||||
$item->expiresAfter(self::TTL);
|
||||
|
||||
//This tag and therfore this whole cache gets cleared by TreeCacheInvalidationListener when a structural element is changed
|
||||
$item->tag('sidebar_tree_update');
|
||||
|
||||
return new \DateTime();
|
||||
});
|
||||
}
|
||||
}
|
|
@ -73,13 +73,9 @@ class UserCacheKeyGenerator
|
|||
$user = $this->security->getUser();
|
||||
}
|
||||
|
||||
if (!$user instanceof User){
|
||||
throw new \RuntimeException('UserCacheKeyGenerator::generateKey() was called without a user, but no user is logged in!');
|
||||
}
|
||||
|
||||
//If the user is null, then treat it as anonymous user.
|
||||
//When the anonymous user is passed as user then use this path too.
|
||||
if (null === $user || User::ID_ANONYMOUS === $user->getID()) {
|
||||
if (null === $user || !($user instanceof User) || User::ID_ANONYMOUS === $user->getID()) {
|
||||
return 'user$_'.User::ID_ANONYMOUS;
|
||||
}
|
||||
|
||||
|
|
51
symfony.lock
51
symfony.lock
|
@ -75,12 +75,12 @@
|
|||
"version": "v0.5.3"
|
||||
},
|
||||
"doctrine/doctrine-bundle": {
|
||||
"version": "2.5",
|
||||
"version": "2.7",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "master",
|
||||
"branch": "main",
|
||||
"version": "2.4",
|
||||
"ref": "ddddd8249dd55bbda16fa7a45bb7499ef6f8e90e"
|
||||
"ref": "da713d006953b90d1c085c1be480ecdd6c4a95e0"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/doctrine.yaml",
|
||||
|
@ -101,16 +101,16 @@
|
|||
]
|
||||
},
|
||||
"doctrine/doctrine-migrations-bundle": {
|
||||
"version": "3.1",
|
||||
"version": "3.2",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "master",
|
||||
"branch": "main",
|
||||
"version": "3.1",
|
||||
"ref": "ee609429c9ee23e22d6fa5728211768f51ed2818"
|
||||
"ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33"
|
||||
},
|
||||
"files": [
|
||||
"./config/packages/doctrine_migrations.yaml",
|
||||
"./migrations/.gitignore"
|
||||
"config/packages/doctrine_migrations.yaml",
|
||||
"migrations/.gitignore"
|
||||
]
|
||||
},
|
||||
"doctrine/event-manager": {
|
||||
|
@ -176,6 +176,9 @@
|
|||
"imagine/imagine": {
|
||||
"version": "1.2.2"
|
||||
},
|
||||
"jbtronics/2fa-webauthn": {
|
||||
"version": "dev-master"
|
||||
},
|
||||
"laminas/laminas-code": {
|
||||
"version": "3.4.1"
|
||||
},
|
||||
|
@ -252,9 +255,6 @@
|
|||
"openlss/lib-array2xml": {
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"paragonie/random_compat": {
|
||||
"version": "v9.99.99"
|
||||
},
|
||||
"phenx/php-font-lib": {
|
||||
"version": "0.5.1"
|
||||
},
|
||||
|
@ -348,9 +348,6 @@
|
|||
"psr/simple-cache": {
|
||||
"version": "1.0.1"
|
||||
},
|
||||
"r/u2f-two-factor-bundle": {
|
||||
"version": "dev-scheb/2fa-support"
|
||||
},
|
||||
"roave/security-advisories": {
|
||||
"version": "dev-master"
|
||||
},
|
||||
|
@ -397,6 +394,9 @@
|
|||
"shivas/versioning-bundle": {
|
||||
"version": "3.1.3"
|
||||
},
|
||||
"spomky-labs/cbor-bundle": {
|
||||
"version": "v2.0.3"
|
||||
},
|
||||
"symfony/apache-pack": {
|
||||
"version": "1.0",
|
||||
"recipe": {
|
||||
|
@ -652,15 +652,15 @@
|
|||
"version": "v5.3.4"
|
||||
},
|
||||
"symfony/security-bundle": {
|
||||
"version": "5.1",
|
||||
"version": "5.4",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "master",
|
||||
"version": "5.1",
|
||||
"ref": "0a4bae19389d3b9cba1ca0102e3b2bccea724603"
|
||||
"branch": "main",
|
||||
"version": "5.3",
|
||||
"ref": "98f1f2b0d635908c2b40f3675da2d23b1a069d30"
|
||||
},
|
||||
"files": [
|
||||
"./config/packages/security.yaml"
|
||||
"config/packages/security.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/security-core": {
|
||||
|
@ -757,12 +757,12 @@
|
|||
]
|
||||
},
|
||||
"symfony/webpack-encore-bundle": {
|
||||
"version": "1.15",
|
||||
"version": "1.16",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "1.10",
|
||||
"ref": "2e458cc7e6f1df1dad890eb104b81e4f302c9bd4"
|
||||
"ref": "5878c7c28468ca0fdce2497a04cfc66bab0dc3ef"
|
||||
},
|
||||
"files": [
|
||||
"assets/app.js",
|
||||
|
@ -817,6 +817,15 @@
|
|||
"vimeo/psalm": {
|
||||
"version": "3.5.1"
|
||||
},
|
||||
"web-auth/webauthn-symfony-bundle": {
|
||||
"version": "3.3",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes-contrib",
|
||||
"branch": "main",
|
||||
"version": "3.0",
|
||||
"ref": "9926090a80c2cceeffe96e6c3312b397ea55d4a7"
|
||||
}
|
||||
},
|
||||
"webmozart/assert": {
|
||||
"version": "1.4.0"
|
||||
},
|
||||
|
|
|
@ -22,5 +22,6 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block quick_links %}
|
||||
{% include 'QuickLinks/_company.html.twig' %}
|
||||
{% import "components/quick_links.macro.html.twig" as quick_links %}
|
||||
{{ quick_links.company(entity) }}
|
||||
{% endblock %}
|
|
@ -152,7 +152,8 @@
|
|||
|
||||
{% if datatable is defined and datatable is not null %}
|
||||
<div id="history" class="tab-pane fade">
|
||||
{% include "LogSystem/_log_table.html.twig" %}
|
||||
{% import "components/history_log_macros.html.twig" as log %}
|
||||
{{ log.element_history_component(datatable) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
{% endif %}
|
||||
</p>
|
||||
<p><b>{% trans %}user.edit.tfa.u2f_keys_count{% endtrans %}:</b>
|
||||
{% if entity.u2FAuthEnabled %}
|
||||
{{ entity.u2FKeys | length }}
|
||||
{% if entity.webAuthnAuthenticatorEnabled %}
|
||||
{{ (entity.webauthnKeys | length) + (entity.legacyU2FKeys | length) }}
|
||||
{% else %}
|
||||
{% trans %}user.edit.tfa.disabled{% endtrans %}
|
||||
{% endif %}
|
||||
|
@ -63,7 +63,7 @@
|
|||
|
||||
{% set tfa_disable_disabled = not is_granted('set_password', entity) %}
|
||||
{# Disable button when he has no 2FA activated #}
|
||||
{% if not entity.u2FAuthEnabled and not entity.googleAuthenticatorEnabled and entity.backupCodes is empty %}
|
||||
{% if not entity.webAuthnAuthenticatorEnabled and not entity.googleAuthenticatorEnabled and entity.backupCodes is empty %}
|
||||
{% set tfa_disable_disabled = true %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<form class="form-horizontal" data-turbo="false" method="post" action="{{ path }}">
|
||||
<form class="form-horizontal" method="post" action="{{ path }}" data-turbo="false" data-turbo-frame="_top">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="row">
|
||||
<label class="col-form-label col-md-3">{% trans %}export.format{% endtrans %}</label>
|
||||
<div class="col-sm">
|
||||
<select class="form-control" name="format">
|
||||
<div class="col-md-9">
|
||||
<select class="form-select" name="format">
|
||||
<option value="json">JSON</option>
|
||||
<option value="xml">XML</option>
|
||||
<option value="csv">CSV</option>
|
||||
|
@ -12,10 +12,10 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row mt-2">
|
||||
<div class="row mt-2">
|
||||
<label class="col-form-label col-md-3">{% trans %}export.level{% endtrans %}</label>
|
||||
<div class="col-sm">
|
||||
<select class="form-control" name="level">
|
||||
<div class="col-md-9">
|
||||
<select class="form-select" name="level">
|
||||
<option value="simple">{% trans %}export.level.simple{% endtrans %}</option>
|
||||
<option value="extended" selected>{% trans %}export.level.extended{% endtrans %}</option>
|
||||
<option value="full">{% trans %}export.level.full{% endtrans %}</option>
|
||||
|
@ -23,8 +23,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row mt-2">
|
||||
<div class="offset-sm-3 col-sm">
|
||||
<div class="row mt-2">
|
||||
<div class="offset-md-3 col-sm">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input form-check-input" name="include_children" id="include_children" type="checkbox" checked>
|
||||
<label class="form-check-label form-check-label" for="include_children">
|
||||
|
@ -34,7 +34,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row mt-2">
|
||||
<div class="row mt-2">
|
||||
<div class="offset-sm-3 col-sm">
|
||||
<button type="submit" class="btn btn-primary">{% trans %}export.btn{% endtrans %}</button>
|
||||
</div>
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
{% import "helper.twig" as helper %}
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label col-md-3">{% trans %}id.label{% endtrans %}</label>
|
||||
<div class="col-md-9">
|
||||
<label class="col-form-label col-md-4">{% trans %}id.label{% endtrans %}</label>
|
||||
<div class="col-md-8">
|
||||
<p class="form-control-plaintext">{% if entity.iD %}{{ entity.id }}{% else %}-{% endif %}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label col-md-3">{% trans %}createdAt{% endtrans %}</label>
|
||||
<div class="col-md-9">
|
||||
<label class="col-form-label col-md-4">{% trans %}createdAt{% endtrans %}</label>
|
||||
<div class="col-md-8">
|
||||
<p class="form-control-plaintext">
|
||||
|
||||
{% if entity.id is not null and date(entity.addedDate) > date('1900/01/01') %}
|
||||
|
@ -22,8 +22,8 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label col-md-3">{% trans %}lastModified{% endtrans %}</label>
|
||||
<div class="col-md-9">
|
||||
<label class="col-form-label col-md-4">{% trans %}lastModified{% endtrans %}</label>
|
||||
<div class="col-md-8">
|
||||
<p class="form-control-plaintext">
|
||||
{% if entity.id is not null and date(entity.lastModified) > date('1900/01/01') %}
|
||||
{{ helper.date_user_combination(entity, true, "long") }}
|
||||
|
@ -35,9 +35,9 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label col-md-3">{% trans %}entity.info.parts_count{% endtrans %}</label>
|
||||
<div class="col-md-9">
|
||||
<p class="form-control-static">
|
||||
<label class="col-form-label col-md-4">{% trans %}entity.info.parts_count{% endtrans %}</label>
|
||||
<div class="col-md-8">
|
||||
<p class="form-control-plaintext">
|
||||
{% if entity.id and partsContainingElement %}
|
||||
{{ repo.partsCount(entity) }}
|
||||
{% else %}
|
||||
|
@ -45,4 +45,20 @@
|
|||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Check if we really have a structural element #}
|
||||
{% if entity.parent is defined %}
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label col-md-4">{% trans %}entity.info.parts_count_recursive{% endtrans %}</label>
|
||||
<div class="col-md-8">
|
||||
<p class="form-control-plaintext">
|
||||
{% if entity.id and partsContainingElement %}
|
||||
{{ repo.partsCountRecursive(entity) }}
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
|
@ -13,7 +13,7 @@
|
|||
</head>
|
||||
<body>
|
||||
{% for element in elements %}
|
||||
<div style="page-break-inside: avoid; page-break-before: avoid; {% if not loop.last %}page-break-after: always;{% endif %}">
|
||||
<div class="page">
|
||||
{% if options.barcodeType == 'none' %}
|
||||
{% include "LabelSystem/labels/label_page_none.html.twig" %}
|
||||
{% elseif options.barcodeType in ['qr', 'datamatrix'] %}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{{ element.lines | raw }}
|
||||
</div>
|
||||
<div class="C39-container" style="">
|
||||
<img class="C39" src="{{ element.barcode | data_uri(mime='image/svg+xml') }}" height="30px">
|
||||
<img class="C39" src="{{ element.barcode | data_uri(mime='image/svg+xml') }}" height="30px"><br>
|
||||
<span class="C39-text">{{ element.barcode_content }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,9 +2,28 @@
|
|||
margin: 12px 6px;
|
||||
}
|
||||
|
||||
.page {
|
||||
page-break-inside: avoid;
|
||||
page-break-before: avoid;
|
||||
page-break-after: always;
|
||||
|
||||
overflow: hidden;
|
||||
/* Absolute position prevents automatic page breaks */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Last page should not break */
|
||||
.page:last-of-type {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "DejaVu Sans Mono";
|
||||
font-size: 9pt;
|
||||
font-size: 12px;
|
||||
line-height: 1.0;
|
||||
}
|
||||
|
||||
|
@ -38,7 +57,6 @@ hr {
|
|||
|
||||
.C39-text {
|
||||
display: block;
|
||||
margin-top: -6px;
|
||||
font-size: 6pt;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
{% import "components/datatables.macro.html.twig" as datatables %}
|
||||
|
||||
<form method="post" action="{{ path("log_undo") }}"
|
||||
{{ stimulus_controller('elements/delete_btn') }} {{ stimulus_action('elements/delete_btn', "submit", "submit") }}
|
||||
data-delete-title="{% trans %}log.undo.confirm_title{% endtrans %}"
|
||||
data-delete-message="{% trans %}log.undo.confirm_message{% endtrans %}">
|
||||
<input type="hidden" name="redirect_back" value="{{ app.request.uri }}">
|
||||
|
||||
{{ datatables.logDataTable(datatable) }}
|
||||
|
||||
</form>
|
|
@ -51,5 +51,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{% include "LogSystem/_log_table.html.twig" %}
|
||||
{% import "components/history_log_macros.html.twig" as log %}
|
||||
{{ log.system_log_component(datatable) }}
|
||||
{% endblock %}
|
|
@ -1,5 +1,3 @@
|
|||
{% import "helper.twig" as helper %}
|
||||
|
||||
<table class="table table-striped table-sm table-hover table-responsive-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -18,7 +16,8 @@
|
|||
{% for attachment in part.attachments %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ helper.attachment_icon(attachment, attachment_manager) }}
|
||||
{% import "components/attachments.macro.html.twig" as attachments %}
|
||||
{{ attachments.attachment_icon(attachment, attachment_manager) }}
|
||||
</td>
|
||||
<td class="align-middle">{{ attachment.name }}</td>
|
||||
<td class="align-middle">{{ attachment.attachmentType.fullPath }}</td>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<div class="mt-2">
|
||||
{% if datatable is not null %}
|
||||
{% include "LogSystem/_log_table.html.twig" %}
|
||||
{% import "components/history_log_macros.html.twig" as log %}
|
||||
{{ log.element_history_component(datatable) }}
|
||||
{% endif %}
|
||||
</div>
|
|
@ -9,7 +9,8 @@
|
|||
{% embed "Parts/lists/_info_card.html.twig" with {'header_label': 'manufacturer.label'} %}
|
||||
{% block quick_links %}
|
||||
<div class="mb-2">
|
||||
{% include 'QuickLinks/_company.html.twig' %}
|
||||
{% import "components/quick_links.macro.html.twig" as quick_links %}
|
||||
{{ quick_links.company(entity) }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
{% embed "Parts/lists/_info_card.html.twig" with {'header_label': 'supplier.label'} %}
|
||||
{% block quick_links %}
|
||||
<div class="mb-2">
|
||||
{% include 'QuickLinks/_company.html.twig' %}
|
||||
{% import "components/quick_links.macro.html.twig" as quick_links %}
|
||||
{{ quick_links.company(entity) }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<div class="btn-toolbar">
|
||||
<div class="btn-group">
|
||||
{% if entity.website is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="{{ entity.website }}" title="{% trans %}company.edit.quick.website{% endtrans %}" data-turbo="false"><i class="fas fa-globe fa-fw"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.emailAddress is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="mailto:{{ entity.emailAddress }}" title="{% trans %}company.edit.quick.email{% endtrans %}" data-turbo="false"><i class="fas fa-envelope-open-text"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.phoneNumber is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="tel:{{ entity.phoneNumber | replace({' ': ''}) }}" title="{% trans %}company.edit.quick.phone{% endtrans %}" data-turbo="false"><i class="fas fa-phone"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.faxNumber is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="tel:{{ entity.faxNumber | replace({' ': ''}) }}" title="{% trans %}company.edit.quick.fax{% endtrans %}" data-turbo="false"><i class="fas fa-fax"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
|
@ -110,7 +110,7 @@
|
|||
<div class="tab-pane fade" id="tfa-u2f" role="tabpanel" aria-labelledby="u2f-tab">
|
||||
<p>{% trans %}tfa_u2f.explanation{% endtrans %}</p>
|
||||
|
||||
{% if user.u2FKeys is not empty %}
|
||||
{% if user.legacyU2FKeys is not empty or user.webauthnKeys is not empty %}
|
||||
<b>{% trans %}tfa_u2f.table_caption{% endtrans %}:</b>
|
||||
<form action="{{ path('u2f_delete') }}" method="post"
|
||||
{{ stimulus_controller('elements/delete_btn') }} {{ stimulus_action('elements/delete_btn', "submit", "submit") }}
|
||||
|
@ -128,14 +128,22 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for key in user.u2FKeys %}
|
||||
{% for key in user.legacyU2FKeys %}
|
||||
<tr>
|
||||
<td>{{ loop.index }}</td>
|
||||
<td>{{ loop.index }} <b>(U2F)</b></td>
|
||||
<td>{{ key.name }}</td>
|
||||
<td>{{ key.addedDate | format_datetime }}</td>
|
||||
<td><button type="submit" class="btn btn-danger btn-sm" name="key_id" value="{{ key.id }}"><i class="fas fa-trash-alt fa-fw"></i> {% trans %}tfa_u2f.key_delete{% endtrans %}</button></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% for key in user.webauthnKeys %}
|
||||
<tr>
|
||||
<td>{{ loop.index }} <b>(WebAuthn)</b></td>
|
||||
<td>{{ key.name }}</td>
|
||||
<td>{{ key.addedDate | format_datetime }}</td>
|
||||
<td><button type="submit" class="btn btn-danger btn-sm" name="webauthn_key_id" value="{{ key.id }}"><i class="fas fa-trash-alt fa-fw"></i> {% trans %}tfa_u2f.key_delete{% endtrans %}</button></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
@ -143,7 +151,7 @@
|
|||
<p><b>{% trans %}tfa_u2f.no_keys_registered{% endtrans %}</b></p>
|
||||
{% endif %}
|
||||
|
||||
<a href="{{ path('club_base_register_u2f') }}" class="btn btn-success"><i class="fas fa-plus-square fa-fw"></i> {% trans %}tfa_u2f.add_new_key{% endtrans %}</a>
|
||||
<a href="{{ path('webauthn_register') }}" class="btn btn-success"><i class="fas fa-plus-square fa-fw"></i> {% trans %}tfa_u2f.add_new_key{% endtrans %}</a>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="tfa-trustedDevices" role="tabpanel" aria-labelledby="trustedDevices-tab-tab">
|
||||
|
|
|
@ -75,7 +75,8 @@
|
|||
|
||||
<div class="mt-2">
|
||||
{% if datatable is defined and datatable is not null %}
|
||||
{% include "LogSystem/_log_table.html.twig" %}
|
||||
{% import "components/history_log_macros.html.twig" as log %}
|
||||
{{ log.element_history_component(datatable) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -48,7 +48,7 @@
|
|||
class="fa fa-info-circle fa-fw"
|
||||
aria-hidden="true"></i> {% trans %}user.info.label{% endtrans %}</a>
|
||||
<li role="separator" class="dropdown-divider"></li>
|
||||
<a class="dropdown-item" href="{{ path('logout') }}" data-turbo="false"><i
|
||||
<a class="dropdown-item" href="{{ path('logout') }}" data-turbo="false" data-turbo-frame="_top"><i
|
||||
class="fa fa-sign-out-alt fa-fw"
|
||||
aria-hidden="true"></i> {% trans %}user.logout{% endtrans %}</a>
|
||||
{% else %}
|
||||
|
@ -68,12 +68,7 @@
|
|||
<li role="separator" class="dropdown-divider"></li>
|
||||
<h6 class="dropdown-header">{% trans %}user.language_select{% endtrans %}</h6>
|
||||
<div id="locale-select-menu">
|
||||
{% for locale in locale_menu %}
|
||||
<a class="dropdown-item" data-turbo="false"
|
||||
href="{{ path(app.request.attributes.get('_route'),
|
||||
app.request.attributes.get('_route_params')|merge({'_locale': locale})) }}">
|
||||
{{ locale|language_name }} ({{ locale|upper }})</a>
|
||||
{% endfor %}
|
||||
{# This menu is filled by 'turbo/locale_menu' controller from the _turbo_control.html.twig template, to always have the correct path #}
|
||||
</div>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<form action="{{ path('parts_search') }}" class="d-flex my-lg-0 ms-auto" method="get">
|
||||
<form id="navbar-search-form" action="{{ path('parts_search') }}" class="d-flex my-lg-0 ms-auto" method="get" data-turbo-permanent>
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-light dropdown-toggle my-2" type="button" id="navbar-search-options" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-bs-auto-close="false">
|
||||
{% trans %}search.options.label{% endtrans %}
|
||||
|
|
|
@ -15,11 +15,14 @@
|
|||
<div {{ stimulus_controller('turbo/global_reload') }}></div>
|
||||
{% endif %}
|
||||
|
||||
{# Insert info about when the sidebar trees were updated last time, so the sidebar_tree_controller can decide if it needs to reload the tree #}
|
||||
<span id="sidebar-last-time-updated" style="display: none;" data-last-update="{{ sidebar_tree_updater.lastTreeUpdate.format("Y-m-d\\TH:i:sP") }}"></span>
|
||||
|
||||
<div class="d-none" data-title="{% apply trim %}{{ current_page_title }}{% endapply %}" {{ stimulus_controller('turbo/title') }}></div>
|
||||
|
||||
<div class="d-none" {{ stimulus_controller('turbo/locale_menu') }}>
|
||||
{% for locale in locale_menu %}
|
||||
<a class="dropdown-item" data-turbo="false" href="{{ path(app.request.attributes.get('_route'),
|
||||
<a class="dropdown-item" data-turbo="false" data-turbo-frame="_top" href="{{ path(app.request.attributes.get('_route'),
|
||||
app.request.attributes.get('_route_params')|merge({'_locale': locale})) }}">
|
||||
{{ locale|language_name }} ({{ locale|upper }})</a>
|
||||
{% endfor %}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
{% block javascripts %}
|
||||
{{ encore_entry_script_tags('app') }}
|
||||
{{ encore_entry_script_tags('ru2ftwofactor') }}
|
||||
{{ encore_entry_script_tags('webauthn_tfa') }}
|
||||
|
||||
{# load translation files for ckeditor #}
|
||||
{% set two_chars_locale = app.request.locale|default("en")|slice(0,2) %}
|
||||
|
@ -64,7 +64,7 @@
|
|||
<body data-base-url="{{ path('homepage', {'_locale': app.request.locale}) }}" data-locale="{{ app.request.locale|default("en")|slice(0,2) }}">
|
||||
{% block body %}
|
||||
<header>
|
||||
<turbo-frame id="navbar-frame" target="content" data-turbo-action="advance" data-turbo-permanent>
|
||||
<turbo-frame id="navbar-frame" target="content" data-turbo-action="advance">
|
||||
{% include "_navbar.html.twig" %}
|
||||
</turbo-frame>
|
||||
</header>
|
||||
|
|
|
@ -7,20 +7,20 @@
|
|||
|
||||
{% block admin_info %}
|
||||
{% if exception.class == "Doctrine\\DBAL\\Exception\\ConnectionException" %}
|
||||
<i>Can not connect to database.</i> Try follwing things:
|
||||
<b><i>Can not connect to database.</i></b><br><p>Try following things:</p>
|
||||
<ul>
|
||||
<li>Check if the database server is running</li>
|
||||
<li>Ensure that <code>DATABASE_URL</code> in <code>.env.local</code> is correct: database name, user and password must be correct.</li>
|
||||
<li>Ensure that the database user has access to the database.</li>
|
||||
</ul>
|
||||
{% elseif exception.class == "Twig\\Error\\RuntimeError" and 'manifest.json' in exception.message %}
|
||||
<i>Can not load frontend assets.</i> Try following things:
|
||||
<b><i>Can not load frontend assets.</i></b><p>Try following things:</p>
|
||||
<ul>
|
||||
<li>Run <kbd>yarn install</kbd> and <kbd>yarn build</kbd> in Part-DB folder.</li>
|
||||
<li>Run <kbd>php bin/console cache:clear</kbd></li>
|
||||
</ul>
|
||||
{% elseif exception.class == "Doctrine\\DBAL\\Exception\\InvalidFieldNameException" or exception.class == "Doctrine\\DBAL\\Exception\\TableNotFoundException" %}
|
||||
<i>Invalid or not existing database schema.</i> Try following things:
|
||||
<b><i>Invalid or not existing database schema.</i></b><br><p>Try following things:</p>
|
||||
<ul>
|
||||
<li>Check if the <code>DATABASE_URL</code> in <code>.env.local</code> is correct</li>
|
||||
<li>Run <kbd>php bin/console doctrine:migrations:migrate</kbd> to upgrade database schema</li>
|
||||
|
|
|
@ -17,4 +17,23 @@
|
|||
{% trans %}attachment.create{% endtrans %}
|
||||
</button>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro attachment_icon(attachment, attachment_helper, class = "fa-fw fas fa-3x", link = true) %}
|
||||
{% set disabled = attachment.secure and not is_granted("show_secure", attachment) %}
|
||||
{% if not attachment_helper or attachment_helper.fileExisting(attachment) %}
|
||||
{% if link and not disabled %}
|
||||
<a target="_blank" data-turbo="false" rel="noopener" href="{{ entity_url(attachment, 'file_view') }}">
|
||||
{% endif %}
|
||||
{% if attachment.picture %}
|
||||
<img class="hoverpic" {{ stimulus_controller('elements/hoverpic') }} data-thumbnail="{{ entity_url(attachment, 'file_view') }}" src="{{ entity_url(attachment, 'file_view') }}">
|
||||
{% else %}
|
||||
<i class="text-dark {{ class }} {{ ext_to_fa_icon(attachment.extension) }}"></i>
|
||||
{% endif %}
|
||||
{% if link and not disabled %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% elseif not attachment_helper.fileExisting(attachment) %}
|
||||
<i class="{{ class }} fa-exclamation-triangle text-danger" title="{% trans %}attachment.file_not_found{% endtrans %}"></i>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
|
@ -13,8 +13,8 @@
|
|||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro logDataTable(dt) %}
|
||||
{{ _self.datatable(dt, 'elements/datatables/log') }}
|
||||
{% macro logDataTable(dt, state_save_tag = null) %}
|
||||
{{ _self.datatable(dt, 'elements/datatables/log', state_save_tag) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro partsDatatableWithForm(datatable, state_save_tag = 'parts') %}
|
||||
|
|
24
templates/components/history_log_macros.html.twig
Normal file
24
templates/components/history_log_macros.html.twig
Normal file
|
@ -0,0 +1,24 @@
|
|||
{% macro last_activity_component(datatable) %}
|
||||
{{ _self.log_component(datatable, 'last_activity') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro element_history_component(datatable) %}
|
||||
{{ _self.log_component(datatable, 'element_history') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro system_log_component(datatable) %}
|
||||
{{ _self.log_component(datatable, 'system_log') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro log_component(datatable, tag = null) %}
|
||||
{% import "components/datatables.macro.html.twig" as datatables %}
|
||||
|
||||
<form method="post" action="{{ path("log_undo") }}"
|
||||
{{ stimulus_controller('elements/delete_btn') }} {{ stimulus_action('elements/delete_btn', "submit", "submit") }}
|
||||
data-delete-title="{% trans %}log.undo.confirm_title{% endtrans %}"
|
||||
data-delete-message="{% trans %}log.undo.confirm_message{% endtrans %}">
|
||||
<input type="hidden" name="redirect_back" value="{{ app.request.uri }}">
|
||||
|
||||
{{ datatables.logDataTable(datatable, tag) }}
|
||||
</form>
|
||||
{% endmacro %}
|
19
templates/components/quick_links.macro.html.twig
Normal file
19
templates/components/quick_links.macro.html.twig
Normal file
|
@ -0,0 +1,19 @@
|
|||
{# Renders an btn toolbar to quickly call/email or visit the website of a company #}
|
||||
{% macro company(entity) %}
|
||||
<div class="btn-toolbar">
|
||||
<div class="btn-group">
|
||||
{% if entity.website is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="{{ entity.website }}" title="{% trans %}company.edit.quick.website{% endtrans %}" target="_blank" rel="nofollow"><i class="fas fa-globe fa-fw"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.emailAddress is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="mailto:{{ entity.emailAddress }}" title="{% trans %}company.edit.quick.email{% endtrans %}" target="_blank" rel="nofollow"><i class="fas fa-envelope-open-text"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.phoneNumber is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="tel:{{ entity.phoneNumber | replace({' ': ''}) }}" title="{% trans %}company.edit.quick.phone{% endtrans %}" target="_blank" rel="nofollow"><i class="fas fa-phone"></i></a>
|
||||
{% endif %}
|
||||
{% if entity.faxNumber is not empty %}
|
||||
<a class="btn btn-outline-secondary" href="tel:{{ entity.faxNumber | replace({' ': ''}) }}" title="{% trans %}company.edit.quick.fax{% endtrans %}" target="_blank" rel="nofollow"><i class="fas fa-fax"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
|
@ -6,25 +6,6 @@
|
|||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro attachment_icon(attachment, attachment_helper, class = "fa-fw fas fa-3x", link = true) %}
|
||||
{% set disabled = attachment.secure and not is_granted("show_secure", attachment) %}
|
||||
{% if not attachment_helper or attachment_helper.fileExisting(attachment) %}
|
||||
{% if link and not disabled %}
|
||||
<a target="_blank" data-turbo="false" rel="noopener" href="{{ entity_url(attachment, 'file_view') }}">
|
||||
{% endif %}
|
||||
{% if attachment.picture %}
|
||||
<img class="hoverpic" {{ stimulus_controller('elements/hoverpic') }} data-thumbnail="{{ entity_url(attachment, 'file_view') }}" src="{{ entity_url(attachment, 'file_view') }}">
|
||||
{% else %}
|
||||
<i class="text-dark {{ class }} {{ ext_to_fa_icon(attachment.extension) }}"></i>
|
||||
{% endif %}
|
||||
{% if link and not disabled %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% elseif not attachment_helper.fileExisting(attachment) %}
|
||||
<i class="{{ class }} fa-exclamation-triangle text-danger" title="{% trans %}attachment.file_not_found{% endtrans %}"></i>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro string_to_tags(string, class="badge bg-info") %}
|
||||
{% for tag in string|split(',') %}
|
||||
<a href="{{ path('part_list_tags', {'tag': tag | trim | url_encode}) }}" class="{{ class }}" >{{ tag | trim }}</a>
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
<div class="card mt-3">
|
||||
<div class="card-header"><i class="fas fa-fw fa-history"></i> {% trans %}homepage.last_activity{% endtrans %}</div>
|
||||
<div class="card-body">
|
||||
{% include "LogSystem/_log_table.html.twig" %}
|
||||
{% import "components/history_log_macros.html.twig" as log %}
|
||||
{{ log.last_activity_component(datatable) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
{% if list != null %}
|
||||
<ul class="structural_link">
|
||||
{% for element in list %}
|
||||
<li {% if element.selected != null %}class="active"{% endif %}>
|
||||
{% if element.href %}
|
||||
<a href="{{ element.href }}">{if $element.label}{$element.label}{/if}</a>
|
||||
{% else %}
|
||||
{$element.label}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<div class="form-control-static">-</div>
|
||||
{% endif %}
|
|
@ -1,14 +1,12 @@
|
|||
{% extends "security/2fa_base_form.html.twig" %}
|
||||
|
||||
{% block form_attributes %}id="u2fForm" data-action="auth" data-request='{{ authenticationData|raw }}'{% endblock %}
|
||||
{% block form_attributes %} data-webauthn-tfa-action="authenticate" data-webauthn-tfa-data='{{ webauthn_request_data|raw }}'{% endblock %}
|
||||
|
||||
{% block form %}
|
||||
{% if not app.request.secure %}
|
||||
<p class="text-warning"><b><i class="fas fa-exclamation-triangle fa-fw"></i> {% trans %}tfa_u2f.http_warning{% endtrans %}</b></p>
|
||||
{% endif %}
|
||||
|
||||
<div id="u2fpressbutton" style="display: none;" class="h4 text-center">{{ 'r_u2f_two_factor.pressbutton'|trans }}</div>
|
||||
<div id="u2fError"></div>
|
||||
<p class="widget"><input id="_auth_code" type="hidden" autocomplete="off" name="_auth_code" /></p>
|
||||
<a class="ms-2" href="{{ logoutPath }}">{% trans %}user.logout{% endtrans %}</a>
|
||||
{% endblock %}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue