Compare commits

...

607 Commits

Author SHA1 Message Date
Jan Böhmer
d0a5b4dcd7 Bumped version to 1.8.2 2023-10-25 17:30:06 +02:00
Jan Böhmer
294f7cf005 Fixed some deprecations related to missing return types 2023-10-25 17:27:37 +02:00
Jan Böhmer
eb24aa2e68 Updated dependencies 2023-10-25 17:14:02 +02:00
Jan Böhmer
a1c680d14d Increase xdebug.max_nesting_level to 1000 if required in bin/console script
Fix issue #411
2023-10-25 17:05:24 +02:00
Jan Böhmer
7239aef47f Ensure that the user property is really null in getLastUser function, if the target user was deleted
This fixes issue #414
2023-10-24 23:55:14 +02:00
Jan Böhmer
91cab91c81 Fixed missing ) in log detail page 2023-10-24 23:27:24 +02:00
Jan Böhmer
ce318bab9a Update codecov.yml 2023-10-24 18:27:30 +02:00
Jan Böhmer
b500fa82bb Allow to dynamically create currencies in pricedetails
This fixes issue #413
2023-10-24 14:08:50 +02:00
Jan Böhmer
388d26fa05 Forbid a user to delete himself on the admin page 2023-10-24 13:32:44 +02:00
Jan Böhmer
9fd3012c27 Fixed exception if user avatar file somehow got deleted.
Now we just show the default avatar instead of the non-existing attachment file
2023-10-24 13:25:33 +02:00
Jan Böhmer
3f36972764 Throw no warning, when unsetting a not existing permission value 2023-10-23 22:15:04 +02:00
Pyromane
9cd5d14708 Update upgrade_legacy.md (#417)
PHP minimum requirement adjusted
2023-10-21 18:47:36 +02:00
Jan Böhmer
cc82547699 Bumped to 1.8.1 2023-10-15 16:48:00 +02:00
Jan Böhmer
a9be442dd1 Fixed PartVoter when a class string is passed 2023-10-15 16:47:39 +02:00
Jan Böhmer
ffbcf25246 Bumped to version 1.8.0 2023-10-15 15:50:19 +02:00
Jan Böhmer
e9665d7a7a Merge remote-tracking branch 'origin/l10n_master' 2023-10-15 15:50:01 +02:00
Jan Böhmer
0a06467f79 Fixed visual issues in README.md and wrong coverage badge 2023-10-15 15:49:09 +02:00
Jan Böhmer
31510f6762 New translations validators.en.xlf (Russian) 2023-10-15 15:40:33 +02:00
Jan Böhmer
b298ee0003 New translations messages.en.xlf (Russian) 2023-10-15 15:40:32 +02:00
Jan Böhmer
97b539e1c6 New translations validators.en.xlf (Japanese) 2023-10-15 15:40:30 +02:00
Jan Böhmer
6546fba218 New translations messages.en.xlf (Japanese) 2023-10-15 15:40:29 +02:00
Jan Böhmer
b97132dbb5 New translations validators.en.xlf (German) 2023-10-15 15:40:22 +02:00
Jan Böhmer
aeeb4b87ec New translations messages.en.xlf (German) 2023-10-15 15:40:21 +02:00
Jan Böhmer
9a4877cdb0 New translations validators.en.xlf (French) 2023-10-15 15:40:19 +02:00
Jan Böhmer
919beda7f5 Hopefully fixed coverage upload to codecov 2023-10-15 14:33:24 +02:00
Jan Böhmer
306ecff9c7 Fixed issues with xdebug.max_nesting_level in github actions 2023-10-15 14:24:48 +02:00
Tac Tacelosky
0c689d492b remove repeated lines (#405) 2023-10-15 14:07:26 +02:00
Jan Böhmer
c3de0ccacc Merge remote-tracking branch 'origin/l10n_master' 2023-10-15 14:03:02 +02:00
Jan Böhmer
0d5bc2b29f Removed additional } in 2FA messages 2023-10-15 14:01:18 +02:00
Jan Böhmer
d675f072d6 Updated dependencies 2023-10-15 14:01:01 +02:00
Jan Böhmer
6f30db4877 New translations messages.en.xlf (English) 2023-10-15 13:40:19 +02:00
Jan Böhmer
cdcfcc7717 Merge remote-tracking branch 'origin/l10n_master' 2023-10-15 13:29:10 +02:00
Jan Böhmer
71765558fc Mention API feature in README and docs index.md 2023-10-15 13:28:40 +02:00
Jan Böhmer
5d3b1a7bcd Fiixed typos in README.md 2023-10-15 13:27:20 +02:00
Jan Böhmer
a2a477e4e5 Fixed some issues in docs 2023-10-15 13:24:56 +02:00
Jan Böhmer
f32c0f52b6 Fixed formatting and typos in documentation 2023-10-15 13:21:14 +02:00
Jan Böhmer
47fc7db953 Correctly link to JSON Merge Patch in API docu instead of JSON Patch 2023-10-15 12:38:32 +02:00
Jan Böhmer
cc267c0edf New translations messages.en.xlf (English) 2023-10-15 02:30:19 +02:00
Jan Böhmer
f5a3ab1f9b New translations messages.en.xlf (German) 2023-10-15 02:30:18 +02:00
Jan Böhmer
f6c97b58aa New translations messages.en.xlf (English) 2023-10-15 01:30:44 +02:00
Jan Böhmer
7a2928e202 Show a proper error message to user when he is not allowed to create a new element using a StructuralEntityType
This fixes issue #391
2023-10-15 01:29:19 +02:00
Jan Böhmer
f53c98312e Escape space in attachment URLs with %20
Fixes issue #401
2023-10-15 00:50:43 +02:00
Jan Böhmer
180505cba4 Improved API documentation on what will happen, if no Accept: header is set
Related with issue #399
2023-10-14 21:01:54 +02:00
Jan Böhmer
6d6a69e1dd Removed unnecessary curly brackets in string interpolation, which are deprecated in PHP 8.2 2023-10-14 20:31:04 +02:00
dependabot[bot]
5f61e096f9 Bump docker/login-action from 2 to 3 (#382)
Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-08 22:08:03 +02:00
Jan Böhmer
1becde537b Fixed test issues 2023-10-08 21:54:51 +02:00
Jan Böhmer
3c5a96ba5c Merge branch 'part-table-columns-config' 2023-10-08 21:50:43 +02:00
Jan Böhmer
470df57f58 Removed useless permissions checks, as the permissions are now always granted automatically, if the user has read access to parts 2023-10-08 21:36:05 +02:00
Jan Böhmer
185c88fa3e Removed now useless visibility options from PartsDataTable
The visibility is now configured by the env variable, so this is useless.
2023-10-08 21:32:57 +02:00
Jan Böhmer
79262972aa Renamed config env to TABLE_PARTS_DEFAULT_COLUMNS and updated documentation 2023-10-08 21:28:37 +02:00
Jan Böhmer
1369091b90 Moved column sorting and visibility logic to its own (non-shared) helper service 2023-10-08 21:07:22 +02:00
Jan Böhmer
b0322b4c03 Added a "new part" button to the navbar
This fixes issue #394
2023-10-08 01:25:29 +02:00
Jan Böhmer
c402ec40a5 Fixed initial rendering of default currency item in freshly initialized currency selectors 2023-10-08 01:04:04 +02:00
Jan Böhmer
1964084155 Merge branch 'mouser_pdo59'
This resolve issue #329
2023-10-08 00:41:47 +02:00
Jan Böhmer
4b5f9648b1 Allow to passthrought the mouser provider env using docker 2023-10-08 00:40:03 +02:00
Jan Böhmer
9d9287cefb Added documentation for MouserAPI 2023-10-08 00:39:08 +02:00
Jan Böhmer
18ae32f15a Renamed some env to match their purpose better 2023-10-08 00:33:48 +02:00
Jan Böhmer
7cd2662c77 Moved API key to query options of HTTPClient in MouserProvider 2023-10-08 00:18:25 +02:00
Jan Böhmer
4f0730b6f9 Properly formatted MouserProvider and fixed some type issues 2023-10-08 00:15:57 +02:00
Jan Böhmer
d7bc74fb2b Slightly restructured mouserprovider to remove redundant code 2023-10-08 00:00:10 +02:00
Jan Böhmer
a0b31cfd7e Made mouser provider key lowercase to be consistent with other providers 2023-10-07 23:49:04 +02:00
Jan Böhmer
33033bc5b1 Added the MouserProvider by @pdo59 2023-10-07 23:46:31 +02:00
Jan Böhmer
d6daac0762 New translations security.en.xlf (English) 2023-10-06 14:50:47 +02:00
Jan Böhmer
6a5a632a0e New translations validators.en.xlf (English) 2023-10-06 14:50:46 +02:00
Jan Böhmer
c64633299a New translations messages.en.xlf (English) 2023-10-06 14:50:45 +02:00
Jan Böhmer
f4e173d3fb New translations validators.en.xlf (Russian) 2023-10-06 14:50:41 +02:00
Jan Böhmer
5ff8d1c1cb New translations messages.en.xlf (Russian) 2023-10-06 14:50:39 +02:00
Jan Böhmer
aad40aefbc New translations validators.en.xlf (Japanese) 2023-10-06 14:50:37 +02:00
Jan Böhmer
ff77dac5fb New translations messages.en.xlf (Japanese) 2023-10-06 14:50:36 +02:00
Jan Böhmer
ced53c2690 New translations validators.en.xlf (German) 2023-10-06 14:50:30 +02:00
Jan Böhmer
6f66d50ff6 New translations messages.en.xlf (German) 2023-10-06 14:50:29 +02:00
Jan Böhmer
06f88341ba New translations validators.en.xlf (French) 2023-10-06 14:50:26 +02:00
Jan Böhmer
2a9a86aaaf New translations messages.en.xlf (French) 2023-10-06 14:50:25 +02:00
Jan Böhmer
2409c7f62b Exclude TwoStepORMAdapter from phpstan to fix github actions issue 2023-10-06 14:42:32 +02:00
Jan Böhmer
1b276c5eae Fixed typo in name of TwoStepORMAdapter 2023-10-06 13:08:46 +02:00
Jan Böhmer
608bd247af Updated symfony/phpunit-bridge recipe 2023-10-06 13:06:40 +02:00
Jan Böhmer
e9cdd20dcc Updated phpstan/phpstan recipe 2023-10-06 13:05:06 +02:00
Jan Böhmer
37dccd4249 Updated doctrine/doctrine-bundle recipe 2023-10-06 13:02:14 +02:00
Jan Böhmer
485d162d82 Updated dama/doctrine-test-bundle recipe 2023-10-06 13:01:17 +02:00
Jan Böhmer
aaf230fc58 Updated api platform recipe 2023-10-06 13:00:13 +02:00
Jan Böhmer
f9cafae789 Upgraded marked.js dependency 2023-10-06 12:47:00 +02:00
Jan Böhmer
c758027d4c Upgraded to CKEditor5 v40 2023-10-06 12:41:43 +02:00
Jan Böhmer
c178d45f73 Upgraded dependencies after merge 2023-10-06 12:35:17 +02:00
Jan Böhmer
8c9abce633 Merge branch 'api' 2023-10-06 12:29:53 +02:00
misaz
0753b7137f fixed tab/spaces in PartsDataTable 2023-10-04 21:30:04 +02:00
misaz
9d54001f89 added support for configuring columns in part table which are enabled by default as well as their order. 2023-10-04 21:14:57 +02:00
Jan Böhmer
00bb005e4e Bumped to version 1.7.3 2023-10-04 01:26:07 +02:00
Jan Böhmer
60b8650a1a Updated dependencies
The webauthn 2fa integration got an update, this should fix issue #389
2023-10-04 01:25:22 +02:00
Jan Böhmer
ec4eccdf08 Removed unnecessary commented code 2023-10-04 00:50:28 +02:00
Jan Böhmer
64c38042a0 Added missing lastModified and creationDate fields to API response 2023-10-04 00:08:10 +02:00
Jan Böhmer
e09f60e71f Allow to filter attachments API response by attachment types 2023-10-03 23:58:41 +02:00
Jan Böhmer
0e75d76720 Added API endpoints for projects 2023-10-03 23:53:10 +02:00
Jan Böhmer
852624ae7e Added filter to filter parts by storage location 2023-10-03 21:59:33 +02:00
Jan Böhmer
00708608cd Added entity filter to filter part response by categories, etc. 2023-10-03 21:37:58 +02:00
Jan Böhmer
e339b7d9f0 Fixed issue with FixInheritanceMappingMetadataFactory 2023-10-03 20:47:37 +02:00
Jan Böhmer
2f958dafae Fixed PHPstan issues 2023-10-03 16:41:03 +02:00
Jan Böhmer
3df47ed748 Added filters to various endpoints to allow searching for parts 2023-10-03 16:29:04 +02:00
Jan Böhmer
c7a02ae870 Added tests for token API authentication 2023-10-02 23:36:14 +02:00
Jan Böhmer
42356cc2a3 Show the last 5 characters of the token secrets on the user settings page to make identification of a token easier 2023-10-02 00:45:21 +02:00
Jan Böhmer
b796ae36db Restrict access to users API endpoint 2023-10-02 00:35:11 +02:00
Jan Böhmer
7bd44484be Added documentation for virtual fields of Attachment and Part entity 2023-10-02 00:22:15 +02:00
Jan Böhmer
607bb45f5f Added an possibilty to document "virtual" properties to api documentation, which are added dynamically during the normalization priocess 2023-10-02 00:21:59 +02:00
Jan Böhmer
90518056cd Fixed JSONLD schema generation of API documentation 2023-10-01 22:45:39 +02:00
Jan Böhmer
1e52ec42ca Added tests for availability of the API documentation 2023-10-01 21:56:05 +02:00
Jan Böhmer
1e04ee14de Added phpstan as local dev dependency 2023-10-01 21:46:33 +02:00
Jan Böhmer
469f9e8933 Do not redirect missing API prefixed routes to a localized version 2023-10-01 16:07:42 +02:00
Jan Böhmer
c49aff5cfc Removed GraphQL endpoint 2023-10-01 15:57:18 +02:00
Jan Böhmer
39009a71d5 Bumped version to 1.7.2 2023-09-24 19:54:35 +02:00
Jan Böhmer
0430178fe2 Fixed issue when the data is null. 2023-09-24 15:42:44 +02:00
Jan Böhmer
cf9df883c9 Updated dependencies 2023-09-24 15:36:07 +02:00
Jan Böhmer
198befe2bc Allow to dynamically create elements with purely numeric names in a selector type
Before this was not possible, as this was messed up with the DB ids. Now we prefix the new created values with a special prefix, to mark them as new.

This fixes issue #381
2023-09-24 15:28:35 +02:00
Jan Böhmer
7195bd6cd6 Increased user avatar max file size from 2M to 5M 2023-09-24 14:46:51 +02:00
Jan Böhmer
a5fa2da80c Show the languages from the language selector as preffered in language select on user settings page 2023-09-24 14:45:12 +02:00
Jan Böhmer
593d37f37c Added italien to language selector navbar menu 2023-09-24 14:42:21 +02:00
Jan Böhmer
2ddd6753ca Merge remote-tracking branch 'origin/l10n_master' 2023-09-24 14:40:31 +02:00
Jan Böhmer
9537c4f210 New translations messages.en.xlf (Italian) 2023-09-24 12:50:18 +02:00
Jan Böhmer
e0ce6ba165 New translations messages.en.xlf (Italian) 2023-09-24 11:50:16 +02:00
Jan Böhmer
ee50ce26f8 Merge remote-tracking branch 'origin/master' 2023-09-23 23:08:55 +02:00
Jan Böhmer
94a6de4a90 Fixed wrong literal in italian translation, which caused an exception. 2023-09-23 23:08:46 +02:00
Jan Böhmer
d5902314c3 New Crowdin updates (#378)
* New translations messages.en.xlf (French)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations validators.en.xlf (Italian)

* New translations security.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)
2023-09-23 23:06:06 +02:00
Jan Böhmer
ccb94c8a13 Fixed problem that all properties in snake_case style were considered readOnly by API Platform 2023-09-19 23:52:11 +02:00
Jan Böhmer
f285061a76 Allow to view and edit parameters of elements 2023-09-19 11:44:22 +02:00
Jan Böhmer
78a6262665 Fixed PHPstan issues 2023-09-19 00:00:25 +02:00
Jan Böhmer
8a13799829 (Hopefully) fix static analysis github action 2023-09-18 23:57:28 +02:00
Jan Böhmer
34059ad99d Added API endpoints for attachment types 2023-09-18 23:46:42 +02:00
Jan Böhmer
87e881f8e0 Show attachments and preview image in API response 2023-09-18 23:38:06 +02:00
Jan Böhmer
1823bc6528 Added url to media file and thumbnail to attachments 2023-09-18 22:16:09 +02:00
Jan Böhmer
077beb37b1 Added endpoints for attachments 2023-09-18 21:57:17 +02:00
Jan Böhmer
8182e83846 Added some helper functions to make it easier to parse Pricedetails 2023-09-18 21:37:21 +02:00
Jan Böhmer
59f62d4a4c Show lots, order and pricedetails in part response 2023-09-18 21:31:55 +02:00
Jan Böhmer
60125534ec New Crowdin updates (#370)
* New translations validators.en.xlf (French)

* New translations messages.en.xlf (German)

* New translations validators.en.xlf (German)

* New translations messages.en.xlf (Italian)

* New translations validators.en.xlf (Italian)

* New translations security.en.xlf (Italian)

* New translations messages.en.xlf (Japanese)

* New translations validators.en.xlf (Japanese)

* New translations messages.en.xlf (Russian)

* New translations validators.en.xlf (Russian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (English)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)

* New translations messages.en.xlf (Italian)
2023-09-18 19:41:01 +02:00
dependabot[bot]
48385cadc9 Bump docker/build-push-action from 4 to 5 (#375)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 19:40:49 +02:00
dependabot[bot]
ba6abe6ca7 Bump docker/setup-buildx-action from 2 to 3 (#374)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 19:40:43 +02:00
dependabot[bot]
79ad243bf4 Bump actions/checkout from 3 to 4 (#361)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 19:40:33 +02:00
dependabot[bot]
5ab21e019d Bump docker/metadata-action from 4 to 5 (#376)
Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4 to 5.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Upgrade guide](https://github.com/docker/metadata-action/blob/master/UPGRADE.md)
- [Commits](https://github.com/docker/metadata-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 19:40:23 +02:00
dependabot[bot]
d8469efba2 Bump docker/setup-qemu-action from 2 to 3 (#377)
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 19:40:13 +02:00
Jan Böhmer
43c15de55c Added SQLite migrations for API tokens 2023-09-18 16:36:08 +02:00
Jan Böhmer
d2144a1fed Added possibility to add a change comment to changes via the API 2023-09-18 13:24:33 +02:00
Jan Böhmer
915444b5da Added documentation about pagination and property filter to API docs. 2023-09-18 13:02:45 +02:00
Jan Böhmer
6387c24c89 Added some documentation to the API 2023-09-18 12:48:16 +02:00
Jan Böhmer
f01ec9dbe4 Improved documentation of entity fields 2023-09-17 12:50:32 +02:00
Jan Böhmer
219fbe5fca Added API endpoints for orderdetails and pricedetails 2023-09-17 11:24:33 +02:00
Jan Böhmer
64db3ed965 Update dependencies 2023-09-17 11:24:12 +02:00
Jan Böhmer
deec059a38 Merge branch 'master' into api 2023-09-17 10:32:25 +02:00
Jan Böhmer
316b09ddf3 Bumped version to 1.7.1 2023-09-09 23:20:09 +02:00
Jan Böhmer
866ef73774 Upgraded dependencies 2023-09-09 23:19:44 +02:00
Jan Böhmer
138d5c6e0f Merge remote-tracking branch 'origin/l10n_master' 2023-09-09 23:05:29 +02:00
Jan Böhmer
4bed50d894 Allow database migration from legacy versions even if the perms_label column is missing in the groups table
This fixes issue #366 and #67
2023-09-09 23:04:50 +02:00
Jan Böhmer
4e57750214 Added endpoint for storage locations 2023-09-04 23:05:30 +02:00
Jan Böhmer
3738cb6025 Fixed error in paramater discriminator map 2023-09-04 23:01:54 +02:00
Jan Böhmer
0af5a58dbe Renamed Storelocation entity to StorageLocation 2023-09-04 22:57:40 +02:00
Jan Böhmer
09acca950d Added simple endpoint for basic part infos and partlots 2023-09-03 23:58:09 +02:00
Jan Böhmer
e04b635c98 Added API endpoints for more data structures 2023-09-03 17:15:18 +02:00
Jan Böhmer
9bd1b86f6e Updated dependencies 2023-09-03 13:47:11 +02:00
Jan Böhmer
17b49e7ae5 Added security to manufacturer and suppliers API endpoint 2023-08-28 23:46:55 +02:00
Jan Böhmer
7b6ba37667 Allow to cache support status of voters
This should increase the performance a bit
2023-08-28 23:06:37 +02:00
Jan Böhmer
879b702fc1 Fixed PHPunit tests 2023-08-28 22:47:15 +02:00
Jan Böhmer
f265b9d19d Fixed PHPstan issues 2023-08-28 22:39:29 +02:00
Jan Böhmer
6be55d1837 Use the new VoterHelper in voters 2023-08-28 22:00:25 +02:00
Jan Böhmer
fc6643bd6f Added system to restrict permissions based on API token level 2023-08-28 21:20:59 +02:00
Jan Böhmer
55943f5d8f Fixed wrong env documentation for TME and digikey provider
This fixes issue #359
2023-08-28 12:08:47 +02:00
Jan Böhmer
56d120cd08 Fixed styling of no API tokens yet message 2023-08-26 23:21:28 +02:00
Jan Böhmer
3e693642b6 Allow to delete API tokens 2023-08-26 23:19:35 +02:00
Jan Böhmer
8fe3f4cf5c Added permissions to control access to API and manage API tokens 2023-08-26 22:57:50 +02:00
Jan Böhmer
be14fe548c Updated composer dependencies. 2023-08-26 22:16:49 +02:00
Jan Böhmer
85f3ba6aaa Merge branch 'master' into api 2023-08-26 22:15:12 +02:00
Jan Böhmer
133652c296 Fixed PHPstan issues 2023-08-23 22:05:16 +02:00
Jan Böhmer
b9331ac1ef Prevent indexing through search engines, if we are not in demo mode 2023-08-23 22:01:39 +02:00
Jan Böhmer
08f7b2cc87 New translations security.en.xlf (English) 2023-08-23 21:51:37 +02:00
Jan Böhmer
1a2bdaf8e5 New translations validators.en.xlf (English) 2023-08-23 21:51:36 +02:00
Jan Böhmer
d81dec78ae New translations messages.en.xlf (English) 2023-08-23 21:51:35 +02:00
Jan Böhmer
f78bd03521 New translations messages.en.xlf (German) 2023-08-23 21:51:29 +02:00
Jan Böhmer
6aa16272d8 Merge remote-tracking branch 'origin/l10n_master' 2023-08-23 21:24:45 +02:00
Jan Böhmer
e80f7c08ab Bumped version to 1.7.0 2023-08-23 21:24:09 +02:00
Jan Böhmer
675f05f0fb Updated dependencies 2023-08-23 21:23:34 +02:00
Jan Böhmer
b1f23e1684 Added some documentation about the update notification 2023-08-23 21:06:10 +02:00
Jan Böhmer
d612164885 Added that clearing the octopart oauth token is required after changing octopart clientID
See discussion in issue #329. Maybe we will implement a better (more automatic) way to solve this.
2023-08-23 21:00:04 +02:00
Jan Böhmer
b257e1d5f7 New translations messages.en.xlf (German) 2023-08-23 20:51:29 +02:00
Théophile Bornon
f26776ecd5 Fix wrong environment variable name (#355)
For Octopart, the secret must be set inside the PROVIDER_OCTOPART_SECRET instead of PROVIDER_OCTOPART_CLIENT_SECRET
2023-08-23 20:46:26 +02:00
Jan Böhmer
bf4a23652c New translations messages.en.xlf (Chinese Simplified) 2023-08-22 08:00:22 +02:00
Jan Böhmer
e7681aedb1 New translations messages.en.xlf (English) 2023-08-21 23:20:48 +02:00
Jan Böhmer
098fcb29fb Upgraded dependencies 2023-08-21 23:17:42 +02:00
Jan Böhmer
eb46ea19e3 Make update checking mechanism more resilient against connection errors 2023-08-21 23:11:12 +02:00
Jan Böhmer
99ee05a90f Allow to configure update checking utility via env 2023-08-21 22:57:45 +02:00
Jan Böhmer
fd31f983af Fixed positioning of the part row selection checkboxes 2023-08-21 22:52:11 +02:00
Jan Böhmer
80bae4167f Added button to inverse part selection in tables
Fix issue #346
2023-08-21 22:49:02 +02:00
Andy
eaee4af715 Update installation_guide-debian.md (#352)
Fixed a typo: (link to configuration.md)
2023-08-21 17:06:12 +02:00
Jan Böhmer
7d4723c3e4 New translations messages.en.xlf (English) 2023-08-20 23:30:41 +02:00
Jan Böhmer
33a0981981 Added possibility to ignore the checks of withdraw amount when building projects
This fixes #349
2023-08-20 23:23:18 +02:00
Jan Böhmer
b62dc1241d Fix parameter mapping on part creation dialog to fix add builds part
This fixes issue #348
2023-08-20 20:30:38 +02:00
Jan Böhmer
e2270aec38 Upgraded further JS packages 2023-08-20 13:03:09 +02:00
Jan Böhmer
73346fcdaf Upgraded dependencies 2023-08-20 12:51:50 +02:00
Jan Böhmer
7b112512a9 Prevent that an administrator can lockout himself accidentally out of the user interface by using one of the permission presets 2023-08-20 12:42:56 +02:00
Jan Böhmer
0e5613b57b Forbid access to homepage if a user has no allow permission
This allows to block access to everything (even the homepage) for anonymous access. This fixes issue #290
2023-08-20 12:33:08 +02:00
Jan Böhmer
e66ff40733 Use the column order stored in localStorage during the initial datatables ajax call.
This way we still have the right ordering when changing pages. This fixes issue #345
2023-08-20 00:41:44 +02:00
Jan Böhmer
73d61f7440 Fixed PartKeepr import for storagelocation attachments
This should fix issue #334
2023-08-19 23:52:22 +02:00
Jan Böhmer
35a0e8464a Added possibility to list all available API keys at the user settings page 2023-08-19 23:19:21 +02:00
Jan Böhmer
040e86ea6d Added API endpoint to get info about the API token currently used to authenticate the user 2023-08-17 00:36:25 +02:00
Jan Böhmer
8dad143f8d Added own APIToken authenticator, so we can wrap the used API token inside the symfony security token 2023-08-17 00:17:02 +02:00
Jan Böhmer
bcd41c4d9b Added possibility to authenticate with the given API token 2023-08-16 00:13:01 +02:00
Jan Böhmer
3bc6e61869 Added very basic system to add API tokens to an user 2023-08-15 23:36:56 +02:00
Jan Böhmer
3486957447 Added endpoint for suppliers 2023-08-06 20:57:32 +02:00
Jan Böhmer
6b5c51bdc5 Improved schema infos of Manufacturer endpoints 2023-08-06 20:50:19 +02:00
Jan Böhmer
676c8eeefb Added basic API to access and edit manufacturer entities 2023-08-06 20:18:57 +02:00
Jan Böhmer
f5a15b23d6 Improved PartDB Info endpoint 2023-08-06 18:33:21 +02:00
Jan Böhmer
6d3b0261b3 Added first API endpoint 2023-08-06 00:42:34 +02:00
Jan Böhmer
dedb3071d6 New translations messages.en.xlf (English) 2023-08-05 00:10:52 +02:00
Jan Böhmer
a43ee52086 Fixed static analysis issues 2023-08-05 00:07:42 +02:00
Jan Böhmer
97ccb0cb21 Allow to globally disable update checking/connection with Github 2023-08-04 23:55:41 +02:00
Jan Böhmer
1fb334b0ca Show a notification on homepage and server info page if there is a new version available. 2023-08-04 23:49:26 +02:00
Jan Böhmer
fa4af99525 RELEASE v1.6.1 2023-08-01 16:21:25 +02:00
Jan Böhmer
b3153dac68 Fixed static analysis issue and added test for UserRepository 2023-08-01 16:20:31 +02:00
Jan Böhmer
c981476706 Use proper way of overriding doctrine attributes
In older versions doctrine allowed overriding attributes, by simply redifining them in subclasses. In 2.16 this throws an exception. We now use the proper way using the AttributeOverrides attribute
2023-08-01 15:55:21 +02:00
Jan Böhmer
1a3e5ec705 Updated dependencies
The commit order changes were merged into doctrines main branch, so we can now use the official release instead of the development branch again.
2023-08-01 15:34:37 +02:00
Jan Böhmer
aaff0835a3 Renmed SAMLP_SP_PRIVATE_KEY to SAML_SP_PRIVATE_KEY
Now it matches the documented value and follows the naming schema. The old env name is still valid, to maintain backwards compatibility.

Fixes issue #339
2023-08-01 15:31:40 +02:00
Jan Böhmer
9bf814d4cd Fixed error when StructuralEntityChoice type was used for non structural entities. 2023-08-01 15:14:32 +02:00
Jan Böhmer
b5c0f37f88 Fixed exception on visiting certain group edit pages.
This fixes issue #340
2023-08-01 15:06:57 +02:00
Jan Böhmer
05d73d2f68 RELEASE v1.6.0 2023-08-01 00:22:29 +02:00
Jan Böhmer
ff284d056c Updated dependencies. 2023-08-01 00:22:03 +02:00
Jan Böhmer
2393c759f3 Merge branch 'octopart-ip' 2023-07-31 22:43:19 +02:00
Jan Böhmer
0a983513ea Added documentation for the octopart provider. 2023-07-31 22:43:14 +02:00
Jan Böhmer
c737348cea Dont skip the Sqlite migration. Do nothing instead
Before this migration was never finished and always re executed on subsequent migration attempts.
2023-07-31 22:30:02 +02:00
Jan Böhmer
e8e2258357 Added migration for SQLite 2023-07-31 22:28:19 +02:00
Jan Böhmer
d847b74522 Reenable caching for part provider system. 2023-07-31 22:21:20 +02:00
Jan Böhmer
5750e7dbdf Fixed exception if octopart did not returned an category for a part 2023-07-31 22:21:08 +02:00
Jan Böhmer
ffe76f9d2e Use full path for categories returned by Octopart 2023-07-31 22:17:24 +02:00
Jan Böhmer
5b1ad541a8 Added an caching layer to octopart provider to reduce API queries. 2023-07-31 22:11:46 +02:00
Jan Böhmer
4824a82c3f Fixed error, when octopart search got no results 2023-07-31 01:00:34 +02:00
Jan Böhmer
f7cea1100c Allow to configure various options of the octopart provider 2023-07-31 00:57:33 +02:00
Jan Böhmer
827dd01e28 Get shopping informations from octopart 2023-07-31 00:13:59 +02:00
Jan Böhmer
d969f49ecc Get specifications, mass, footprint and manufacturer status from Octopart 2023-07-31 00:01:19 +02:00
Jan Böhmer
0f336b6f89 Allow for longer manufacturer and supplier URLs 2023-07-31 00:00:57 +02:00
Jan Böhmer
43cc37d10f Added very basic octopart info provider 2023-07-30 23:04:18 +02:00
Jan Böhmer
6a00b8e168 Added possibility to manage client_credentials OAuth tokens 2023-07-30 15:24:46 +02:00
Jan Böhmer
1b3fc2c23c Fixed PHPUnit exception 2023-07-29 19:03:46 +02:00
Jan Böhmer
8e96971b9c Merge remote-tracking branch 'origin/l10n_master' 2023-07-29 18:55:48 +02:00
Jan Böhmer
8e39e330fe Updated dependencies. 2023-07-29 18:55:24 +02:00
Jan Böhmer
15ba6572df Try to detect if an external attachment is an image or not.
Before we assumed that it is a picture in all cases.
2023-07-29 18:50:18 +02:00
Jan Böhmer
1c222ff293 Improved attachment name generation from DTO url
We dont include the query paramaters in the name anymore
2023-07-29 18:38:18 +02:00
Jan Böhmer
2fb1ec7f8a New translations messages.en.xlf (German) 2023-07-29 18:10:26 +02:00
Jan Böhmer
70f1db9619 New translations messages.en.xlf (German) 2023-07-29 17:10:30 +02:00
Jan Böhmer
11be65678e Fixed order by FIELD emulation on sqlite via INSTR
We need to search for the comma token separators at both ends of the search term, otherwise the ordering will be wrong.
2023-07-29 17:06:35 +02:00
Jan Böhmer
80ed064cd6 Emulate the field function in SQLIte by using an string search, instead of our PHP function callback 2023-07-29 16:50:47 +02:00
Jan Böhmer
62b1e33616 Fixed field ordering on SQLite 2023-07-29 16:42:27 +02:00
Jan Böhmer
52f2ef6d30 New translations messages.en.xlf (German) 2023-07-28 23:30:26 +02:00
Jan Böhmer
8ace78a873 New translations messages.en.xlf (German) 2023-07-28 11:50:42 +02:00
Jan Böhmer
5c30210534 Fixed some stuff on the emulated Field2 function and added tests 2023-07-27 00:38:17 +02:00
Jan Böhmer
1d03b6c38d Added tests for sqlite emulated functions 2023-07-26 23:39:53 +02:00
Jan Böhmer
d3ead8742e Implement a special field2 function, to migitiate the argument count limit in sqlite
This fixes issue #332 on SQLite DBs
2023-07-26 23:23:25 +02:00
Jan Böhmer
ed6b0057b7 Make the manufacturer field optional on part manufacturer data during Partkeepr import
This should fix issue #333
2023-07-26 22:55:18 +02:00
Jan Böhmer
90fbcb88d8 Updated dependencies 2023-07-23 23:22:00 +02:00
Jan Böhmer
be2ed52d93 Fixed phpstan issues 2023-07-23 23:04:45 +02:00
Jan Böhmer
f1af19a52a Fixed wrong background color for structural links 2023-07-23 23:02:04 +02:00
Jan Böhmer
4c4501073c Use a two step approach to retrieve part tables
This allows us to combine the fast filtering with the fetch joins, which should speed up the datatables a lot.
2023-07-23 21:48:38 +02:00
Jan Böhmer
b8b9a416ac Fixed wrong type of the supplier filter 2023-07-23 21:33:50 +02:00
Jan Böhmer
fc7e436ca9 Improved image and attachment viewing on part info page 2023-07-23 01:32:28 +02:00
Jan Böhmer
1de1eebc59 Fixed PHPstan issues 2023-07-23 01:20:38 +02:00
Jan Böhmer
a4d411656b Added a field extension for SQLite and let the database sort the elements by the given ID order directly 2023-07-23 01:19:48 +02:00
Jan Böhmer
1ec4266f96 Fixed sorting for element choice type and added tests 2023-07-23 01:01:29 +02:00
Jan Böhmer
61f02d693f Added info about alternative names to info provider documentation 2023-07-23 00:29:16 +02:00
Jan Böhmer
cd80552ce7 Fixed PHPstan issues 2023-07-23 00:14:29 +02:00
Jan Böhmer
d59b8817c3 Do not use fetch join, as even with the N+1 problem the queries are faster than with the very complex and slow expressions needed for the fetch Join pagination 2023-07-22 23:51:06 +02:00
Jan Böhmer
8ce5f4a796 Do not cache entities directly in NodesListBuilder but cache only the IDs instead
Otherwise the doctrine proxies break, and we get issues with loading the preview_images in structural Elements.
2023-07-20 23:20:46 +02:00
Jan Böhmer
2e8cb35acc Use ManyToOne instead of OneToOne for master_picture_attachment like before 2023-07-20 21:54:13 +02:00
Jan Böhmer
c0f626e9bd Fixed phpstan issue 2023-07-19 23:01:29 +02:00
Jan Böhmer
2ddfe48aba Do the doctrine definitions of the master preview attachment in the sub classes
This makes lazy fetching works and saves some db queries.
2023-07-19 22:49:40 +02:00
Jan Böhmer
2c6de84c9a Only check every 10 minutes if the user needs to setup a 2FA method enforced by its group
That saves us 3 database queries on many requests.
2023-07-19 00:56:28 +02:00
Jan Böhmer
87cf4c2d08 Do a extra lazy fetch on webauthn and u2f keys property of a user
In the most cases we just need the count of them and not the exact details. This just gives as a bit better performance on most requests
2023-07-19 00:20:38 +02:00
Jan Böhmer
3a8c835880 Lazily sort info providers list, to prevent unneccesarry work on most container calls 2023-07-19 00:11:19 +02:00
Jan Böhmer
e2dbd3d873 Fixed bug, that prevented all related history entries for an element
As the query param had the same name for each iteration, it got overwritten every time
2023-07-19 00:01:42 +02:00
Jan Böhmer
55aabddd41 Allow to sort by user in log data table 2023-07-18 23:45:52 +02:00
Jan Böhmer
eb07820523 Fixed issue that prevented undo changes from being logged 2023-07-18 23:42:01 +02:00
Jan Böhmer
8116217019 Fixed exception when undo/revert to a change which contained a change to a enum property 2023-07-18 23:34:45 +02:00
Jan Böhmer
6fb1845ff7 Use fixed version of jbtronics/2fa-webauthn-bundle 2023-07-17 23:46:12 +02:00
Jan Böhmer
75325f0ed8 Added some trademark disclaimer to Part-DB documentation 2023-07-17 23:28:24 +02:00
Jan Böhmer
0577f9e166 Added some documentation about caching 2023-07-17 23:25:22 +02:00
Jan Böhmer
52c6884e28 Allow slashes in digikey product ids 2023-07-17 23:21:30 +02:00
Jan Böhmer
2be76a488f Added documentation for part provider system 2023-07-17 23:14:35 +02:00
Jan Böhmer
686535fe42 New translations messages.en.xlf (English) 2023-07-17 00:53:09 +02:00
Jan Böhmer
5c17aee1e4 Properly escape group table name
Otherwise MySQL 8 will not be able to use this schema
2023-07-17 00:49:25 +02:00
Jan Böhmer
9b35ac3a99 Updated yarn dependencies. 2023-07-17 00:45:46 +02:00
Jan Böhmer
59b78e850f Merge branch 'part_info_provider_integration' 2023-07-17 00:43:51 +02:00
Jan Böhmer
3a8c5a788f Fixed phpstan issues 2023-07-17 00:43:35 +02:00
Jan Böhmer
afcbbe0f43 Fixed phpunit tests 2023-07-17 00:34:00 +02:00
Jan Böhmer
d10d29e590 Do not enable the create part from provider permission automatically
This allows users to create new datastructures, which is maybe not wanted. Besides it has to be configured first.
2023-07-17 00:20:38 +02:00
Jan Böhmer
7b61cb3163 Added more env variables to configure providers 2023-07-17 00:19:02 +02:00
Jan Böhmer
4c1c6701b3 Test availability of the info provider pages 2023-07-16 23:56:30 +02:00
Jan Böhmer
f423fdf7f8 Fixed bug in DB schema, which prevented the creation of parts without info provider reference 2023-07-16 23:48:55 +02:00
Jan Böhmer
a5995a2ce8 Centralized logic for part creation form 2023-07-16 23:46:20 +02:00
Jan Böhmer
c810b6772c Show the value returned by the provider on part creation page.
This makes it easier to check or assign a element manually
2023-07-16 23:19:02 +02:00
Jan Böhmer
b74ab18a6d Added possibility to define alternative names on data structures
This can be used to find elements, based on the data returned by info providers
2023-07-16 22:59:46 +02:00
Jan Böhmer
edc54aaf91 Added migrations for sqlite and new additional_names field 2023-07-16 20:47:25 +02:00
Jan Böhmer
b3b205cd6e Added permissions to control access to info providers and oauth tokens 2023-07-16 20:33:24 +02:00
Jan Böhmer
2fe4def775 New translations messages.en.xlf (Chinese Simplified) 2023-07-16 20:30:24 +02:00
Jan Böhmer
7bbf612394 Fixed title of info providers list 2023-07-16 20:09:20 +02:00
Jan Böhmer
97ab1f0492 Improved search page 2023-07-16 20:05:11 +02:00
Jan Böhmer
81bfcdd158 New translations messages.en.xlf (Chinese Simplified) 2023-07-16 19:30:23 +02:00
Jan Böhmer
6862d318f0 Cache the DTO objects returned by the info providers
This saves API requests
2023-07-16 19:05:26 +02:00
Jan Böhmer
412fa3f0bf Get datasheets and category from digikey 2023-07-16 18:35:44 +02:00
Jan Böhmer
01d9109c45 Improved digikey provider 2023-07-16 17:10:48 +02:00
Jan Böhmer
dd914d1d64 New translations messages.en.xlf (Chinese Simplified) 2023-07-16 16:56:03 +02:00
Jan Böhmer
5cf3624a3a New translations messages.en.xlf (Chinese Simplified) 2023-07-16 13:20:24 +02:00
Jan Böhmer
c7ff8c2dd1 New translations messages.en.xlf (Chinese Simplified) 2023-07-16 12:20:29 +02:00
Jan Böhmer
83c202d675 New translations messages.en.xlf (Chinese Simplified) 2023-07-16 11:20:25 +02:00
Jan Böhmer
f7648e3311 Added an button to connect the oauth providers from WebUI 2023-07-16 03:18:33 +02:00
Jan Böhmer
c203de082e Added proper OAuth authentication for digikey and other providers 2023-07-16 03:07:53 +02:00
Jan Böhmer
a95ba1acc4 Add a reference to the used info provider to a part 2023-07-16 01:24:49 +02:00
Jan Böhmer
db325525e4 New translations messages.en.xlf (Chinese Simplified) 2023-07-15 22:30:25 +02:00
Jan Böhmer
db97114fb4 Use preview image and other additional images provided by the info provider 2023-07-15 21:41:35 +02:00
Jan Böhmer
b18a300f10 New translations validators.en.xlf (Chinese Simplified) 2023-07-15 21:30:27 +02:00
Jan Böhmer
61ffb857ee New translations messages.en.xlf (Chinese Simplified) 2023-07-15 21:30:26 +02:00
Jan Böhmer
701212239d Use an experimental doctrine/orm version to fix some issues persisting attachments while simutanously creating a new attachment type
The circular reference between attachmentTypeAttachment and attachmentType seems to confuse doctrine. This is fixed in the experimental version
2023-07-15 21:17:10 +02:00
Jan Böhmer
422fa01c6f Use the initial element for database if the value was not changed. 2023-07-15 21:00:45 +02:00
Jan Böhmer
62820b4dd9 New translations validators.en.xlf (Chinese Simplified) 2023-07-15 20:30:54 +02:00
Jan Böhmer
8ea92ef330 Added tests for DTOConverter 2023-07-15 18:18:35 +02:00
Jan Böhmer
de82249d8d Provide footprint information on TMEProvider 2023-07-15 01:52:46 +02:00
Jan Böhmer
94a26ae75a Allow to extract ranges from paramaters 2023-07-15 01:41:29 +02:00
Jan Böhmer
f9fdae9de9 Added an TME data provider 2023-07-15 01:01:20 +02:00
Jan Böhmer
0cb46039dd Allow to retrieve price and shopping informations from info providers 2023-07-14 00:09:22 +02:00
Jan Böhmer
c4439cc9db Mark newly created entities better in structural entity selector 2023-07-12 23:58:40 +02:00
Jan Böhmer
6cd9640b30 Allow to automatically find or create entities from database based on info providers 2023-07-12 23:43:16 +02:00
Jan Böhmer
f9bce3dfdb Merge branch 'master' into part_info_provider_integration 2023-07-11 22:04:06 +02:00
Jan Böhmer
8eb0c997ed Updated dependencies 2023-07-11 22:01:32 +02:00
Jan Böhmer
a8f96e06bd Automatically whitelist the SAML IIDP domain for external redirect
This fixes issue #318
2023-07-11 21:50:55 +02:00
Jan Böhmer
9a2945927f New translations security.en.xlf (Chinese Simplified) 2023-07-10 23:36:28 +02:00
Jan Böhmer
89f9249ec6 New translations messages.en.xlf (Chinese Simplified) 2023-07-10 23:36:27 +02:00
Jan Böhmer
24f572253f New translations messages.en.xlf (Chinese Simplified) 2023-07-10 22:36:25 +02:00
Jan Böhmer
4fc9c19893 Removed useless tabs in code blocks in installation guide 2023-07-10 13:26:07 +02:00
Jan Böhmer
f6fcd730a8 Added how you checkout a stable release in the installation guide
Related to discussion #317
2023-07-10 13:20:44 +02:00
Jan Böhmer
716a56979d Added basic possibilty to create parts based on infoProviders 2023-07-09 23:31:40 +02:00
Jan Böhmer
538476be99 Added a info provider for element14/Farnell 2023-07-09 18:51:54 +02:00
Jan Böhmer
93a170a893 Added basic search system in info providers 2023-07-09 17:55:41 +02:00
Jan Böhmer
e0301f096f Added an very basic system to configure info providers 2023-07-09 14:27:41 +02:00
Jan Böhmer
9e3cb4d694 Use enum for manufacturing status 2023-07-08 23:49:47 +02:00
Jan Böhmer
49b76c3e43 New translations messages.en.xlf (English) 2023-07-08 23:16:14 +02:00
Jan Böhmer
9962784991 New translations messages.en.xlf (Chinese Simplified) 2023-07-08 23:16:12 +02:00
Jan Böhmer
6336b38cfc Bumped version to 1.6.0-dev 2023-07-08 23:07:33 +02:00
Jan Böhmer
2362835275 Merge branch 'user_impersonator' 2023-07-08 23:07:12 +02:00
Jan Böhmer
8a4ede9d43 Write to event log, when a user gets impersonated 2023-07-08 23:07:06 +02:00
Jan Böhmer
cc1595e048 Added button to user admin to impersonate a certain user 2023-07-08 22:43:41 +02:00
Jan Böhmer
ca16763423 Bumped version to 1.5.1 2023-07-08 21:11:55 +02:00
Jan Böhmer
b6dd5bb881 Fixed ordering columns of tables when columns were reordered 2023-07-08 20:16:52 +02:00
Jan Böhmer
f8e299ec56 Added new env option to show all parts on a page by default
Related to discussion #312
2023-07-08 19:33:23 +02:00
Jan Böhmer
91e9c6e048 Use bootstrap popover for title attribute in datatables 2023-07-08 19:08:00 +02:00
Jan Böhmer
b941b97eee Show full paths of elements on hover in part tables
Related to discussion #312
2023-07-08 19:02:43 +02:00
Jan Böhmer
d38ac652fc Do not cut QR code on small label pages
Fixes issue #314
2023-07-08 18:46:29 +02:00
Jan Böhmer
bdcf3b71ce Fixed exception when parameter constraint unit field is empty 2023-07-08 18:39:44 +02:00
Jan Böhmer
ddbf8b7725 Fixed phpstan issue 2023-07-04 00:35:57 +02:00
Jan Böhmer
a6fd4547a7 Bumped version to 1.5.1 2023-07-04 00:31:37 +02:00
Jan Böhmer
d20153c569 Added basic logic for impersonation 2023-07-04 00:31:13 +02:00
Jan Böhmer
15e072a2ff Fixed exception when the calculated minimum_order_price is null
This fixes issue #311
2023-07-03 23:41:39 +02:00
Jan Böhmer
f98e20aa84 Fixed errors importing partkeepr databases 2023-07-03 23:33:45 +02:00
Jan Böhmer
e7a1b33ae6 Allow to set the exchange rate of a currency to null (not existing) after it was set once 2023-07-03 22:15:58 +02:00
Jan Böhmer
2d5f23271f Force that an currency has an iso currency code
Otherwise it will crash a lot of formatter code (and a currency which is not existing is not really useful)
2023-07-03 22:11:12 +02:00
Jan Böhmer
059110ae7a Improved styling of a info level flash toast in darkmode 2023-07-03 22:01:39 +02:00
Jan Böhmer
ac84c175af Bumped version to 1.5.0 2023-07-03 00:59:12 +02:00
Jan Böhmer
3b6014c229 Updated dependencies 2023-07-03 00:58:43 +02:00
Jan Böhmer
9cb265c6f5 Improved margin between darkmode label and darkmode selector 2023-07-03 00:55:11 +02:00
Jan Böhmer
a47f0ccc12 Fixed phpstan issue 2023-07-03 00:38:14 +02:00
Jan Böhmer
e032f6b33d Use root node of sidebar trees as link to link to all parts list 2023-07-03 00:34:37 +02:00
Jan Böhmer
98e179ba06 Validate bom when adding additional bom entries via addPart controller to prevent invalid BOMs
This fixes issue #302
2023-07-03 00:28:37 +02:00
Jan Böhmer
2ebb4fef4c Added some tests to constraint validators 2023-07-02 23:59:06 +02:00
Jan Böhmer
e72b120c12 Use new UniqueObjectCollection constraint to ensure that BOM entries does not contain duplicate items 2023-07-02 20:49:10 +02:00
Jan Böhmer
7b87b00b44 Properly reset the page length when reloading a datatable
Fixes issue #309
2023-07-02 19:44:26 +02:00
Jan Böhmer
2b793bf242 Fixed tests 2023-07-02 17:46:09 +02:00
Jan Böhmer
49ae906029 Allow to directly specify the scanned string via an input query parameter 2023-07-02 14:16:32 +02:00
Jan Böhmer
4f82a0f026 Fixed qr code scan URL paths 2023-07-02 14:03:29 +02:00
Jan Böhmer
ae8edffdc8 Put the dompdf fonts and temp files in a folder inside var/dompdf, which should always be writable by the server process 2023-07-02 13:57:15 +02:00
Jan Böhmer
2b67c1c631 Use development version of dompdf, so we can use character level fallback fonts for dompdf
This is useful, so mixed character text is always shown and you not need to explicitly select unifont as font
2023-07-02 03:36:42 +02:00
Jan Böhmer
d395cf66a0 Fixed problem with label additional styles for labels 2023-07-02 03:28:17 +02:00
Jan Böhmer
956ed9e8ae Added GNU unifont as fallback font for labels with CJK characters 2023-07-02 03:26:56 +02:00
Jan Böhmer
63726b09d6 New translations security.en.xlf (English) 2023-06-30 00:26:50 +02:00
Jan Böhmer
f78d42cc30 New translations validators.en.xlf (English) 2023-06-30 00:26:49 +02:00
Jan Böhmer
5d1c807a86 New translations messages.en.xlf (English) 2023-06-30 00:26:48 +02:00
Jan Böhmer
fad077aad9 New translations security.en.xlf (Chinese Simplified) 2023-06-30 00:26:47 +02:00
Jan Böhmer
24f47bee73 New translations validators.en.xlf (Chinese Simplified) 2023-06-30 00:26:46 +02:00
Jan Böhmer
d93b7b2cb2 New translations messages.en.xlf (Chinese Simplified) 2023-06-30 00:26:45 +02:00
Jan Böhmer
ab03111a84 New translations security.en.xlf (German) 2023-06-30 00:26:38 +02:00
Jan Böhmer
1ba03b69f6 New translations validators.en.xlf (German) 2023-06-30 00:26:37 +02:00
Jan Böhmer
9957f64628 New translations messages.en.xlf (German) 2023-06-30 00:26:36 +02:00
Jan Böhmer
6505af2a8b Disable translation file linting as it causes problems with empty translation files 2023-06-29 23:37:42 +02:00
Jan Böhmer
54c74bac6e Show in README that we now require PHP 8.1 2023-06-29 23:35:06 +02:00
Jan Böhmer
5cf4c879dd Merge remote-tracking branch 'origin/l10n_master' 2023-06-29 23:32:12 +02:00
Jan Böhmer
aa00db48ce Updated dependencies 2023-06-29 23:31:17 +02:00
Jan Böhmer
4a158db632 New translations messages.en.xlf (German) 2023-06-29 23:26:32 +02:00
Jan Böhmer
f57a0ecba2 Use correct permission name 'show_private' instead of 'show_secure' in templates
This fixes issue #307
2023-06-28 16:30:16 +02:00
Jan Böhmer
3614c82632 Use light background for image on part page 2023-06-28 16:21:03 +02:00
Jan Böhmer
9207d41f17 New translations messages.en.xlf (English) 2023-06-28 16:17:50 +02:00
Jan Böhmer
c5abd0ff3f New translations security.en.xlf (Chinese Traditional) 2023-06-28 16:17:49 +02:00
Jan Böhmer
2c2bde1e05 New translations validators.en.xlf (Chinese Traditional) 2023-06-28 16:17:48 +02:00
Jan Böhmer
dcff8c0d9a New translations messages.en.xlf (Chinese Traditional) 2023-06-28 16:17:47 +02:00
Jan Böhmer
44555e5289 New translations security.en.xlf (Chinese Simplified) 2023-06-28 16:17:45 +02:00
Jan Böhmer
9c4eff68a3 New translations validators.en.xlf (Chinese Simplified) 2023-06-28 16:17:44 +02:00
Jan Böhmer
8f9122c706 New translations messages.en.xlf (Chinese Simplified) 2023-06-28 16:17:43 +02:00
Jan Böhmer
3eb1b476dd New translations messages.en.xlf (Russian) 2023-06-28 16:17:40 +02:00
Jan Böhmer
0de9f48be4 New translations messages.en.xlf (Japanese) 2023-06-28 16:17:37 +02:00
Jan Böhmer
162b482a8b New translations messages.en.xlf (Greek) 2023-06-28 16:17:34 +02:00
Jan Böhmer
2a46358ccf New translations messages.en.xlf (German) 2023-06-28 16:17:31 +02:00
Jan Böhmer
8146d6c293 New translations messages.en.xlf (French) 2023-06-28 16:17:29 +02:00
Jan Böhmer
5ab067cf86 Use password strenght estimator when setting new password after password reset. 2023-06-28 16:12:38 +02:00
Jan Böhmer
720859197c Removed unused controller, which was used for U2F registration before 2023-06-28 16:10:18 +02:00
Jan Böhmer
ce064a0b37 Use symfony/ux-translator to translate password_strength_estimator badges 2023-06-28 16:00:11 +02:00
Jan Böhmer
bfd82fb415 Use zxcvbn-core for password strength estimator and lazy load the controller
As we can now configure the used wordbooks, we can reduce the size of the file extremly
2023-06-28 14:44:29 +02:00
Jan Böhmer
655f656781 New translations messages.en.xlf (English) 2023-06-27 01:20:33 +02:00
Jan Böhmer
3f32841f49 New translations security.en.xlf (Chinese Traditional) 2023-06-27 01:20:32 +02:00
Jan Böhmer
4d7c021925 New translations validators.en.xlf (Chinese Traditional) 2023-06-27 01:20:31 +02:00
Jan Böhmer
ac923fe669 New translations messages.en.xlf (Chinese Traditional) 2023-06-27 01:20:30 +02:00
Jan Böhmer
d35b62995e New translations security.en.xlf (Chinese Simplified) 2023-06-27 01:20:29 +02:00
Jan Böhmer
ae7d2745db New translations validators.en.xlf (Chinese Simplified) 2023-06-27 01:20:28 +02:00
Jan Böhmer
5ff47e63bc New translations messages.en.xlf (Chinese Simplified) 2023-06-27 01:20:27 +02:00
Jan Böhmer
389341f613 New translations validators.en.xlf (Russian) 2023-06-27 01:20:25 +02:00
Jan Böhmer
00b51ad40d New translations messages.en.xlf (Russian) 2023-06-27 01:20:24 +02:00
Jan Böhmer
34c39597f5 New translations validators.en.xlf (Japanese) 2023-06-27 01:20:22 +02:00
Jan Böhmer
4516e75b6f New translations messages.en.xlf (Japanese) 2023-06-27 01:20:21 +02:00
Jan Böhmer
040518cca8 New translations validators.en.xlf (German) 2023-06-27 01:20:17 +02:00
Jan Böhmer
5d336e5fb9 New translations messages.en.xlf (German) 2023-06-27 01:20:16 +02:00
Jan Böhmer
e7d0103869 New translations validators.en.xlf (French) 2023-06-27 01:20:14 +02:00
Jan Böhmer
55cb10910f New translations messages.en.xlf (French) 2023-06-27 01:20:13 +02:00
Jan Böhmer
ecded8af93 Added password meter based on zxcvbn
Maybe we will use a different package later, as this one is very big...
2023-06-27 01:07:26 +02:00
Jan Böhmer
20826daa18 Show a notice flash if the content of labels is empty
This implements the suggestion of issue #297
2023-06-27 00:18:47 +02:00
Jan Böhmer
742f1f4622 Moved add bom entries button to top of BOM table 2023-06-27 00:11:16 +02:00
Jan Böhmer
49cf20545f Fixed exception occuring when deleting an element 2023-06-27 00:10:55 +02:00
Jan Böhmer
289e6f3d1c Added translations for darkmode buttons 2023-06-27 00:02:56 +02:00
Jan Böhmer
b246d17a33 Fixed darkmode in tomselect group headers. 2023-06-26 23:59:44 +02:00
Jan Böhmer
c6b6616ee3 Added internal part number (IPN) as label placeholders
This fixes issue #306
2023-06-26 23:56:23 +02:00
Jan Böhmer
d6500c45aa Use the domain name in server_name field of Google Authenticator QR code
We achieve that by decorating the GoogleAuthenticator service
2023-06-26 23:47:54 +02:00
Jan Böhmer
6fd79688b0 Merge branch 'darkmode-migration' 2023-06-26 23:02:12 +02:00
Jan Böhmer
c6478857bc Improved dark mode 2023-06-26 23:01:32 +02:00
Jan Böhmer
8a711ffecb Added darkmode styles for CKEDITOR 2023-06-26 22:57:36 +02:00
Jan Böhmer
139ea879df Fixed deprecation notices on marked js 2023-06-26 21:48:39 +02:00
Jan Böhmer
6a0968cc02 Updated dependencies. 2023-06-26 21:37:17 +02:00
Jan Böhmer
5a1fa409d8 Do not try to reset autoincrement of sqlite test DB as this somehow cause trouble with loading fixtures... 2023-06-20 02:02:23 +02:00
Jan Böhmer
225da163bb Fixed exception on user settings submission 2023-06-20 01:43:02 +02:00
Jan Böhmer
801ed0fbaf Made tom select dark mode compatible 2023-06-20 01:30:08 +02:00
Jan Böhmer
ea44fe0f16 Fixed indention of structual element 2023-06-20 01:11:41 +02:00
Jan Böhmer
6081fe3295 Fixed darkmode for some elements 2023-06-20 01:01:40 +02:00
Jan Böhmer
6df65a0b9d Implemented a new darkmode selector using bootstrap 5.3 color mode 2023-06-19 01:08:11 +02:00
Jan Böhmer
0aec9419ec Configure fixtures load decorator only for test env, as the base command is not available in production environments (missing dev dependencies) 2023-06-18 23:49:45 +02:00
Jan Böhmer
bb510a9240 Fixed test failure, caused by validation on user element 2023-06-18 22:11:58 +02:00
Jan Böhmer
cce3e1cfb8 Specify order in which the data fixtures should be loaded 2023-06-18 22:06:42 +02:00
Jan Böhmer
4977f6c270 Reset autoincrements on SQLite with our ResetAutoIncrementPurger too and make it default for fixtures load 2023-06-18 22:06:06 +02:00
Jan Böhmer
fe1715259a Updated dependencies 2023-06-18 21:38:02 +02:00
Jan Böhmer
f4c0d84380 Bumped version to 1.5.0-dev 2023-06-18 21:33:42 +02:00
Jan Böhmer
8a20584e27 Use enum for undo mode 2023-06-18 21:26:28 +02:00
Jan Böhmer
218b0adb8f Only enable Choice and InstanceOfConstraints if a value is provided 2023-06-18 21:20:07 +02:00
Jan Böhmer
7d99607919 Use an enum for the part stock change type 2023-06-18 20:42:05 +02:00
Jan Böhmer
9adfcc7aec Use an enum for target_type in log entries 2023-06-18 18:31:39 +02:00
Jan Böhmer
2da7463edf Use a enum for level in LogEntries 2023-06-18 17:25:55 +02:00
Jan Böhmer
4a644d8712 Replaced filter classes getters with public readonly properties to improve DX 2023-06-18 16:41:00 +02:00
Jan Böhmer
afa17ca429 Explicitly convert the database size to an int to prevent type error 2023-06-18 16:12:39 +02:00
Jan Böhmer
50708c6942 Use level 5 of phpstan analysis for CI static analysis 2023-06-18 16:02:50 +02:00
Jan Böhmer
cbdf0a9392 Fixed some errors introduced by earlier typings 2023-06-18 16:01:28 +02:00
Jan Böhmer
b7c8ca2a48 Improved typing and phpdoc type annotations 2023-06-18 15:37:42 +02:00
Jan Böhmer
3817ba774d Ignore the remaining issues 2023-06-18 00:28:21 +02:00
Jan Böhmer
e8771ea118 Fixed some more phpstan issues 2023-06-18 00:00:58 +02:00
Jan Böhmer
2f46fbfc7a Added stricter phpstan checks 2023-06-14 23:14:49 +02:00
Jan Böhmer
78b0e1bf7e Fixed errors when setting setParent on a proxied AbstractStructuralDBElement 2023-06-13 21:00:25 +02:00
Jan Böhmer
19530a9102 Fixed some PHPStan level 5 issues 2023-06-13 20:24:54 +02:00
Jan Böhmer
74051c5649 Exclude tests from phpstan analysis 2023-06-13 19:06:50 +02:00
Jan Böhmer
f3f391ab43 Updated phpstan config 2023-06-13 19:01:19 +02:00
Jan Böhmer
fc75621f1a Fixed DataFixtures 2023-06-13 18:54:18 +02:00
Jan Böhmer
fc3290271c Started to increase the phpstan level 2023-06-13 10:36:34 +02:00
Jan Böhmer
71cd4057a7 Use enums for LabelOptions 2023-06-12 23:39:30 +02:00
Jan Böhmer
485b35fbd4 Fixed static analysis issues 2023-06-11 23:16:07 +02:00
Jan Böhmer
172884ace8 Updated webprofiler bundle 2023-06-11 20:00:25 +02:00
Jan Böhmer
b788c3745c Updated recipe of twig-bundle 2023-06-11 19:59:44 +02:00
Jan Böhmer
7658cfcdbd Updated symfony/stimulus-bridge recipe 2023-06-11 19:58:31 +02:00
Jan Böhmer
52c8ea13af Updated doctrine/annotations recipe 2023-06-11 19:54:50 +02:00
Jan Böhmer
8f424f3273 Removed sensio/framework-extra-bundle as it was abandoned and is not needed anymore 2023-06-11 19:52:43 +02:00
Jan Böhmer
3d7cf8f7f3 Removed remaining annotations 2023-06-11 19:42:02 +02:00
Jan Böhmer
930adaf439 Moved custom validators from annotations to attributes 2023-06-11 19:32:15 +02:00
Jan Böhmer
e5a14557a2 Fixed strict typing errors 2023-06-11 19:05:27 +02:00
Jan Böhmer
6a2ff9d153 Added declare strict types to all files 2023-06-11 18:59:07 +02:00
Jan Böhmer
bea90a7d94 Updated dependencies 2023-06-11 18:27:49 +02:00
Jan Böhmer
e57d6e508a Fixed some serializer deprecations 2023-06-11 18:12:22 +02:00
Jan Böhmer
219b57a362 Fixed some deprecations 2023-06-11 17:38:08 +02:00
Jan Böhmer
df8f54f5a4 Fixed tests for stricter typing 2023-06-11 15:32:29 +02:00
Jan Böhmer
fcbb1849ec Applied rectors phpunit 9 migrations to tests 2023-06-11 15:15:55 +02:00
Jan Böhmer
684334ba22 Improved code style of tests 2023-06-11 15:02:59 +02:00
Jan Böhmer
5629215ce4 Use imports instead of FQNs 2023-06-11 15:00:28 +02:00
Jan Böhmer
f63b6d7207 Fixed service wiring configuration 2023-06-11 14:50:47 +02:00
Jan Böhmer
98dc553938 Applied rector to test files 2023-06-11 14:18:53 +02:00
Jan Böhmer
7ee01d9a05 Applied rector with PHP8.1 migration rules 2023-06-11 14:17:19 +02:00
Jan Böhmer
dc6a67c2f0 Made the ALLOWED_ELEMENT_CLASS protected so we can apply rector
Its bad style to override a public const in a child class
2023-06-11 14:02:59 +02:00
Jan Böhmer
affed459df Updated recipe of doctrine/doctrine-bundle 2023-06-11 13:49:21 +02:00
Jan Böhmer
8d4b8b02b8 Upgraded to symfony 6.3 2023-06-11 13:46:24 +02:00
Jan Böhmer
8c430a3af0 Fixed tests 2023-06-11 13:42:45 +02:00
Jan Böhmer
b7573a40d7 Fixed webauthn two factor authentication 2023-06-11 13:14:45 +02:00
Jan Böhmer
624696711d Merge branch 'master' into php81-migration 2023-06-11 12:20:02 +02:00
Jan Böhmer
56828e9e00 Bumped version to 1.4.2 2023-06-11 00:41:19 +02:00
Jan Böhmer
d2358c9550 Updated dependencies 2023-06-11 00:41:00 +02:00
Jan Böhmer
ab11747fab Fixed issue, that users table were delete while PartKeepr import on certain databases
This fixes issue #299
2023-06-11 00:31:05 +02:00
Jan Böhmer
44cb0fa434 Added a more verbose error message in the case of a pretty generic Database DriverException 2023-06-11 00:20:27 +02:00
Jan Böhmer
13814695ac Add hint to docker logs to error page 2023-06-11 00:12:24 +02:00
Jan Böhmer
377e2eb613 Properly redirect the stdout of php-fpm to the docker logs
This fixes issue #298
2023-06-11 00:09:00 +02:00
Jan Böhmer
bf4725a768 New translations security.en.xlf (Chinese Traditional) 2023-06-09 11:46:55 +02:00
Jan Böhmer
ed65abf786 New translations validators.en.xlf (Chinese Traditional) 2023-06-09 11:46:54 +02:00
Jan Böhmer
8d29fe8679 New translations messages.en.xlf (Chinese Traditional) 2023-06-09 11:46:53 +02:00
Jan Böhmer
f4f77c62c8 New translations security.en.xlf (Chinese Simplified) 2023-06-09 11:46:52 +02:00
Jan Böhmer
2cc08cdea1 New translations validators.en.xlf (Chinese Simplified) 2023-06-09 11:46:52 +02:00
Jan Böhmer
03dc6d63ed New translations messages.en.xlf (Chinese Simplified) 2023-06-09 11:46:51 +02:00
Jan Böhmer
bcb3ccec9a Added translation for security key registration error message 2023-06-07 00:52:13 +02:00
Jan Böhmer
4bec8efea1 Make LogoutLoggerEventSubscriber an event listener 2023-06-07 00:46:03 +02:00
Jan Böhmer
58b2c2bd69 Merge branch 'master' into php81-migration 2023-06-06 23:46:37 +02:00
Jan Böhmer
636776c531 Bumped version to 1.4.1 2023-06-06 23:22:39 +02:00
Jan Böhmer
ca4a33d408 Merge remote-tracking branch 'origin/l10n_master' 2023-06-06 23:21:44 +02:00
Jan Böhmer
9db158f4d4 Updated dependencies 2023-06-06 23:20:51 +02:00
Jan Böhmer
ea8b179df1 Added timetravel URL for PartAttachment elements 2023-06-06 23:16:51 +02:00
Jan Böhmer
efc152e3c8 Do not throw an exception during rendering of log detail page, if element has no time travel URL 2023-06-06 23:15:14 +02:00
Jan Böhmer
e68827bf3b Show a validation error message, when try to submit a form where a input is still set to a disabled value.
Normally this would just send a null to the server, which often cause excptions. We now catch that earlier, and say the user that he have to select another option, when he tries to submit
2023-06-06 23:05:44 +02:00
Jan Böhmer
58bf69882f Updated dependencies. 2023-06-05 22:15:07 +02:00
Jan Böhmer
915f313efd New translations security.en.xlf (English) 2023-05-28 18:05:45 +02:00
Jan Böhmer
52d29099a2 New translations messages.en.xlf (English) 2023-05-28 18:05:44 +02:00
japm48
c06fc926a1 Update translation (#295)
* Update security.en.xlf

* Update messages.en.xlf
2023-05-28 18:02:02 +02:00
Jan Böhmer
79ab1a2277 Fixed various issues inside the tests 2023-05-28 02:16:40 +02:00
Jan Böhmer
7c03630e24 Added DB migration to fix compatibility with latest webauthn bundle 2023-05-28 02:06:48 +02:00
Jan Böhmer
34a65419c7 Use attributes as route provider (instead of annotations) 2023-05-28 01:57:49 +02:00
Jan Böhmer
7191ece7a5 Configure doctrine to use attributes instead of annotations 2023-05-28 01:55:30 +02:00
Jan Böhmer
0837f84a43 Migrated doctrine annotations to attributes 2023-05-28 01:51:13 +02:00
Jan Böhmer
0bc4699cdc Started to move doctrine annotations to attributes (rector automated) 2023-05-28 01:33:45 +02:00
Jan Böhmer
bb1285c35c Remove defaultDescription from commands, as this is now part of the annotation 2023-05-28 01:32:04 +02:00
Jan Böhmer
21fc554589 Fixed error with LogoutLoggerEventSubscriber 2023-05-28 01:25:00 +02:00
Jan Böhmer
a43af180a7 Applied rector rules up to symfony 6.2 2023-05-28 01:21:05 +02:00
Jan Böhmer
88ea920dfb Add rector for automated refactoring 2023-05-28 01:16:12 +02:00
Jan Böhmer
132aac3951 Removed config/bootstrap.php which was left over from symfony 4.4 and which caused problems with phpunit 2023-05-28 01:01:19 +02:00
japm48
7640ed08bc docker: add missing PassEnv directives (#294) 2023-05-27 23:59:21 +02:00
Jan Böhmer
1dbf36b86b Use str_contains and similar instead of strpos 2023-05-27 23:58:28 +02:00
Jan Böhmer
508de10191 Modernized phpunit.xml.dist 2023-05-27 21:20:21 +02:00
Jan Böhmer
ccfe259c69 Updated recipe of symfony/webpack-encore 2023-05-27 21:05:03 +02:00
Jan Böhmer
0573f80525 Updated symfony/security recipe 2023-05-27 21:04:28 +02:00
Jan Böhmer
8fb4e6c4ee Updated recipe of symfony/recipe 2023-05-27 21:02:59 +02:00
Jan Böhmer
05b2515b3b Updated recipe of symfony/framework-bundle 2023-05-27 21:02:02 +02:00
Jan Böhmer
0ecb339fdf Updated recipe of scheb/2fa bundle 2023-05-27 20:53:34 +02:00
Jan Böhmer
92ddebc289 Updated recipe of php-http/discovery 2023-05-27 20:52:04 +02:00
Jan Böhmer
1a3f0675bf Updated doctrine bundle recipe 2023-05-27 20:51:05 +02:00
Jan Böhmer
c24019fd57 Fixed error preventing the service container from compiling 2023-05-27 20:46:02 +02:00
Jan Böhmer
55641a234c Require PHP 8.1 in composer.json 2023-05-27 20:40:30 +02:00
Jan Böhmer
9f52d364c9 Use newer nbgrp/onelogin-saml-bundle bundle for handling SAML 2023-05-27 20:38:32 +02:00
Jan Böhmer
edce70bc12 Updated symfony to 6.2, updated scheb/2fa bundle and removed obsolete hslavich/oneloginsaml-bundle 2023-05-27 20:35:36 +02:00
Jan Böhmer
b8a7f81f55 Bumped dependencies (dont work yet) 2023-05-27 20:25:51 +02:00
Jan Böhmer
ef9b2aefe5 Set platform in composer.json to PHP 8.1.0 and updated dependencies 2023-05-27 20:10:18 +02:00
Jan Böhmer
cd1413a74e CheckRequirementsCommand now recommends PHP 8.2 2023-05-27 20:07:03 +02:00
Jan Böhmer
4e9d93957e Removed tests for PHP 7.4 and PHP 8.0 2023-05-27 20:06:44 +02:00
Jan Böhmer
9c4e9066f9 Bump to version 1.4.0 2023-05-27 19:29:47 +02:00
Jan Böhmer
b4d1af2bce Merge remote-tracking branch 'origin/l10n_master' 2023-05-27 19:29:28 +02:00
Jan Böhmer
5ec676c40c Fixed static analysis issue 2023-05-27 19:29:00 +02:00
Jan Böhmer
5096aea5bb New translations security.en.xlf (English) 2023-05-27 19:26:51 +02:00
Jan Böhmer
feedd190dc New translations validators.en.xlf (English) 2023-05-27 19:26:51 +02:00
Jan Böhmer
3423fffaca New translations messages.en.xlf (English) 2023-05-27 19:26:50 +02:00
Jan Böhmer
1624fd2e28 New translations security.en.xlf (German) 2023-05-27 19:26:42 +02:00
Jan Böhmer
10b3094d5e New translations validators.en.xlf (German) 2023-05-27 19:26:42 +02:00
Jan Böhmer
580e638f67 New translations messages.en.xlf (German) 2023-05-27 19:26:41 +02:00
Jan Böhmer
e44428f87c Updated dependencies. 2023-05-27 19:24:14 +02:00
Jan Böhmer
379f7ef865 Implemented proper voters for attachments and parameters, so we can decide access for log details 2023-05-27 19:17:27 +02:00
Jan Böhmer
427f6e4d55 Merge remote-tracking branch 'origin/l10n_master' 2023-05-23 23:12:56 +02:00
Jan Böhmer
07a1e9fc3c New translations messages.en.xlf (English) 2023-05-23 23:09:42 +02:00
Jan Böhmer
78d64e8f1b New translations messages.en.xlf (German) 2023-05-23 23:09:32 +02:00
Jan Böhmer
559a9a9f3e New translations messages.en.xlf (German) 2023-05-23 22:45:26 +02:00
Jan Böhmer
ac6dd23fd6 Respect different currencies for pricedetails when importing from PartKeepr 2023-05-22 23:34:58 +02:00
Jan Böhmer
1e515df0b5 Fixed previous commit: Use the same behavior to determine the extension of file attachments like PartKeepr does, to ensure that all attachments are shown as available
This fixes issue #291
2023-05-22 23:06:41 +02:00
Jan Böhmer
35490762a6 Use the same behavior to determine the extension of file attachments like PartKeepr does, to ensure that all attachments are shown as available
This fixes issue #291
2023-05-22 22:55:18 +02:00
Jan Böhmer
c25e23d3d9 New translations messages.en.xlf (English) 2023-05-18 23:36:43 +02:00
Jan Böhmer
8bb8257e62 Added a log entry detail page for collection element deleted log entries. 2023-05-18 23:05:40 +02:00
Jan Böhmer
5f096927bd New translations messages.en.xlf (English) 2023-05-16 00:17:44 +02:00
Jan Böhmer
434826c125 Use default CodeQL workflow which is configured via repo settings and not via a action file 2023-05-16 00:16:50 +02:00
Jan Böhmer
89595cd5dc We are in development of version 1.4.0 now 2023-05-16 00:08:57 +02:00
Jan Böhmer
d991e15a94 Merge branch 'log_detail_page' 2023-05-16 00:08:12 +02:00
Jan Böhmer
6a1aefa5a5 Allow access to log detail page (only) if a user has permission to show_history of an entity 2023-05-16 00:05:54 +02:00
Jan Böhmer
272684e7eb Visualize generic object/JSON data of element history data as pretty tree structure on log detail page 2023-05-15 23:55:36 +02:00
Jan Böhmer
9be3eba694 Added button to delete a log entry via the log detail page. 2023-05-15 23:02:30 +02:00
Jan Böhmer
5a3fc0fb43 Show and link which log entry was undone/reverted on log detail page 2023-05-15 22:42:08 +02:00
Jan Böhmer
47ef8e9568 Updated dependencies 2023-05-15 00:36:36 +02:00
Jan Böhmer
e4285bbc78 delete_btn_controller: Keep the value and name of the original clicked button
This fixes an error message when undoing or reverting a log entry
2023-05-15 00:34:06 +02:00
Jan Böhmer
49b6a42791 Added buttons for revert and undo to the log detail page 2023-05-15 00:16:49 +02:00
Jan Böhmer
b62fd602f2 Show the diff of element edited log entries on detail pages 2023-05-14 23:08:14 +02:00
Jan Böhmer
923e40ed8f Add the data after the change to a element edited log entry, so you can easily view the changes in log detail pages 2023-05-14 21:41:00 +02:00
Jan Böhmer
3c724a227a Merge branch 'master' into log_detail_page 2023-05-14 16:43:52 +02:00
Jan Böhmer
90d26eb16a New translations messages.en.xlf (English) 2023-05-09 01:18:42 +02:00
Jan Böhmer
b629744e1a We are in development of v1.3.4 now 2023-05-09 00:27:18 +02:00
Jan Böhmer
b0ab43c39a Show a proper error message table when encountering an invalid regex statement on SQLite
This is related to #289
2023-05-09 00:26:40 +02:00
Jan Böhmer
2c33b381c1 Allow to unselect name, category, description fields etc in search functionm
Before this commit it was ignored, if the checkboxes for these fields were unchecked.
2023-05-08 23:53:59 +02:00
Jan Böhmer
c50a80e8df Show an error message in table instead of a 500 error when MySQL encounters an invalid Regex expression
This fixes issue #289
2023-05-08 23:42:25 +02:00
Jan Böhmer
bafbd63610 Bumped version to 1.3.3 2023-05-08 00:10:21 +02:00
Jan Böhmer
557347d42d Fixed legacy database migration for newer MySQL version 2023-05-07 21:43:01 +02:00
Jan Böhmer
c828aa3bc0 Use correct table name for test_legacy_import workflow 2023-05-07 02:58:59 +02:00
Jan Böhmer
376d29e829 Use correct table name for test_legacy_import workflow 2023-05-07 02:52:31 +02:00
Jan Böhmer
97ee4f36e3 Fixed typo in legacy import test script 2023-05-07 02:44:07 +02:00
Jan Böhmer
d766f255ef Let job fail, when an error occurs during the legacy test script 2023-05-07 02:38:54 +02:00
Jan Böhmer
19ae9e7456 Fixed issue preventing migration from legacy Part-DB version
This bug was introduced during the fix for issue #260 (commit 2717d7d). With this commit issue #287 should be fixed
2023-05-07 02:29:32 +02:00
Jan Böhmer
61ea312403 Added continous testing for legacy Part-DB import 2023-05-07 02:27:16 +02:00
Jan Böhmer
13193c9368 Fixed issue that searching in part notes were not possible
This fixes issue #288
2023-05-07 01:05:12 +02:00
Jan Böhmer
31e0ce4c64 Updated various yarn dependencies.
We can not upgrade marked to 5.0.0 yet, as it requires node18. We will require this version when we upgrade to PHP 8.1
2023-05-07 00:48:47 +02:00
Jan Böhmer
43238aff0a Updated CKEDITOR to 37.1.0 2023-05-07 00:11:13 +02:00
Jan Böhmer
d598bfc35b Updated dependencies. 2023-05-06 22:25:56 +02:00
Jan Böhmer
1c836918ca Fixed various Partkeepr import issues
On Linux mysql table names can contain uppercase characters, and we expect always lowercase character, so we now normalize the tablenames to lowercase.

Also fixed some type errors on part parameters and improved performace for orderdetails import.

This fixes issue #286
2023-05-02 00:40:00 +02:00
Jan Böhmer
4a6a3b9269 Moved doctrine/data-fixtures to prod requirement
We use it for database purging in partkeepr import command. This fixes issue #285
2023-05-01 23:09:59 +02:00
Jan Böhmer
1534f780aa Show a table with the old data in log entry details page 2023-05-01 01:38:14 +02:00
Jan Böhmer
4c6ceab8e8 Merge branch 'master' into log_detail_page 2023-04-29 22:46:38 +02:00
Jan Böhmer
021e28aca8 Bumped to version 1.3.2 2023-04-29 22:43:03 +02:00
Jan Böhmer
334d81db08 Mark that amount is unknown in part tables and info page
Fixes issue #282
2023-04-29 22:33:46 +02:00
Jan Böhmer
6ffd45a82a We are in development of 1.3.2 now 2023-04-29 22:07:14 +02:00
Jan Böhmer
2fe3902d8d Updated dependencies. 2023-04-29 22:06:13 +02:00
Jan Böhmer
f3fc01b740 New translations security.en.xlf (English) 2023-04-11 13:48:44 +02:00
Jan Böhmer
a201be5a01 New translations validators.en.xlf (English) 2023-04-11 13:48:43 +02:00
Jan Böhmer
ebf2035351 New translations messages.en.xlf (English) 2023-04-11 13:48:42 +02:00
Jan Böhmer
69fc28d5d6 Added better formatted extra section for certain log types 2023-04-10 23:13:09 +02:00
Jan Böhmer
4107535b19 Added basic log entry info page 2023-04-10 00:30:23 +02:00
777 changed files with 52024 additions and 16083 deletions

View File

@@ -26,14 +26,22 @@
# Pass the configuration from the docker env to the PHP environment (here you should list all .env options)
PassEnv APP_ENV APP_DEBUG APP_SECRET
PassEnv TRUSTED_PROXIES TRUSTED_HOSTS LOCK_DSN
PassEnv DATABASE_URL ENFORCE_CHANGE_COMMENTS_FOR
PassEnv DEFAULT_LANG DEFAULT_TIMEZONE BASE_CURRENCY INSTANCE_NAME ALLOW_ATTACHMENT_DOWNLOADS USE_GRAVATAR MAX_ATTACHMENT_FILE_SIZE DEFAULT_URI
PassEnv DEFAULT_LANG DEFAULT_TIMEZONE BASE_CURRENCY INSTANCE_NAME ALLOW_ATTACHMENT_DOWNLOADS USE_GRAVATAR MAX_ATTACHMENT_FILE_SIZE DEFAULT_URI CHECK_FOR_UPDATES
PassEnv MAILER_DSN ALLOW_EMAIL_PW_RESET EMAIL_SENDER_EMAIL EMAIL_SENDER_NAME
PassEnv HISTORY_SAVE_CHANGED_FIELDS HISTORY_SAVE_CHANGED_DATA HISTORY_SAVE_REMOVED_DATA
PassEnv HISTORY_SAVE_CHANGED_FIELDS HISTORY_SAVE_CHANGED_DATA HISTORY_SAVE_REMOVED_DATA HISTORY_SAVE_NEW_DATA
PassEnv ERROR_PAGE_ADMIN_EMAIL ERROR_PAGE_SHOW_HELP
PassEnv DEMO_MODE NO_URL_REWRITE_AVAILABLE FIXER_API_KEY BANNER
PassEnv SAML_ENABLED SAML_ROLE_MAPPING SAML_UPDATE_GROUP_ON_LOGIN SAML_IDP_ENTITY_ID SAML_IDP_SINGLE_SIGN_ON_SERVICE SAML_IDP_SINGLE_LOGOUT_SERVICE SAML_IDP_X509_CERT SAML_SP_ENTITY_ID SAML_SP_X509_CERT SAMLP_SP_PRIVATE_KEY
# In old version the SAML sp private key env, was wrongly named SAMLP_SP_PRIVATE_KEY, keep it for backward compatibility
PassEnv SAML_ENABLED SAML_ROLE_MAPPING SAML_UPDATE_GROUP_ON_LOGIN SAML_IDP_ENTITY_ID SAML_IDP_SINGLE_SIGN_ON_SERVICE SAML_IDP_SINGLE_LOGOUT_SERVICE SAML_IDP_X509_CERT SAML_SP_ENTITY_ID SAML_SP_X509_CERT SAML_SP_PRIVATE_KEY SAMLP_SP_PRIVATE_KEY
PassEnv TABLE_DEFAULT_PAGE_SIZE TABLE_PARTS_DEFAULT_COLUMNS
PassEnv PROVIDER_DIGIKEY_CLIENT_ID PROVIDER_DIGIKEY_SECRET PROVIDER_DIGIKEY_CURRENCY PROVIDER_DIGIKEY_LANGUAGE PROVIDER_DIGIKEY_COUNTRY
PassEnv PROVIDER_ELEMENT14_KEY PROVIDER_ELEMENT14_STORE_ID
PassEnv PROVIDER_TME_KEY PROVIDER_TME_SECRET PROVIDER_TME_CURRENCY PROVIDER_TME_LANGUAGE PROVIDER_TME_COUNTRY PROVIDER_TME_GET_GROSS_PRICES
PassEnv PROVIDER_OCTOPART_CLIENT_ID PROVIDER_OCTOPART_SECRET PROVIDER_OCTOPART_CURRENCY PROVIDER_OCTOPART_COUNTRY PROVIDER_OCTOPART_SEARCH_LIMIT PROVIDER_OCTOPART_ONLY_AUTHORIZED_SELLERS
PassEnv PROVIDER_MOUSER_KEY PROVIDER_MOUSER_SEARCH_OPTION PROVIDER_MOUSER_SEARCH_LIMIT PROVIDER_MOUSER_SEARCH_WITH_SIGNUP_LANGUAGE
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to

82
.env
View File

@@ -44,6 +44,9 @@ DEFAULT_URI="https://partdb.changeme.invalid/"
# Leave this empty, to make all change reasons optional
ENFORCE_CHANGE_COMMENTS_FOR=""
# Disable that if you do not want that Part-DB connects to GitHub to check for available updates, or if your server can not connect to the internet
CHECK_FOR_UPDATES=1
###################################################################################
# Email settings
###################################################################################
@@ -71,6 +74,9 @@ HISTORY_SAVE_CHANGED_FIELDS=1
HISTORY_SAVE_CHANGED_DATA=1
# Save the data of an element that gets removed into log entry. This allows to undelete an element
HISTORY_SAVE_REMOVED_DATA=1
# Save the new data of an element that gets changed or added. This allows an easy comparison of the old and new data on the detail page
# This option only becomes active when HISTORY_SAVE_CHANGED_DATA is set to 1
HISTORY_SAVE_NEW_DATA=1
###################################################################################
# Error pages settings
@@ -81,6 +87,76 @@ ERROR_PAGE_ADMIN_EMAIL=''
# If this is set to true, solutions to common problems are shown on error pages. Disable this, if you do not want your users to see them...
ERROR_PAGE_SHOW_HELP=1
##################################################################################
# Part table settings
##################################################################################
# The default page size for the part table (set to -1 to show all parts on one page)
TABLE_DEFAULT_PAGE_SIZE=50
# Configure which columns will be visible by default in the parts table (and in which order).
# This is a comma separated list of column names. See documentation for available values.
TABLE_PARTS_DEFAULT_COLUMNS=name,description,category,footprint,manufacturer,storage_location,amount
##################################################################################
# Info provider settings
##################################################################################
# Digikey Provider:
# You can get your client id and secret from https://developer.digikey.com/
PROVIDER_DIGIKEY_CLIENT_ID=
PROVIDER_DIGIKEY_SECRET=
# The currency to get prices in
PROVIDER_DIGIKEY_CURRENCY=EUR
# The language to get results in (en, de, fr, it, es, zh, ja, ko)
PROVIDER_DIGIKEY_LANGUAGE=en
# The country to get results for
PROVIDER_DIGIKEY_COUNTRY=DE
# Farnell Provider:
# You can get your API key from https://partner.element14.com/
PROVIDER_ELEMENT14_KEY=
# Configure the store domain you want to use. This decides the language and currency of results. You can get a list of available stores from https://partner.element14.com/docs/Product_Search_API_REST__Description
PROVIDER_ELEMENT14_STORE_ID=de.farnell.com
# TME Provider:
# You can get your API key from https://developers.tme.eu/en/
PROVIDER_TME_KEY=
PROVIDER_TME_SECRET=
# The currency to get prices in
PROVIDER_TME_CURRENCY=EUR
# The language to get results in (en, de, pl)
PROVIDER_TME_LANGUAGE=en
# The country to get results for
PROVIDER_TME_COUNTRY=DE
# Set this to 1 to get gross prices (including VAT) instead of net prices
PROVIDER_TME_GET_GROSS_PRICES=1
# Octopart / Nexar Provider:
# You can get your API key from https://nexar.com/api
PROVIDER_OCTOPART_CLIENT_ID=
PROVIDER_OCTOPART_SECRET=
# The currency and country to get prices for (you have to set both to get meaningful results)
# 3 letter ISO currency code (e.g. EUR, USD, GBP)
PROVIDER_OCTOPART_CURRENCY=EUR
# 2 letter ISO country code (e.g. DE, US, GB)
PROVIDER_OCTOPART_COUNTRY=DE
# The number of results to get from Octopart while searching (please note that this counts towards your API limits)
PROVIDER_OCTOPART_SEARCH_LIMIT=10
# Set to false to include non authorized offers in the results
PROVIDER_OCTOPART_ONLY_AUTHORIZED_SELLERS=1
# Mouser Provider API V2:
# You can get your API key from https://www.mouser.it/api-hub/
PROVIDER_MOUSER_KEY=
# Filter search results by RoHS compliance and stock availability:
# Available options: None | Rohs | InStock | RohsAndInStock
PROVIDER_MOUSER_SEARCH_OPTION='None'
# The number of results to get from Mouser while searching (please note that this value is max 50)
PROVIDER_MOUSER_SEARCH_LIMIT=50
# It is recommended to leave this set to 'true'. The option is not really good doumented by Mouser:
# Used when searching for keywords in the language specified when you signed up for Search API.
PROVIDER_MOUSER_SEARCH_WITH_SIGNUP_LANGUAGE='true'
###################################################################################
# SAML Single sign on-settings
###################################################################################
@@ -113,7 +189,7 @@ SAML_SP_ENTITY_ID="https://partdb.changeme.invalid/sp"
# The public certificate of the SAML SP
SAML_SP_X509_CERT="MIIC..."
# The private key of the SAML SP
SAMLP_SP_PRIVATE_KEY="MIIE..."
SAML_SP_PRIVATE_KEY="MIIE..."
######################################################################################
@@ -147,3 +223,7 @@ APP_SECRET=a03498528f5a5fc089273ec9ae5b2849
# postgresql+advisory://db_user:db_password@localhost/db_name
LOCK_DSN=flock
###< symfony/lock ###
###> nelmio/cors-bundle ###
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
###< nelmio/cors-bundle ###

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# For sh files, always use LF line endings
*.sh text eol=lf

View File

@@ -0,0 +1,752 @@
-- phpMyAdmin SQL Dump
-- version 5.1.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Erstellungszeit: 07. Mai 2023 um 01:58
-- Server-Version: 10.6.5-MariaDB-log
-- PHP-Version: 8.1.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Datenbank: `partdb_demo`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `attachements`
--
CREATE TABLE `attachements` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`class_name` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL,
`element_id` int(11) NOT NULL,
`type_id` int(11) NOT NULL,
`filename` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`show_in_table` tinyint(1) NOT NULL DEFAULT 0,
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `attachements`
--
INSERT INTO `attachements` (`id`, `name`, `class_name`, `element_id`, `type_id`, `filename`, `show_in_table`, `last_modified`) VALUES
(1, 'BC547', 'Part', 2, 2, '%BASE%/data/media/bc547.pdf', 1, '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `attachement_types`
--
CREATE TABLE `attachement_types` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `attachement_types`
--
INSERT INTO `attachement_types` (`id`, `name`, `parent_id`, `comment`, `datetime_added`, `last_modified`) VALUES
(1, 'Bilder', NULL, NULL, '2017-10-21 17:58:48', '0000-00-00 00:00:00'),
(2, 'Datenblätter', NULL, NULL, '2017-10-21 17:58:48', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `categories`
--
CREATE TABLE `categories` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`disable_footprints` tinyint(1) NOT NULL DEFAULT 0,
`disable_manufacturers` tinyint(1) NOT NULL DEFAULT 0,
`disable_autodatasheets` tinyint(1) NOT NULL DEFAULT 0,
`disable_properties` tinyint(1) NOT NULL DEFAULT 0,
`partname_regex` text COLLATE utf8mb3_unicode_ci NOT NULL,
`partname_hint` text COLLATE utf8mb3_unicode_ci NOT NULL,
`default_description` text COLLATE utf8mb3_unicode_ci NOT NULL,
`default_comment` text COLLATE utf8mb3_unicode_ci NOT NULL,
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `categories`
--
INSERT INTO `categories` (`id`, `name`, `parent_id`, `disable_footprints`, `disable_manufacturers`, `disable_autodatasheets`, `disable_properties`, `partname_regex`, `partname_hint`, `default_description`, `default_comment`, `comment`, `datetime_added`, `last_modified`) VALUES
(1, 'aktive Bauteile', NULL, 0, 0, 0, 0, '', '', '', '', NULL, '2017-10-21 17:58:49', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `devices`
--
CREATE TABLE `devices` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`order_quantity` int(11) NOT NULL DEFAULT 0,
`order_only_missing_parts` tinyint(1) NOT NULL DEFAULT 0,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `devices`
--
INSERT INTO `devices` (`id`, `name`, `parent_id`, `order_quantity`, `order_only_missing_parts`, `datetime_added`, `last_modified`, `comment`) VALUES
(1, 'Test', NULL, 0, 0, '2015-04-16 15:08:56', '0000-00-00 00:00:00', NULL);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `device_parts`
--
CREATE TABLE `device_parts` (
`id` int(11) NOT NULL,
`id_part` int(11) NOT NULL DEFAULT 0,
`id_device` int(11) NOT NULL DEFAULT 0,
`quantity` int(11) NOT NULL DEFAULT 0,
`mountnames` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `device_parts`
--
INSERT INTO `device_parts` (`id`, `id_part`, `id_device`, `quantity`, `mountnames`) VALUES
(1, 2, 1, 1, '');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `footprints`
--
CREATE TABLE `footprints` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`filename` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`filename_3d` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `footprints`
--
INSERT INTO `footprints` (`id`, `name`, `filename`, `filename_3d`, `parent_id`, `comment`, `datetime_added`, `last_modified`) VALUES
(1, 'LEDs', '%BASE%/img/footprints/Optik/LEDs/Bedrahtet/LED-GELB_3MM.png', '', NULL, NULL, '2017-10-21 17:58:49', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `groups`
--
CREATE TABLE `groups` (
`id` int(11) NOT NULL,
`name` varchar(32) NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`comment` mediumtext DEFAULT NULL,
`perms_system` int(11) NOT NULL,
`perms_groups` int(11) NOT NULL,
`perms_users` int(11) NOT NULL,
`perms_self` int(11) NOT NULL,
`perms_system_config` int(11) NOT NULL,
`perms_system_database` int(11) NOT NULL,
`perms_parts` bigint(11) NOT NULL,
`perms_parts_name` smallint(6) NOT NULL,
`perms_parts_description` smallint(6) NOT NULL,
`perms_parts_instock` smallint(6) NOT NULL,
`perms_parts_mininstock` smallint(6) NOT NULL,
`perms_parts_footprint` smallint(6) NOT NULL,
`perms_parts_storelocation` smallint(6) NOT NULL,
`perms_parts_manufacturer` smallint(6) NOT NULL,
`perms_parts_comment` smallint(6) NOT NULL,
`perms_parts_order` smallint(6) NOT NULL,
`perms_parts_orderdetails` smallint(6) NOT NULL,
`perms_parts_prices` smallint(6) NOT NULL,
`perms_parts_attachements` smallint(6) NOT NULL,
`perms_devices` int(11) NOT NULL,
`perms_devices_parts` int(11) NOT NULL,
`perms_storelocations` int(11) NOT NULL,
`perms_footprints` int(11) NOT NULL,
`perms_categories` int(11) NOT NULL,
`perms_suppliers` int(11) NOT NULL,
`perms_manufacturers` int(11) NOT NULL,
`perms_attachement_types` int(11) NOT NULL,
`perms_tools` int(11) NOT NULL,
`perms_labels` smallint(6) NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
--
-- Daten für Tabelle `groups`
--
INSERT INTO `groups` (`id`, `name`, `parent_id`, `comment`, `perms_system`, `perms_groups`, `perms_users`, `perms_self`, `perms_system_config`, `perms_system_database`, `perms_parts`, `perms_parts_name`, `perms_parts_description`, `perms_parts_instock`, `perms_parts_mininstock`, `perms_parts_footprint`, `perms_parts_storelocation`, `perms_parts_manufacturer`, `perms_parts_comment`, `perms_parts_order`, `perms_parts_orderdetails`, `perms_parts_prices`, `perms_parts_attachements`, `perms_devices`, `perms_devices_parts`, `perms_storelocations`, `perms_footprints`, `perms_categories`, `perms_suppliers`, `perms_manufacturers`, `perms_attachement_types`, `perms_tools`, `perms_labels`, `datetime_added`, `last_modified`) VALUES
(1, 'admins', NULL, 'Users of this group can do everything: Read, Write and Administrative actions.', 21, 1365, 87381, 85, 85, 21, 1431655765, 5, 5, 5, 5, 5, 5, 5, 5, 5, 325, 325, 325, 5461, 325, 5461, 5461, 5461, 5461, 5461, 1365, 1365, 85, '2017-10-21 17:58:46', '2018-10-08 17:27:41'),
(2, 'readonly', NULL, 'Users of this group can only read informations, use tools, and don\'t have access to administrative tools.', 2, 2730, 43690, 25, 170, 42, 2778027689, 9, 9, 9, 9, 9, 9, 9, 9, 9, 649, 649, 649, 1705, 649, 1705, 1705, 1705, 1705, 1705, 681, 1366, 165, '2017-10-21 17:58:46', '2018-10-08 17:28:35'),
(3, 'users', NULL, 'Users of this group, can edit part informations, create new ones, etc. but are not allowed to use administrative tools. (But can read current configuration, and see Server status)', 42, 2730, 43689, 89, 105, 41, 1431655765, 5, 5, 5, 5, 5, 5, 5, 5, 5, 325, 325, 325, 5461, 325, 5461, 5461, 5461, 5461, 5461, 1365, 1365, 85, '2017-10-21 17:58:46', '2018-10-08 17:28:17');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `internal`
--
CREATE TABLE `internal` (
`keyName` char(30) CHARACTER SET ascii NOT NULL,
`keyValue` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `internal`
--
INSERT INTO `internal` (`keyName`, `keyValue`) VALUES
('dbVersion', '26');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `log`
--
CREATE TABLE `log` (
`id` int(11) NOT NULL,
`datetime` timestamp NOT NULL DEFAULT current_timestamp(),
`id_user` int(11) NOT NULL,
`level` tinyint(4) NOT NULL,
`type` smallint(6) NOT NULL,
`target_id` int(11) NOT NULL,
`target_type` smallint(6) NOT NULL,
`extra` mediumtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `manufacturers`
--
CREATE TABLE `manufacturers` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`address` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`phone_number` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`fax_number` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`email_address` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`website` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`auto_product_url` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `manufacturers`
--
INSERT INTO `manufacturers` (`id`, `name`, `parent_id`, `address`, `phone_number`, `fax_number`, `email_address`, `website`, `auto_product_url`, `datetime_added`, `comment`, `last_modified`) VALUES
(1, 'Atmel', NULL, '', '', '', '', '', '', '2015-03-01 11:27:10', NULL, '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `orderdetails`
--
CREATE TABLE `orderdetails` (
`id` int(11) NOT NULL,
`part_id` int(11) NOT NULL,
`id_supplier` int(11) NOT NULL DEFAULT 0,
`supplierpartnr` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`obsolete` tinyint(1) DEFAULT 0,
`supplier_product_url` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `parts`
--
CREATE TABLE `parts` (
`id` int(11) NOT NULL,
`id_category` int(11) NOT NULL DEFAULT 0,
`name` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`description` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`instock` int(11) NOT NULL DEFAULT 0,
`mininstock` int(11) NOT NULL DEFAULT 0,
`comment` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`visible` tinyint(1) NOT NULL,
`id_footprint` int(11) DEFAULT NULL,
`id_storelocation` int(11) DEFAULT NULL,
`order_orderdetails_id` int(11) DEFAULT NULL,
`order_quantity` int(11) NOT NULL DEFAULT 1,
`manual_order` tinyint(1) NOT NULL DEFAULT 0,
`id_manufacturer` int(11) DEFAULT NULL,
`id_master_picture_attachement` int(11) DEFAULT NULL,
`manufacturer_product_url` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`favorite` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `parts`
--
INSERT INTO `parts` (`id`, `id_category`, `name`, `description`, `instock`, `mininstock`, `comment`, `visible`, `id_footprint`, `id_storelocation`, `order_orderdetails_id`, `order_quantity`, `manual_order`, `id_manufacturer`, `id_master_picture_attachement`, `manufacturer_product_url`, `datetime_added`, `last_modified`, `favorite`) VALUES
(2, 1, 'BC547C', 'NPN 45V 0,1A 0,5W', 59, 0, '', 0, 1, 1, NULL, 1, 0, NULL, NULL, '', '2015-03-01 10:40:31', '2016-12-26 10:48:49', 0);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `pricedetails`
--
CREATE TABLE `pricedetails` (
`id` int(11) NOT NULL,
`orderdetails_id` int(11) NOT NULL,
`price` decimal(11,5) DEFAULT NULL,
`price_related_quantity` int(11) NOT NULL DEFAULT 1,
`min_discount_quantity` int(11) NOT NULL DEFAULT 1,
`manual_input` tinyint(1) NOT NULL DEFAULT 1,
`last_modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `storelocations`
--
CREATE TABLE `storelocations` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`is_full` tinyint(1) NOT NULL DEFAULT 0,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `storelocations`
--
INSERT INTO `storelocations` (`id`, `name`, `parent_id`, `is_full`, `datetime_added`, `comment`, `last_modified`) VALUES
(1, 'Halbleiter I', NULL, 0, '2015-03-01 11:26:37', NULL, '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `suppliers`
--
CREATE TABLE `suppliers` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`address` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`phone_number` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`fax_number` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`email_address` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`website` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`auto_product_url` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `suppliers`
--
INSERT INTO `suppliers` (`id`, `name`, `parent_id`, `address`, `phone_number`, `fax_number`, `email_address`, `website`, `auto_product_url`, `datetime_added`, `comment`, `last_modified`) VALUES
(1, 'Test', NULL, '', '', '', '', '', 'Test', '2015-03-01 10:37:23', NULL, '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(32) NOT NULL,
`password` varchar(255) DEFAULT NULL,
`first_name` tinytext DEFAULT NULL,
`last_name` tinytext DEFAULT NULL,
`department` tinytext DEFAULT NULL,
`email` tinytext DEFAULT NULL,
`need_pw_change` tinyint(1) NOT NULL DEFAULT 0,
`group_id` int(11) DEFAULT NULL,
`config_language` tinytext DEFAULT NULL,
`config_timezone` tinytext DEFAULT NULL,
`config_theme` tinytext DEFAULT NULL,
`config_currency` tinytext DEFAULT NULL,
`config_image_path` text NOT NULL,
`config_instock_comment_w` text NOT NULL,
`config_instock_comment_a` text NOT NULL,
`perms_system` int(11) NOT NULL,
`perms_groups` int(11) NOT NULL,
`perms_users` int(11) NOT NULL,
`perms_self` int(11) NOT NULL,
`perms_system_config` int(11) NOT NULL,
`perms_system_database` int(11) NOT NULL,
`perms_parts` bigint(11) NOT NULL,
`perms_parts_name` smallint(6) NOT NULL,
`perms_parts_description` smallint(6) NOT NULL,
`perms_parts_instock` smallint(6) NOT NULL,
`perms_parts_mininstock` smallint(6) NOT NULL,
`perms_parts_footprint` smallint(6) NOT NULL,
`perms_parts_storelocation` smallint(6) NOT NULL,
`perms_parts_manufacturer` smallint(6) NOT NULL,
`perms_parts_comment` smallint(6) NOT NULL,
`perms_parts_order` smallint(6) NOT NULL,
`perms_parts_orderdetails` smallint(6) NOT NULL,
`perms_parts_prices` smallint(6) NOT NULL,
`perms_parts_attachements` smallint(6) NOT NULL,
`perms_devices` int(11) NOT NULL,
`perms_devices_parts` int(11) NOT NULL,
`perms_storelocations` int(11) NOT NULL,
`perms_footprints` int(11) NOT NULL,
`perms_categories` int(11) NOT NULL,
`perms_suppliers` int(11) NOT NULL,
`perms_manufacturers` int(11) NOT NULL,
`perms_attachement_types` int(11) NOT NULL,
`perms_tools` int(11) NOT NULL,
`perms_labels` smallint(6) NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
--
-- Daten für Tabelle `users`
--
INSERT INTO `users` (`id`, `name`, `password`, `first_name`, `last_name`, `department`, `email`, `need_pw_change`, `group_id`, `config_language`, `config_timezone`, `config_theme`, `config_currency`, `config_image_path`, `config_instock_comment_w`, `config_instock_comment_a`, `perms_system`, `perms_groups`, `perms_users`, `perms_self`, `perms_system_config`, `perms_system_database`, `perms_parts`, `perms_parts_name`, `perms_parts_description`, `perms_parts_instock`, `perms_parts_mininstock`, `perms_parts_footprint`, `perms_parts_storelocation`, `perms_parts_manufacturer`, `perms_parts_comment`, `perms_parts_order`, `perms_parts_orderdetails`, `perms_parts_prices`, `perms_parts_attachements`, `perms_devices`, `perms_devices_parts`, `perms_storelocations`, `perms_footprints`, `perms_categories`, `perms_suppliers`, `perms_manufacturers`, `perms_attachement_types`, `perms_tools`, `perms_labels`, `datetime_added`, `last_modified`) VALUES
(1, 'anonymous', '', '', '', '', '', 0, 2, '', '', '', NULL, '', '', '', 21848, 20480, 0, 0, 0, 0, 0, 21840, 21840, 21840, 21840, 21840, 21840, 21840, 21840, 21840, 21520, 21520, 21520, 20480, 21520, 20480, 20480, 20480, 20480, 20480, 21504, 20480, 0, '2017-10-21 17:58:46', '2018-02-18 12:46:58'),
(2, 'admin', '$2a$12$j0RKrKlx60bzX1DWMyXwjeaW.pe3bFjAK8ByIGnvjrRnET2JtsFoe', 'Admin', 'Ad', NULL, 'admin@ras.pi', 0, 1, '', '', '', NULL, '', '', '', 21845, 21845, 21845, 21, 85, 21, 349525, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 0, '2017-10-21 17:58:46', '2017-12-23 11:04:48');
--
-- Indizes der exportierten Tabellen
--
--
-- Indizes für die Tabelle `attachements`
--
ALTER TABLE `attachements`
ADD PRIMARY KEY (`id`),
ADD KEY `attachements_class_name_k` (`class_name`),
ADD KEY `attachements_element_id_k` (`element_id`),
ADD KEY `attachements_type_id_fk` (`type_id`);
--
-- Indizes für die Tabelle `attachement_types`
--
ALTER TABLE `attachement_types`
ADD PRIMARY KEY (`id`),
ADD KEY `attachement_types_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`),
ADD KEY `categories_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `devices`
--
ALTER TABLE `devices`
ADD PRIMARY KEY (`id`),
ADD KEY `devices_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `device_parts`
--
ALTER TABLE `device_parts`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `device_parts_combination_uk` (`id_part`,`id_device`),
ADD KEY `device_parts_id_part_k` (`id_part`),
ADD KEY `device_parts_id_device_k` (`id_device`);
--
-- Indizes für die Tabelle `footprints`
--
ALTER TABLE `footprints`
ADD PRIMARY KEY (`id`),
ADD KEY `footprints_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `groups`
--
ALTER TABLE `groups`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indizes für die Tabelle `internal`
--
ALTER TABLE `internal`
ADD UNIQUE KEY `keyName` (`keyName`);
--
-- Indizes für die Tabelle `log`
--
ALTER TABLE `log`
ADD PRIMARY KEY (`id`),
ADD KEY `id_user` (`id_user`);
--
-- Indizes für die Tabelle `manufacturers`
--
ALTER TABLE `manufacturers`
ADD PRIMARY KEY (`id`),
ADD KEY `manufacturers_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `orderdetails`
--
ALTER TABLE `orderdetails`
ADD PRIMARY KEY (`id`),
ADD KEY `orderdetails_part_id_k` (`part_id`),
ADD KEY `orderdetails_id_supplier_k` (`id_supplier`);
--
-- Indizes für die Tabelle `parts`
--
ALTER TABLE `parts`
ADD PRIMARY KEY (`id`),
ADD KEY `parts_id_category_k` (`id_category`),
ADD KEY `parts_id_footprint_k` (`id_footprint`),
ADD KEY `parts_id_storelocation_k` (`id_storelocation`),
ADD KEY `parts_order_orderdetails_id_k` (`order_orderdetails_id`),
ADD KEY `parts_id_manufacturer_k` (`id_manufacturer`),
ADD KEY `favorite` (`favorite`);
--
-- Indizes für die Tabelle `pricedetails`
--
ALTER TABLE `pricedetails`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `pricedetails_combination_uk` (`orderdetails_id`,`min_discount_quantity`),
ADD KEY `pricedetails_orderdetails_id_k` (`orderdetails_id`);
--
-- Indizes für die Tabelle `storelocations`
--
ALTER TABLE `storelocations`
ADD PRIMARY KEY (`id`),
ADD KEY `storelocations_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `suppliers`
--
ALTER TABLE `suppliers`
ADD PRIMARY KEY (`id`),
ADD KEY `suppliers_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- AUTO_INCREMENT für exportierte Tabellen
--
--
-- AUTO_INCREMENT für Tabelle `attachements`
--
ALTER TABLE `attachements`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=201;
--
-- AUTO_INCREMENT für Tabelle `attachement_types`
--
ALTER TABLE `attachement_types`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT für Tabelle `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=123;
--
-- AUTO_INCREMENT für Tabelle `devices`
--
ALTER TABLE `devices`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT für Tabelle `device_parts`
--
ALTER TABLE `device_parts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT für Tabelle `footprints`
--
ALTER TABLE `footprints`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=82;
--
-- AUTO_INCREMENT für Tabelle `groups`
--
ALTER TABLE `groups`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT für Tabelle `log`
--
ALTER TABLE `log`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=218;
--
-- AUTO_INCREMENT für Tabelle `manufacturers`
--
ALTER TABLE `manufacturers`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT für Tabelle `orderdetails`
--
ALTER TABLE `orderdetails`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=650;
--
-- AUTO_INCREMENT für Tabelle `parts`
--
ALTER TABLE `parts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1171;
--
-- AUTO_INCREMENT für Tabelle `pricedetails`
--
ALTER TABLE `pricedetails`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=437;
--
-- AUTO_INCREMENT für Tabelle `storelocations`
--
ALTER TABLE `storelocations`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=340;
--
-- AUTO_INCREMENT für Tabelle `suppliers`
--
ALTER TABLE `suppliers`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT für Tabelle `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Constraints der exportierten Tabellen
--
--
-- Constraints der Tabelle `attachements`
--
ALTER TABLE `attachements`
ADD CONSTRAINT `attachements_type_id_fk` FOREIGN KEY (`type_id`) REFERENCES `attachement_types` (`id`);
--
-- Constraints der Tabelle `attachement_types`
--
ALTER TABLE `attachement_types`
ADD CONSTRAINT `attachement_types_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `attachement_types` (`id`);
--
-- Constraints der Tabelle `categories`
--
ALTER TABLE `categories`
ADD CONSTRAINT `categories_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`);
--
-- Constraints der Tabelle `devices`
--
ALTER TABLE `devices`
ADD CONSTRAINT `devices_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `devices` (`id`);
--
-- Constraints der Tabelle `footprints`
--
ALTER TABLE `footprints`
ADD CONSTRAINT `footprints_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `footprints` (`id`);
--
-- Constraints der Tabelle `manufacturers`
--
ALTER TABLE `manufacturers`
ADD CONSTRAINT `manufacturers_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `manufacturers` (`id`);
--
-- Constraints der Tabelle `parts`
--
ALTER TABLE `parts`
ADD CONSTRAINT `parts_id_footprint_fk` FOREIGN KEY (`id_footprint`) REFERENCES `footprints` (`id`),
ADD CONSTRAINT `parts_id_manufacturer_fk` FOREIGN KEY (`id_manufacturer`) REFERENCES `manufacturers` (`id`),
ADD CONSTRAINT `parts_id_storelocation_fk` FOREIGN KEY (`id_storelocation`) REFERENCES `storelocations` (`id`),
ADD CONSTRAINT `parts_order_orderdetails_id_fk` FOREIGN KEY (`order_orderdetails_id`) REFERENCES `orderdetails` (`id`);
--
-- Constraints der Tabelle `storelocations`
--
ALTER TABLE `storelocations`
ADD CONSTRAINT `storelocations_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `storelocations` (`id`);
--
-- Constraints der Tabelle `suppliers`
--
ALTER TABLE `suppliers`
ADD CONSTRAINT `suppliers_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `suppliers` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@@ -0,0 +1,736 @@
-- phpMyAdmin SQL Dump
-- version 5.1.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Erstellungszeit: 07. Mai 2023 um 01:48
-- Server-Version: 10.6.5-MariaDB-log
-- PHP-Version: 8.1.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Datenbank: `partdb-legacy`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `attachements`
--
CREATE TABLE `attachements` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`class_name` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL,
`element_id` int(11) NOT NULL,
`type_id` int(11) NOT NULL,
`filename` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`show_in_table` tinyint(1) NOT NULL DEFAULT 0,
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `attachement_types`
--
CREATE TABLE `attachement_types` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `attachement_types`
--
INSERT INTO `attachement_types` (`id`, `name`, `parent_id`, `comment`, `datetime_added`, `last_modified`) VALUES
(1, 'Bilder', NULL, NULL, '2023-01-07 18:31:48', '0000-00-00 00:00:00'),
(2, 'Datenblätter', NULL, NULL, '2023-01-07 18:31:48', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `categories`
--
CREATE TABLE `categories` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`disable_footprints` tinyint(1) NOT NULL DEFAULT 0,
`disable_manufacturers` tinyint(1) NOT NULL DEFAULT 0,
`disable_autodatasheets` tinyint(1) NOT NULL DEFAULT 0,
`disable_properties` tinyint(1) NOT NULL DEFAULT 0,
`partname_regex` text COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
`partname_hint` text COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
`default_description` text COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
`default_comment` text COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '',
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `categories`
--
INSERT INTO `categories` (`id`, `name`, `parent_id`, `disable_footprints`, `disable_manufacturers`, `disable_autodatasheets`, `disable_properties`, `partname_regex`, `partname_hint`, `default_description`, `default_comment`, `comment`, `datetime_added`, `last_modified`) VALUES
(1, 'Test', NULL, 0, 0, 0, 0, '', '', '', '', '', '2023-01-07 18:32:29', '2023-01-07 18:32:29');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `devices`
--
CREATE TABLE `devices` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`order_quantity` int(11) NOT NULL DEFAULT 0,
`order_only_missing_parts` tinyint(1) NOT NULL DEFAULT 0,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `device_parts`
--
CREATE TABLE `device_parts` (
`id` int(11) NOT NULL,
`id_part` int(11) NOT NULL DEFAULT 0,
`id_device` int(11) NOT NULL DEFAULT 0,
`quantity` int(11) NOT NULL DEFAULT 0,
`mountnames` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `footprints`
--
CREATE TABLE `footprints` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`filename` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`filename_3d` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `groups`
--
CREATE TABLE `groups` (
`id` int(11) NOT NULL,
`name` varchar(32) NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`comment` mediumtext DEFAULT NULL,
`perms_system` int(11) NOT NULL,
`perms_groups` int(11) NOT NULL,
`perms_users` int(11) NOT NULL,
`perms_self` int(11) NOT NULL,
`perms_system_config` int(11) NOT NULL,
`perms_system_database` int(11) NOT NULL,
`perms_parts` bigint(11) NOT NULL,
`perms_parts_name` smallint(6) NOT NULL,
`perms_parts_description` smallint(6) NOT NULL,
`perms_parts_instock` smallint(6) NOT NULL,
`perms_parts_mininstock` smallint(6) NOT NULL,
`perms_parts_footprint` smallint(6) NOT NULL,
`perms_parts_storelocation` smallint(6) NOT NULL,
`perms_parts_manufacturer` smallint(6) NOT NULL,
`perms_parts_comment` smallint(6) NOT NULL,
`perms_parts_order` smallint(6) NOT NULL,
`perms_parts_orderdetails` smallint(6) NOT NULL,
`perms_parts_prices` smallint(6) NOT NULL,
`perms_parts_attachements` smallint(6) NOT NULL,
`perms_devices` int(11) NOT NULL,
`perms_devices_parts` int(11) NOT NULL,
`perms_storelocations` int(11) NOT NULL,
`perms_footprints` int(11) NOT NULL,
`perms_categories` int(11) NOT NULL,
`perms_suppliers` int(11) NOT NULL,
`perms_manufacturers` int(11) NOT NULL,
`perms_attachement_types` int(11) NOT NULL,
`perms_tools` int(11) NOT NULL,
`perms_labels` smallint(6) NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Daten für Tabelle `groups`
--
INSERT INTO `groups` (`id`, `name`, `parent_id`, `comment`, `perms_system`, `perms_groups`, `perms_users`, `perms_self`, `perms_system_config`, `perms_system_database`, `perms_parts`, `perms_parts_name`, `perms_parts_description`, `perms_parts_instock`, `perms_parts_mininstock`, `perms_parts_footprint`, `perms_parts_storelocation`, `perms_parts_manufacturer`, `perms_parts_comment`, `perms_parts_order`, `perms_parts_orderdetails`, `perms_parts_prices`, `perms_parts_attachements`, `perms_devices`, `perms_devices_parts`, `perms_storelocations`, `perms_footprints`, `perms_categories`, `perms_suppliers`, `perms_manufacturers`, `perms_attachement_types`, `perms_tools`, `perms_labels`, `datetime_added`, `last_modified`) VALUES
(1, 'admins', NULL, 'Users of this group can do everything: Read, Write and Administrative actions.', 21, 1365, 87381, 85, 85, 21, 1431655765, 5, 5, 5, 5, 5, 5, 5, 5, 5, 325, 325, 325, 5461, 325, 5461, 5461, 5461, 5461, 5461, 1365, 1365, 85, '2023-01-07 18:31:48', '0000-00-00 00:00:00'),
(2, 'readonly', NULL, 'Users of this group can only read informations, use tools, and don\'t have access to administrative tools.', 42, 2730, 174762, 154, 170, 42, -1516939607, 9, 9, 9, 9, 9, 9, 9, 9, 9, 649, 649, 649, 1705, 649, 1705, 1705, 1705, 1705, 1705, 681, 1366, 165, '2023-01-07 18:31:48', '0000-00-00 00:00:00'),
(3, 'users', NULL, 'Users of this group, can edit part informations, create new ones, etc. but are not allowed to use administrative tools. (But can read current configuration, and see Server status)', 42, 2730, 109226, 89, 105, 41, 1431655765, 5, 5, 5, 5, 5, 5, 5, 5, 5, 325, 325, 325, 5461, 325, 5461, 5461, 5461, 5461, 5461, 1365, 1365, 85, '2023-01-07 18:31:48', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `internal`
--
CREATE TABLE `internal` (
`keyName` char(30) CHARACTER SET ascii NOT NULL,
`keyValue` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `internal`
--
INSERT INTO `internal` (`keyName`, `keyValue`) VALUES
('dbVersion', '26');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `log`
--
CREATE TABLE `log` (
`id` int(11) NOT NULL,
`datetime` timestamp NOT NULL DEFAULT current_timestamp(),
`id_user` int(11) NOT NULL,
`level` tinyint(4) NOT NULL,
`type` smallint(6) NOT NULL,
`target_id` int(11) NOT NULL,
`target_type` smallint(6) NOT NULL,
`extra` mediumtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Daten für Tabelle `log`
--
INSERT INTO `log` (`id`, `datetime`, `id_user`, `level`, `type`, `target_id`, `target_type`, `extra`) VALUES
(1, '2023-01-07 18:31:48', 1, 4, 10, 0, 0, '{\"o\":0,\"n\":26,\"s\":true}'),
(2, '2023-01-07 18:32:13', 2, 6, 1, 2, 1, '{\"i\":\"::\"}'),
(3, '2023-01-07 18:32:29', 2, 6, 6, 1, 4, '[]'),
(4, '2023-01-07 18:32:53', 2, 6, 6, 1, 12, '[]'),
(5, '2023-01-07 18:33:26', 2, 6, 6, 1, 10, '{\"i\":0}');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `manufacturers`
--
CREATE TABLE `manufacturers` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`address` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`phone_number` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`fax_number` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`email_address` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`website` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`auto_product_url` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `orderdetails`
--
CREATE TABLE `orderdetails` (
`id` int(11) NOT NULL,
`part_id` int(11) NOT NULL,
`id_supplier` int(11) NOT NULL DEFAULT 0,
`supplierpartnr` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`obsolete` tinyint(1) DEFAULT 0,
`supplier_product_url` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `orderdetails`
--
INSERT INTO `orderdetails` (`id`, `part_id`, `id_supplier`, `supplierpartnr`, `obsolete`, `supplier_product_url`, `datetime_added`) VALUES
(1, 1, 1, 'BC547', 0, '', '2023-01-07 18:45:59'),
(2, 1, 1, 'Test', 0, '', '2023-01-07 18:46:09');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `parts`
--
CREATE TABLE `parts` (
`id` int(11) NOT NULL,
`id_category` int(11) NOT NULL DEFAULT 0,
`name` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`description` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`instock` int(11) NOT NULL DEFAULT 0,
`mininstock` int(11) NOT NULL DEFAULT 0,
`comment` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`visible` tinyint(1) NOT NULL,
`id_footprint` int(11) DEFAULT NULL,
`id_storelocation` int(11) DEFAULT NULL,
`order_orderdetails_id` int(11) DEFAULT NULL,
`order_quantity` int(11) NOT NULL DEFAULT 1,
`manual_order` tinyint(1) NOT NULL DEFAULT 0,
`id_manufacturer` int(11) DEFAULT NULL,
`id_master_picture_attachement` int(11) DEFAULT NULL,
`manufacturer_product_url` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`favorite` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `parts`
--
INSERT INTO `parts` (`id`, `id_category`, `name`, `description`, `instock`, `mininstock`, `comment`, `visible`, `id_footprint`, `id_storelocation`, `order_orderdetails_id`, `order_quantity`, `manual_order`, `id_manufacturer`, `id_master_picture_attachement`, `manufacturer_product_url`, `datetime_added`, `last_modified`, `favorite`) VALUES
(1, 1, 'BC547', '', 0, 0, '', 0, NULL, NULL, NULL, 1, 0, NULL, NULL, '', '2023-01-07 18:33:26', '2023-01-07 18:33:26', 0);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `pricedetails`
--
CREATE TABLE `pricedetails` (
`id` int(11) NOT NULL,
`orderdetails_id` int(11) NOT NULL,
`price` decimal(11,5) DEFAULT NULL,
`price_related_quantity` int(11) NOT NULL DEFAULT 1,
`min_discount_quantity` int(11) NOT NULL DEFAULT 1,
`manual_input` tinyint(1) NOT NULL DEFAULT 1,
`last_modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `pricedetails`
--
INSERT INTO `pricedetails` (`id`, `orderdetails_id`, `price`, `price_related_quantity`, `min_discount_quantity`, `manual_input`, `last_modified`) VALUES
(1, 2, '3.55000', 1, 1, 1, '2023-01-07 18:46:19');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `storelocations`
--
CREATE TABLE `storelocations` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`is_full` tinyint(1) NOT NULL DEFAULT 0,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `suppliers`
--
CREATE TABLE `suppliers` (
`id` int(11) NOT NULL,
`name` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`address` mediumtext COLLATE utf8mb3_unicode_ci NOT NULL,
`phone_number` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`fax_number` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`email_address` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`website` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`auto_product_url` tinytext COLLATE utf8mb3_unicode_ci NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`comment` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
--
-- Daten für Tabelle `suppliers`
--
INSERT INTO `suppliers` (`id`, `name`, `parent_id`, `address`, `phone_number`, `fax_number`, `email_address`, `website`, `auto_product_url`, `datetime_added`, `comment`, `last_modified`) VALUES
(1, 'Reichelt', NULL, '', '', '', '', '', '', '2023-01-07 18:32:53', '', '2023-01-07 18:32:53');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(32) NOT NULL,
`password` varchar(255) DEFAULT NULL,
`first_name` tinytext DEFAULT NULL,
`last_name` tinytext DEFAULT NULL,
`department` tinytext DEFAULT NULL,
`email` tinytext DEFAULT NULL,
`need_pw_change` tinyint(1) NOT NULL DEFAULT 0,
`group_id` int(11) DEFAULT NULL,
`config_language` tinytext DEFAULT NULL,
`config_timezone` tinytext DEFAULT NULL,
`config_theme` tinytext DEFAULT NULL,
`config_currency` tinytext DEFAULT NULL,
`config_image_path` text NOT NULL,
`config_instock_comment_w` text NOT NULL,
`config_instock_comment_a` text NOT NULL,
`perms_system` int(11) NOT NULL,
`perms_groups` int(11) NOT NULL,
`perms_users` int(11) NOT NULL,
`perms_self` int(11) NOT NULL,
`perms_system_config` int(11) NOT NULL,
`perms_system_database` int(11) NOT NULL,
`perms_parts` bigint(11) NOT NULL,
`perms_parts_name` smallint(6) NOT NULL,
`perms_parts_description` smallint(6) NOT NULL,
`perms_parts_instock` smallint(6) NOT NULL,
`perms_parts_mininstock` smallint(6) NOT NULL,
`perms_parts_footprint` smallint(6) NOT NULL,
`perms_parts_storelocation` smallint(6) NOT NULL,
`perms_parts_manufacturer` smallint(6) NOT NULL,
`perms_parts_comment` smallint(6) NOT NULL,
`perms_parts_order` smallint(6) NOT NULL,
`perms_parts_orderdetails` smallint(6) NOT NULL,
`perms_parts_prices` smallint(6) NOT NULL,
`perms_parts_attachements` smallint(6) NOT NULL,
`perms_devices` int(11) NOT NULL,
`perms_devices_parts` int(11) NOT NULL,
`perms_storelocations` int(11) NOT NULL,
`perms_footprints` int(11) NOT NULL,
`perms_categories` int(11) NOT NULL,
`perms_suppliers` int(11) NOT NULL,
`perms_manufacturers` int(11) NOT NULL,
`perms_attachement_types` int(11) NOT NULL,
`perms_tools` int(11) NOT NULL,
`perms_labels` smallint(6) NOT NULL,
`datetime_added` timestamp NOT NULL DEFAULT current_timestamp(),
`last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Daten für Tabelle `users`
--
INSERT INTO `users` (`id`, `name`, `password`, `first_name`, `last_name`, `department`, `email`, `need_pw_change`, `group_id`, `config_language`, `config_timezone`, `config_theme`, `config_currency`, `config_image_path`, `config_instock_comment_w`, `config_instock_comment_a`, `perms_system`, `perms_groups`, `perms_users`, `perms_self`, `perms_system_config`, `perms_system_database`, `perms_parts`, `perms_parts_name`, `perms_parts_description`, `perms_parts_instock`, `perms_parts_mininstock`, `perms_parts_footprint`, `perms_parts_storelocation`, `perms_parts_manufacturer`, `perms_parts_comment`, `perms_parts_order`, `perms_parts_orderdetails`, `perms_parts_prices`, `perms_parts_attachements`, `perms_devices`, `perms_devices_parts`, `perms_storelocations`, `perms_footprints`, `perms_categories`, `perms_suppliers`, `perms_manufacturers`, `perms_attachement_types`, `perms_tools`, `perms_labels`, `datetime_added`, `last_modified`) VALUES
(1, 'anonymous', '', '', '', '', '', 0, 2, NULL, NULL, NULL, NULL, '', '', '', 21844, 20480, 0, 0, 0, 0, 0, 21840, 21840, 21840, 21840, 21840, 21840, 21840, 21840, 21840, 21520, 21520, 21520, 20480, 21520, 20480, 20480, 20480, 20480, 20480, 21504, 20480, 0, '2023-01-07 18:31:48', '0000-00-00 00:00:00'),
(2, 'admin', '$2a$12$j0RKrKlx60bzX1DWMyXwjeaW.pe3bFjAK8ByIGnvjrRnET2JtsFoe$2a$12$j0RKrKlx60bzX1DWMyXwjeaW.pe3bFjAK8ByIGnvjrRnET2JtsFoe', '', '', '', '', 1, 1, NULL, NULL, NULL, NULL, '', '', '', 21845, 21845, 21845, 21, 85, 21, 349525, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 21845, 0, '2023-01-07 18:31:48', '0000-00-00 00:00:00');
--
-- Indizes der exportierten Tabellen
--
--
-- Indizes für die Tabelle `attachements`
--
ALTER TABLE `attachements`
ADD PRIMARY KEY (`id`),
ADD KEY `attachements_class_name_k` (`class_name`),
ADD KEY `attachements_element_id_k` (`element_id`),
ADD KEY `attachements_type_id_fk` (`type_id`);
--
-- Indizes für die Tabelle `attachement_types`
--
ALTER TABLE `attachement_types`
ADD PRIMARY KEY (`id`),
ADD KEY `attachement_types_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`),
ADD KEY `categories_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `devices`
--
ALTER TABLE `devices`
ADD PRIMARY KEY (`id`),
ADD KEY `devices_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `device_parts`
--
ALTER TABLE `device_parts`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `device_parts_combination_uk` (`id_part`,`id_device`),
ADD KEY `device_parts_id_part_k` (`id_part`),
ADD KEY `device_parts_id_device_k` (`id_device`);
--
-- Indizes für die Tabelle `footprints`
--
ALTER TABLE `footprints`
ADD PRIMARY KEY (`id`),
ADD KEY `footprints_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `groups`
--
ALTER TABLE `groups`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indizes für die Tabelle `internal`
--
ALTER TABLE `internal`
ADD UNIQUE KEY `keyName` (`keyName`);
--
-- Indizes für die Tabelle `log`
--
ALTER TABLE `log`
ADD PRIMARY KEY (`id`),
ADD KEY `id_user` (`id_user`);
--
-- Indizes für die Tabelle `manufacturers`
--
ALTER TABLE `manufacturers`
ADD PRIMARY KEY (`id`),
ADD KEY `manufacturers_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `orderdetails`
--
ALTER TABLE `orderdetails`
ADD PRIMARY KEY (`id`),
ADD KEY `orderdetails_part_id_k` (`part_id`),
ADD KEY `orderdetails_id_supplier_k` (`id_supplier`);
--
-- Indizes für die Tabelle `parts`
--
ALTER TABLE `parts`
ADD PRIMARY KEY (`id`),
ADD KEY `parts_id_category_k` (`id_category`),
ADD KEY `parts_id_footprint_k` (`id_footprint`),
ADD KEY `parts_id_storelocation_k` (`id_storelocation`),
ADD KEY `parts_order_orderdetails_id_k` (`order_orderdetails_id`),
ADD KEY `parts_id_manufacturer_k` (`id_manufacturer`),
ADD KEY `favorite` (`favorite`);
--
-- Indizes für die Tabelle `pricedetails`
--
ALTER TABLE `pricedetails`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `pricedetails_combination_uk` (`orderdetails_id`,`min_discount_quantity`),
ADD KEY `pricedetails_orderdetails_id_k` (`orderdetails_id`);
--
-- Indizes für die Tabelle `storelocations`
--
ALTER TABLE `storelocations`
ADD PRIMARY KEY (`id`),
ADD KEY `storelocations_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `suppliers`
--
ALTER TABLE `suppliers`
ADD PRIMARY KEY (`id`),
ADD KEY `suppliers_parent_id_k` (`parent_id`);
--
-- Indizes für die Tabelle `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- AUTO_INCREMENT für exportierte Tabellen
--
--
-- AUTO_INCREMENT für Tabelle `attachements`
--
ALTER TABLE `attachements`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `attachement_types`
--
ALTER TABLE `attachement_types`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT für Tabelle `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT für Tabelle `devices`
--
ALTER TABLE `devices`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `device_parts`
--
ALTER TABLE `device_parts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `footprints`
--
ALTER TABLE `footprints`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `groups`
--
ALTER TABLE `groups`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT für Tabelle `log`
--
ALTER TABLE `log`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT für Tabelle `manufacturers`
--
ALTER TABLE `manufacturers`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `orderdetails`
--
ALTER TABLE `orderdetails`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT für Tabelle `parts`
--
ALTER TABLE `parts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT für Tabelle `pricedetails`
--
ALTER TABLE `pricedetails`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT für Tabelle `storelocations`
--
ALTER TABLE `storelocations`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `suppliers`
--
ALTER TABLE `suppliers`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT für Tabelle `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Constraints der exportierten Tabellen
--
--
-- Constraints der Tabelle `attachements`
--
ALTER TABLE `attachements`
ADD CONSTRAINT `attachements_type_id_fk` FOREIGN KEY (`type_id`) REFERENCES `attachement_types` (`id`);
--
-- Constraints der Tabelle `attachement_types`
--
ALTER TABLE `attachement_types`
ADD CONSTRAINT `attachement_types_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `attachement_types` (`id`);
--
-- Constraints der Tabelle `categories`
--
ALTER TABLE `categories`
ADD CONSTRAINT `categories_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`);
--
-- Constraints der Tabelle `devices`
--
ALTER TABLE `devices`
ADD CONSTRAINT `devices_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `devices` (`id`);
--
-- Constraints der Tabelle `footprints`
--
ALTER TABLE `footprints`
ADD CONSTRAINT `footprints_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `footprints` (`id`);
--
-- Constraints der Tabelle `manufacturers`
--
ALTER TABLE `manufacturers`
ADD CONSTRAINT `manufacturers_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `manufacturers` (`id`);
--
-- Constraints der Tabelle `parts`
--
ALTER TABLE `parts`
ADD CONSTRAINT `parts_id_footprint_fk` FOREIGN KEY (`id_footprint`) REFERENCES `footprints` (`id`),
ADD CONSTRAINT `parts_id_manufacturer_fk` FOREIGN KEY (`id_manufacturer`) REFERENCES `manufacturers` (`id`),
ADD CONSTRAINT `parts_id_storelocation_fk` FOREIGN KEY (`id_storelocation`) REFERENCES `storelocations` (`id`),
ADD CONSTRAINT `parts_order_orderdetails_id_fk` FOREIGN KEY (`order_orderdetails_id`) REFERENCES `orderdetails` (`id`);
--
-- Constraints der Tabelle `storelocations`
--
ALTER TABLE `storelocations`
ADD CONSTRAINT `storelocations_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `storelocations` (`id`);
--
-- Constraints der Tabelle `suppliers`
--
ALTER TABLE `suppliers`
ADD CONSTRAINT `suppliers_parent_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `suppliers` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@@ -0,0 +1,54 @@
#
# This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
#
# Copyright (C) 2019 - 2023 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/>.
#
#!/bin/bash
# This script is used to test the legacy import of Part-DB
SQL_FILES_TO_TEST=("db_minimal.sql" "db_jbtronics.sql")
DB_NAME="legacy_db_test"
DB_USER="root"
DB_PASSWORD="root"
# Iterate over all given SQL files and import them into the mysql database with the given name, drop the database if it already exists before
for SQL_FILE in "${SQL_FILES_TO_TEST[@]}"
do
echo "Testing for $SQL_FILE"
mysql -u $DB_USER --password=$DB_PASSWORD -e "DROP DATABASE IF EXISTS $DB_NAME; CREATE DATABASE $DB_NAME;"
# If the last command failed, exit the script
if [ $? -ne 0 ]; then
echo "Failed to create database $DB_NAME"
exit 1
fi
# Import the SQL file into the database. The file pathes are relative to the current script location
mysql -u $DB_USER --password=$DB_PASSWORD $DB_NAME < .github/assets/legacy_import/$SQL_FILE
# If the last command failed, exit the script
if [ $? -ne 0 ]; then
echo "Failed to import $SQL_FILE into database $DB_NAME"
exit 1
fi
# Run doctrine migrations, this will migrate the database to the current version. This process should not fail
php bin/console doctrine:migrations:migrate -n
# If the last command failed, exit the script
if [ $? -ne 0 ]; then
echo "Failed to migrate database $DB_NAME"
exit 1
fi
done

View File

@@ -19,7 +19,15 @@ jobs:
APP_ENV: prod
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
ini-values: xdebug.max_nesting_level=1000
extensions: mbstring, intl, gd, xsl, gmp, bcmath
- name: Get Composer Cache Directory
id: composer-cache

View File

@@ -1,54 +0,0 @@
name: "CodeQL"
on:
push:
branches: [master, ]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 14 * * 3'
jobs:
analyse:
name: Analyse
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@@ -17,11 +17,11 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
@@ -49,23 +49,23 @@ jobs:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64,arm'
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7

View File

@@ -16,7 +16,15 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
ini-values: xdebug.max_nesting_level=1000
extensions: mbstring, intl, gd, xsl, gmp, bcmath
- name: Get Composer Cache Directory
id: composer-cache
@@ -38,18 +46,20 @@ jobs:
- name: Lint twig templates
run: ./bin/console lint:twig templates --env=prod
- name: Lint translations
run: ./bin/console lint:xliff translations
# This causes problems with emtpy language files
#- name: Lint translations
# run: ./bin/console lint:xliff translations
- name: Check dependencies for security
uses: symfonycorp/security-checker-action@v5
- name: Check doctrine mapping
run: ./bin/console doctrine:schema:validate --skip-sync -vvv --no-interaction
# Use the -d option to raise the max nesting level
- name: Generate dev container
run: ./bin/console cache:clear --env dev
run: php -d xdebug.max_nesting_level=1000 ./bin/console cache:clear --env dev
- name: Run PHPstan
run: composer phpstan

View File

@@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
php-versions: [ '7.4', '8.0', '8.1', '8.2' ]
php-versions: [ '8.1', '8.2' ]
db-type: [ 'mysql', 'sqlite' ]
env:
@@ -38,13 +38,14 @@ jobs:
if: matrix.db-type == 'sqlite'
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: pcov
ini-values: xdebug.max_nesting_level=1000
extensions: mbstring, intl, gd, xsl, gmp, bcmath
- name: Start MySQL
@@ -109,7 +110,7 @@ jobs:
run: php bin/console --env test doctrine:migrations:migrate -n
- name: Load fixtures
run: php bin/console --env test doctrine:fixtures:load -n --purger reset_autoincrement_purger
run: php bin/console --env test doctrine:fixtures:load -n
- name: Run PHPunit and generate coverage
run: ./bin/phpunit --coverage-clover=coverage.xml
@@ -118,6 +119,8 @@ jobs:
uses: codecov/codecov-action@v3
with:
env_vars: PHP_VERSION,DB_TYPE
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- name: Test app:clean-attachments
run: php bin/console partdb:attachments:clean-unused -n
@@ -130,4 +133,12 @@ jobs:
- name: Test check-requirements command
run: php bin/console partdb:check-requirements -n
- name: Test legacy Part-DB import
run: bash .github/assets/legacy_import/test_legacy_import.sh
if: matrix.db-type == 'mysql' && matrix.php-versions == '8.2'
env:
DATABASE_URL: mysql://root:root@localhost:3306/legacy_db

4
.gitignore vendored
View File

@@ -43,3 +43,7 @@ yarn-error.log
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###

View File

@@ -34,12 +34,25 @@ RUN sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
ln -sfT /dev/stderr /var/log/php8.1-fpm.log; \
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR";
# Enable php-fpm
RUN a2enmod proxy_fcgi setenvif && a2enconf php8.1-fpm
# Configure php-fpm to log to stdout of the container (stdout of PID 1)
# We have to use /proc/1/fd/1 because /dev/stdout or /proc/self/fd/1 does not point to the container stdout (because we use apache as entrypoint)
# We also disable the clear_env option to allow the use of environment variables in php-fpm
RUN { \
echo '[global]'; \
echo 'error_log = /proc/1/fd/1'; \
echo; \
echo '[www]'; \
echo 'access.log = /proc/1/fd/1'; \
echo 'catch_workers_output = yes'; \
echo 'decorate_workers_output = no'; \
echo 'clear_env = no'; \
} | tee "/etc/php/8.1/fpm/pool.d/zz-docker.conf"
# PHP files should be handled by PHP, and should be preferred over any other file type
RUN { \
echo '<FilesMatch \.php$>'; \

131
README.md
View File

@@ -1,9 +1,9 @@
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Part-DB/Part-DB-symfony/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Part-DB/Part-DB-symfony/?branch=master)
![PHPUnit Tests](https://github.com/Part-DB/Part-DB-symfony/workflows/PHPUnit%20Tests/badge.svg)
![Static analysis](https://github.com/Part-DB/Part-DB-symfony/workflows/Static%20analysis/badge.svg)
[![codecov](https://codecov.io/gh/Part-DB/Part-DB-symfony/branch/master/graph/badge.svg)](https://codecov.io/gh/Part-DB/Part-DB-server)
[![codecov](https://codecov.io/gh/Part-DB/Part-DB-server/branch/master/graph/badge.svg)](https://codecov.io/gh/Part-DB/Part-DB-server)
![GitHub License](https://img.shields.io/github/license/Part-DB/Part-DB-symfony)
![PHP Version](https://img.shields.io/badge/PHP-%3E%3D%207.4-green)
![PHP Version](https://img.shields.io/badge/PHP-%3E%3D%208.1-green)
![Docker Pulls](https://img.shields.io/docker/pulls/jbtronics/part-db1)
![Docker Build Status](https://github.com/Part-DB/Part-DB-symfony/workflows/Docker%20Image%20Build/badge.svg)
@@ -12,46 +12,57 @@
**[Documentation](https://docs.part-db.de/)** | **[Demo](https://part-db.herokuapp.com)** | **[Docker Image](https://hub.docker.com/r/jbtronics/part-db1)**
# Part-DB
Part-DB is an Open-Source inventory managment system for your electronic components.
Part-DB is an Open-Source inventory management system for your electronic components.
It is installed on a web server and so can be accessed with any browser without the need to install additional software.
The version in this Repository is a complete rewrite of the legacy [Part-DB](https://github.com/Part-DB/Part-DB) (Version < 1.0) based on a modern framework.
Currently, it is still missing some (minor) features from the old version (see [UPGRADE.md](https://docs.part-db.de/upgrade_legacy.html)) for more details, but also many huge improvements and advantages compared to the old version.
If you start completely new with Part-DB it is recommended that you use the version from this repository, as it is actively developed.
The version in this repository is a complete rewrite of the legacy [Part-DB](https://github.com/Part-DB/Part-DB)
(Version < 1.0) based on a modern framework and is the recommended version to use.
If you find a bug, please open an [Issue on Github](https://github.com/Part-DB/Part-DB-server/issues) so it can be fixed for everybody.
If you find a bug, please open an [Issue on GitHub,](https://github.com/Part-DB/Part-DB-server/issues) so it can be fixed
for everybody.
## Demo
If you want to test Part-DB without installing it, you can use [this](https://part-db.herokuapp.com) Heroku instance.
(Or this link for the [German Version](https://part-db.herokuapp.com/de/)).
If you want to test Part-DB without installing it, you can use [this](https://part-db.herokuapp.com) Heroku instance.
(Or this link for the [German Version](https://part-db.herokuapp.com/de/)).
You can log in with username: *user* and password: *user*.
Every change to the master branch gets automatically deployed, so it represents the current development progress and is
maybe not completely stable. Please mind, that the free Heroku instance is used, so it can take some time when loading the page
maybe not completely stable. Please mind, that the free Heroku instance is used, so it can take some time when loading
the page
for the first time.
<img src="https://github.com/Part-DB/Part-DB-server/raw/master/docs/assets/readme/part_info.png">
<img src="https://github.com/Part-DB/Part-DB-server/raw/master/docs/assets/readme/parts_list.png">
## Features
* Inventory management of your electronic parts. Each part can be assigned to a category, footprint, manufacturer
and multiple store locations and price information. Parts can be grouped using tags. You can associate various files like datasheets or pictures with the parts.
* Inventory management of your electronic parts. Each part can be assigned to a category, footprint, manufacturer
and multiple store locations and price information. Parts can be grouped using tags. You can associate various files
like datasheets or pictures with the parts.
* Multi-Language support (currently German, English, Russian, Japanese and French (experimental))
* Barcodes/Labels generator for parts and storage locations, scan barcodes via webcam using the builtin barcode scanner
* User system with groups and detailed (fine granular) permissions.
Two-factor authentication is supported (Google Authenticator and Webauthn/U2F keys) and can be enforced for groups. Password reset via email can be setuped.
* Optional support for single sign-on (SSO) via SAML (using an intermediate service like [Keycloak](https://www.keycloak.org/) you can connect Part-DB to an existing LDAP or Active Directory server)
* User system with groups and detailed (fine granular) permissions.
Two-factor authentication is supported (Google Authenticator and Webauthn/U2F keys) and can be enforced for groups.
Password reset via email can be setup.
* Optional support for single sign-on (SSO) via SAML (using an intermediate service
like [Keycloak](https://www.keycloak.org/) you can connect Part-DB to an existing LDAP or Active Directory server)
* Import/Export system for parts and datastructure. BOM import for projects from KiCAD is supported.
* Project management: Create projects and assign parts to the bill of material (BOM), to show how often you could build this project and directly withdraw all components needed from DB
* Event log: Track what changes happens to your inventory, track which user does what. Revert your parts to older versions.
* Project management: Create projects and assign parts to the bill of material (BOM), to show how often you could build
this project and directly withdraw all components needed from DB
* Event log: Track what changes happens to your inventory, track which user does what. Revert your parts to older
versions.
* Responsive design: You can use Part-DB on your PC, your tablet and your smartphone using the same interface.
* MySQL and SQLite supported as database backends
* Support for rich text descriptions and comments in parts
* Support for multiple currencies and automatic update of exchange rates supported
* Powerful search and filter function, including parametric search (search for parts according to some specifications)
* Automatic thumbnail generation for pictures
* Use cloud providers (like Octopart, Digikey, farnell or TME) to automatically get part information, datasheets and
prices for parts
* API to access Part-DB from other applications/scripts
With these features Part-DB is useful to hobbyists, who want to keep track of their private electronic parts inventory,
or makerspaces, where many users have should have (controlled) access to the shared inventory.
@@ -59,69 +70,97 @@ or makerspaces, where many users have should have (controlled) access to the sha
Part-DB is also used by small companies and universities for managing their inventory.
## 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.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.
* 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 8.1**
* 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** (>= 18.0) is needed.
## Installation
If you want to upgrade your legacy (< 1.0.0) version of Part-DB to this version, please read [this](https://docs.part-db.de/upgrade_legacy.html) first.
*Hint:* A docker image is available under [jbtronics/part-db1](https://hub.docker.com/r/jbtronics/part-db1). How to set up Part-DB via docker is described [here](https://docs.part-db.de/installation/installation_docker.html).
If you want to upgrade your legacy (< 1.0.0) version of Part-DB to this version, please
read [this](https://docs.part-db.de/upgrade_legacy.html) first.
**Below you find some very rough outline of the installation process, see [here](https://docs.part-db.de/installation/) for a detailed guide how to install Part-DB.**
*Hint:* A docker image is available under [jbtronics/part-db1](https://hub.docker.com/r/jbtronics/part-db1). How to set
up Part-DB via docker is described [here](https://docs.part-db.de/installation/installation_docker.html).
**Below you find some very rough outline of the installation process, see [here](https://docs.part-db.de/installation/)
for a detailed guide how to install Part-DB.**
1. Copy or clone this repository into a folder on your server.
2. Configure your webserver to serve from the `public/` folder. See [here](https://symfony.com/doc/current/setup/web_server_configuration.html)
for additional information.
2. Configure your webserver to serve from the `public/` folder.
See [here](https://symfony.com/doc/current/setup/web_server_configuration.html)
for additional information.
3. Copy the global config file `cp .env .env.local` and edit `.env.local`:
* Change the line `APP_ENV=dev` to `APP_ENV=prod`
* If you do not want to use SQLite, change the value of `DATABASE_URL=` to your needs (see [here](http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url)) for the format.
In bigger instances with concurrent accesses, MySQL is more performant. This can not be changed easily later, so choose wisely.
* If you do not want to use SQLite, change the value of `DATABASE_URL=` to your needs (
see [here](http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url))
for the format.
In bigger instances with concurrent accesses, MySQL is more performant. This can not be changed easily later, so
choose wisely.
4. Install composer dependencies and generate autoload files: `composer install -o --no-dev`
5. If you have put Part-DB into a sub-directory on your server (like `part-db/`), you have to edit the file
`webpack.config.js` and uncomment the lines (remove the `//` before the lines) `.setPublicPath('/part-db/build')` (line 43) and
`.setManifestKeyPrefix('build/')` (line 44). You have to replace `/part-db` with your own path on line 44.
5. If you have put Part-DB into a subdirectory on your server (like `part-db/`), you have to edit the file
`webpack.config.js` and uncomment the lines (remove the `//` before the lines) `.setPublicPath('/part-db/build')` (
line 43) and
`.setManifestKeyPrefix('build/')` (line 44). You have to replace `/part-db` with your own path on line 44.
6. Install client side dependencies and build it: `yarn install` and `yarn build`
7. _Optional_ (speeds up first load): Warmup cache: `php bin/console cache:warmup`
8. Upgrade database to new scheme (or create it, when it was empty): `php bin/console doctrine:migrations:migrate` and follow the instructions given. During the process the password for the admin is user is shown. Copy it. **Caution**: This steps tamper with your database and could potentially destroy it. So make sure to make a backup of your database.
9. You can configure Part-DB via `config/parameters.yaml`. You should check if settings match your expectations, after you installed/upgraded Part-DB. Check if `partdb.default_currency` matches your mainly used currency (this can not be changed after creating price informations).
8. Upgrade database to new scheme (or create it, when it was empty): `php bin/console doctrine:migrations:migrate` and
follow the instructions given. During the process the password for the admin is user is shown. Copy it. **Caution**:
This steps tamper with your database and could potentially destroy it. So make sure to make a backup of your
database.
9. You can configure Part-DB via `config/parameters.yaml`. You should check if settings match your expectations, after
you installed/upgraded Part-DB. Check if `partdb.default_currency` matches your mainly used currency (this can not be
changed after creating price information).
Run `php bin/console cache:clear` when you changed something.
10. Access Part-DB in your browser (under the URL you put it) and login with user *admin*. Password is the one outputted during DB setup.
If you can not remember the password, set a new one with `php bin/console app:set-password admin`. You can create new users with the admin user and start using Part-DB.
10. Access Part-DB in your browser (under the URL you put it) and login with user *admin*. Password is the one outputted
during DB setup.
If you can not remember the password, set a new one with `php bin/console app:set-password admin`. You can create
new users with the admin user and start using Part-DB.
When you want to upgrade to a newer version, then just copy the new files into the folder
and repeat the steps 4. to 7.
Normally a random password is generated when the admin user is created during inital database creation,
however you can set the inital admin password, by setting the `INITIAL_ADMIN_PW` env var.
Normally a random password is generated when the admin user is created during initial database creation,
however you can set the initial admin password, by setting the `INITIAL_ADMIN_PW` env var.
You can configure Part-DB to your needs by changing environment variables in the `.env.local` file.
You can configure Part-DB to your needs by changing environment variables in the `.env.local` file.
See [here](https://docs.part-db.de/configuration.html) for more information.
### Reverse proxy
If you are using a reverse proxy, you have to ensure that the proxies sets the `X-Forwarded-*` headers correctly, or you will get HTTP/HTTPS mixup and wrong hostnames.
If the reverse proxy is on a different server (or it cannot access Part-DB via localhost) you have to set the `TRUSTED_PROXIES` env variable to match your reverse proxies IP-address (or IP block). You can do this in your `.env.local` or (when using docker) in your `docker-compose.yml` file.
If you are using a reverse proxy, you have to ensure that the proxies sets the `X-Forwarded-*` headers correctly, or you
will get HTTP/HTTPS mixup and wrong hostnames.
If the reverse proxy is on a different server (or it cannot access Part-DB via localhost) you have to set
the `TRUSTED_PROXIES` env variable to match your reverse proxies IP-address (or IP block). You can do this in
your `.env.local` or (when using docker) in your `docker-compose.yml` file.
## Donate for development
If you want to donate to the Part-DB developer, see the sponsor button in the top bar (next to the repo name).
There you will find various methods to support development on a monthly or a one time base.
## Built with
* [Symfony 5](https://symfony.com/): The main framework used for the serverside PHP
* [Bootstrap 5](https://getbootstrap.com/) and [Bootswatch](https://bootswatch.com/): Used as website theme
* [Fontawesome](https://fontawesome.com/): Used as icon set
* [Hotwire Stimulus](https://stimulus.hotwired.dev/) and [Hotwire Turbo](https://turbo.hotwired.dev/): Frontend Javascript
* [Hotwire Stimulus](https://stimulus.hotwired.dev/) and [Hotwire Turbo](https://turbo.hotwired.dev/): Frontend
Javascript
## Authors
* **Jan Böhmer** - *Inital work* - [Github](https://github.com/jbtronics/)
See also the list of [contributors](https://github.com/Part-DB/Part-DB-server/graphs/contributors) who participated in this project.
* **Jan Böhmer** - *Initial work* - [GitHub](https://github.com/jbtronics/)
See also the list of [contributors](https://github.com/Part-DB/Part-DB-server/graphs/contributors) who participated in
this project.
Based on the original Part-DB by Christoph Lechner and K. Jacobs
## License
Part-DB is licensed under the GNU Affero General Public License v3.0 (or at your opinion any later).
This mostly means that you can use Part-DB for whatever you want (even use it commercially)
as long as you publish the source code for every change you make under the AGPL, too.

View File

@@ -1 +1 @@
1.3.1
1.8.2

3
assets/bootstrap.js vendored
View File

@@ -4,8 +4,7 @@ import { startStimulusApp } from '@symfony/stimulus-bridge';
export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true,
/\.(j|t)sx?$/
/\.[jt]sx?$/
));
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);

View File

@@ -181,7 +181,8 @@ Editor.defaultConfig = {
'DejaVu Serif, serif',
'Helvetica, Arial, sans-serif',
'Times New Roman, Times, serif',
'Courier New, Courier, monospace'
'Courier New, Courier, monospace',
'Unifont, monospace',
],
supportAllValues: true
},

View File

@@ -76,6 +76,7 @@ const PLACEHOLDERS = [
['[[FOOTPRINT_FULL]]', 'Footprint (Full path)'],
['[[MASS]]', 'Mass'],
['[[MPN]]', 'Manufacturer Product Number (MPN)'],
['[[IPN]]', 'Internal Part Number (IPN)'],
['[[TAGS]]', 'Tags'],
['[[M_STATUS]]', 'Manufacturing status'],
['[[DESCRIPTION]]', 'Description'],

View File

@@ -39,6 +39,7 @@ Object.assign( window.CKEDITOR_TRANSLATIONS[ 'de' ].dictionary, {
'Footprint (Full path)': 'Footprint (Vollständiger Pfad)',
'Mass': 'Gewicht',
'Manufacturer Product Number (MPN)': 'Hersteller Produktnummer (MPN)',
'Internal Part Number (IPN)': 'Internal Part Number (IPN)',
'Tags': 'Tags',
'Manufacturing status': 'Herstellungsstatus',
'Description': 'Beschreibung',

View File

@@ -18,43 +18,118 @@
*/
import {Controller} from "@hotwired/stimulus";
import Darkmode from "darkmode-js/src";
import "darkmode-js"
export default class extends Controller {
_darkmode;
connect() {
if (typeof window.getComputedStyle(document.body).mixBlendMode == 'undefined') {
console.warn("The browser does not support mix blend mode. Darkmode will not work.");
this.setMode(this.getMode());
document.querySelectorAll('input[name="darkmode"]').forEach((radio) => {
radio.addEventListener('change', this._radioChanged.bind(this));
});
}
/**
* Event listener for the change of radio buttons
* @private
*/
_radioChanged(event) {
const new_mode = this.getSelectedMode();
this.setMode(new_mode);
}
/**
* Get the current mode from the local storage
* @return {'dark', 'light', 'auto'}
*/
getMode() {
return localStorage.getItem('darkmode') ?? 'auto';
}
/**
* Set the mode in the local storage and apply it and change the state of the radio buttons
* @param mode
*/
setMode(mode) {
if (mode !== 'dark' && mode !== 'light' && mode !== 'auto') {
console.warn('Invalid darkmode mode: ' + mode);
mode = 'auto';
}
localStorage.setItem('darkmode', mode);
this.setButtonMode(mode);
if (mode === 'auto') {
this._setDarkmodeAuto();
} else if (mode === 'dark') {
this._enableDarkmode();
} else if (mode === 'light') {
this._disableDarkmode();
}
}
/**
* Get the selected mode via the radio buttons
* @return {'dark', 'light', 'auto'}
*/
getSelectedMode() {
return document.querySelector('input[name="darkmode"]:checked').value;
}
/**
* Set the state of the radio buttons
* @param mode
*/
setButtonMode(mode) {
document.querySelector('input[name="darkmode"][value="' + mode + '"]').checked = true;
}
/**
* Enable darkmode by adding the data-bs-theme="dark" to the html tag
* @private
*/
_enableDarkmode() {
//Add data-bs-theme="dark" to the html tag
document.documentElement.setAttribute('data-bs-theme', 'dark');
}
/**
* Disable darkmode by adding the data-bs-theme="light" to the html tag
* @private
*/
_disableDarkmode() {
//Set data-bs-theme to light
document.documentElement.setAttribute('data-bs-theme', 'light');
}
/**
* Set the darkmode to auto and enable/disable it depending on the system settings, also add
* an event listener to change the darkmode if the system settings change
* @private
*/
_setDarkmodeAuto() {
if (this.getMode() !== 'auto') {
return;
}
try {
const darkmode = new Darkmode();
this._darkmode = darkmode;
//Unhide darkmode button
this._showWidget();
//Set the switch according to our current darkmode state
const toggler = document.getElementById("toggleDarkmode");
toggler.checked = darkmode.isActivated();
}
catch (e)
{
console.error(e);
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
this._enableDarkmode();
} else {
this._disableDarkmode();
}
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
console.log('Prefered color scheme changed to ' + event.matches ? 'dark' : 'light');
this._setDarkmodeAuto();
});
}
_showWidget() {
this.element.classList.remove('hidden');
}
toggleDarkmode() {
this._darkmode.toggle();
/**
* Check if darkmode is activated
* @return {boolean}
*/
isDarkmodeActivated() {
return document.documentElement.getAttribute('data-bs-theme') === 'dark';
}
}

View File

@@ -21,6 +21,8 @@
import { Controller } from '@hotwired/stimulus';
import { marked } from "marked";
import { mangle } from "marked-mangle";
import { gfmHeadingId } from "marked-gfm-heading-id";
import DOMPurify from 'dompurify';
import "../../css/app/markdown.css";
@@ -81,6 +83,10 @@ export default class extends Controller {
*/
configureMarked()
{
marked.use(mangle());
marked.use(gfmHeadingId({
}));
marked.setOptions({
gfm: true,
});

View File

@@ -61,7 +61,7 @@ export default class extends Controller {
if(!prototype) {
console.warn("Prototype is not set, we cannot create a new element. This is most likely due to missing permissions.");
bootbox.alert("You do not have the permsissions to create a new element. (No protoype element is set)");
bootbox.alert("You do not have the permissions to create a new element. (No protoype element is set)");
return;
}

View File

@@ -65,12 +65,19 @@ export default class extends Controller {
localStorage.setItem( this.getStateSaveKey(), JSON.stringify(data) );
}
stateLoadCallback(settings) {
const data = JSON.parse( localStorage.getItem(this.getStateSaveKey()) );
stateLoadCallback() {
const json = localStorage.getItem(this.getStateSaveKey());
if(json === null || json === undefined) {
return null;
}
const data = JSON.parse(json);
if (data) {
//Do not save the start value (current page), as we want to always start at the first page on a page reload
data.start = 0;
delete data.start;
//Reset the data length to the default value by deleting the length property
delete data.length;
}
return data;
@@ -88,6 +95,19 @@ export default class extends Controller {
//Add url info, as the one available in the history is not enough, as Turbo may have not changed it yet
settings.url = this.element.dataset.dtUrl;
//Add initial_order info to the settings, so that the order on the initial page load is the one saved in the state
const saved_state = this.stateLoadCallback();
if (saved_state !== null) {
const raw_order = saved_state.order;
settings.initial_order = raw_order.map((order) => {
return {
column: order[0],
dir: order[1]
}
});
}
let options = {
colReorder: true,
responsive: true,
@@ -97,7 +117,7 @@ export default class extends Controller {
},
buttons: [{
"extend": 'colvis',
'className': 'mr-2 btn-light',
'className': 'mr-2 btn-outline-secondary',
'columns': ':not(.no-colvis)',
"text": "<i class='fa fa-cog'></i>"
}],
@@ -123,6 +143,22 @@ export default class extends Controller {
console.error("Error initializing datatables: " + err);
});
//Fix height of the length selector
promise.then((dt) => {
//Find all length selectors (select with name dt_length), which are inside a label
const lengthSelectors = document.querySelectorAll('label select[name="dt_length"]');
//And remove the surrounding label, while keeping the select with all event handlers
lengthSelectors.forEach((selector) => {
selector.parentElement.replaceWith(selector);
});
//Find all column visibility buttons (button with buttons-colvis class) and remove the btn-secondary class
const colVisButtons = document.querySelectorAll('button.buttons-colvis');
colVisButtons.forEach((button) => {
button.classList.remove('btn-secondary');
});
});
//Dispatch an event to let others know that the datatables has been loaded
promise.then((dt) => {
const event = new CustomEvent(EVENT_DT_LOADED, {bubbles: true});
@@ -203,4 +239,16 @@ export default class extends Controller {
return this.element.dataset.select ?? false;
}
invertSelection() {
//Do nothing if the datatable is not selectable
if(!this.isSelectable()) {
return;
}
//Invert the selected rows on the datatable
const selected_rows = this._dt.rows({selected: true});
this._dt.rows().select();
selected_rows.deselect();
}
}

View File

@@ -44,6 +44,7 @@ export default class extends Controller
const title = this.element.dataset.deleteTitle;
const form = this.element;
const submitter = event.submitter;
const that = this;
const confirm = bootbox.confirm({
@@ -58,6 +59,14 @@ export default class extends Controller
const submit_btn = document.createElement('button');
submit_btn.type = 'submit';
submit_btn.style.display = 'none';
//If the clicked button has a value, set it on the submit button
if (submitter.value) {
submit_btn.value = submitter.value;
}
if (submitter.name) {
submit_btn.name = submitter.name;
}
form.appendChild(submit_btn);
submit_btn.click();
} else {

View File

@@ -0,0 +1,40 @@
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2023 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/>.
*/
import {Controller} from "@hotwired/stimulus";
import JSONFormatter from 'json-formatter-js';
/**
* This controller implements an element that renders a JSON object as a collapsible tree.
* The JSON object is passed as a data attribute.
* You have to apply the controller to a div element or similar block element which can contain other elements.
*/
export default class extends Controller {
connect() {
const depth_to_open = this.element.dataset.depthToOpen ?? 0;
const json_string = this.element.dataset.json;
const json_object = JSON.parse(json_string);
const formatter = new JSONFormatter(json_object, depth_to_open);
this.element.appendChild(formatter.render());
}
}

View File

@@ -0,0 +1,72 @@
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2022 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/>.
*/
import {Controller} from "@hotwired/stimulus";
import * as bootbox from "bootbox";
import "../../css/components/bootbox_extensions.css";
export default class extends Controller
{
static values = {
message: String,
title: String
}
connect()
{
this._confirmed = false;
this.element.addEventListener('click', this._onClick.bind(this));
}
_onClick(event)
{
//If a user has not already confirmed the deletion, just let turbo do its work
if (this._confirmed) {
this._confirmed = false;
return;
}
event.preventDefault();
event.stopPropagation();
const that = this;
bootbox.confirm({
title: this.titleValue,
message: this.messageValue,
callback: (result) => {
if (result) {
//Set a flag to prevent the dialog from popping up again and allowing turbo to submit the form
that._confirmed = true;
//Click the link
that.element.click();
} else {
that._confirmed = false;
}
}
});
}
}

View File

@@ -0,0 +1,123 @@
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2023 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/>.
*/
import {Controller} from "@hotwired/stimulus";
import { zxcvbn, zxcvbnOptions } from '@zxcvbn-ts/core';
import * as zxcvbnCommonPackage from '@zxcvbn-ts/language-common';
import * as zxcvbnEnPackage from '@zxcvbn-ts/language-en';
import * as zxcvbnDePackage from '@zxcvbn-ts/language-de';
import * as zxcvbnFrPackage from '@zxcvbn-ts/language-fr';
import * as zxcvbnJaPackage from '@zxcvbn-ts/language-ja';
import {trans, USER_PASSWORD_STRENGTH_VERY_WEAK, USER_PASSWORD_STRENGTH_WEAK, USER_PASSWORD_STRENGTH_MEDIUM,
USER_PASSWORD_STRENGTH_STRONG, USER_PASSWORD_STRENGTH_VERY_STRONG} from '../../translator.js';
/* stimulusFetch: 'lazy' */
export default class extends Controller {
_passwordInput;
static targets = ["badge", "warning"]
_getTranslations() {
//Get the current locale
const locale = document.documentElement.lang;
if (locale.includes('de')) {
return zxcvbnDePackage.translations;
} else if (locale.includes('fr')) {
return zxcvbnFrPackage.translations;
} else if (locale.includes('ja')) {
return zxcvbnJaPackage.translations;
}
//Fallback to english
return zxcvbnEnPackage.translations;
}
connect() {
//Find the password input field
this._passwordInput = this.element.querySelector('input[type="password"]');
//Configure zxcvbn
const options = {
graphs: zxcvbnCommonPackage.adjacencyGraphs,
dictionary: {
...zxcvbnCommonPackage.dictionary,
// We could use the english dictionary here too, but it is very big. So we just use the common words
//...zxcvbnEnPackage.dictionary,
},
translations: this._getTranslations(),
};
zxcvbnOptions.setOptions(options);
//Add event listener to the password input field
this._passwordInput.addEventListener('input', this._onPasswordInput.bind(this));
}
_onPasswordInput() {
//Retrieve the password
const password = this._passwordInput.value;
//Estimate the password strength
const result = zxcvbn(password);
//Update the badge
this.badgeTarget.parentElement.classList.remove("d-none");
this._setBadgeToLevel(result.score);
this.warningTarget.innerHTML = result.feedback.warning;
}
_setBadgeToLevel(level) {
let text, classes;
switch (level) {
case 0:
text = trans(USER_PASSWORD_STRENGTH_VERY_WEAK);
classes = "bg-danger badge-danger";
break;
case 1:
text = trans(USER_PASSWORD_STRENGTH_WEAK);
classes = "bg-warning badge-warning";
break;
case 2:
text = trans(USER_PASSWORD_STRENGTH_MEDIUM)
classes = "bg-info badge-info";
break;
case 3:
text = trans(USER_PASSWORD_STRENGTH_STRONG);
classes = "bg-primary badge-primary";
break;
case 4:
text = trans(USER_PASSWORD_STRENGTH_VERY_STRONG);
classes = "bg-success badge-success";
break;
default:
text = "???";
classes = "bg-secondary badge-secondary";
}
this.badgeTarget.innerHTML = text;
//Remove all classes
this.badgeTarget.className = '';
//Re-add the classes
this.badgeTarget.classList.add("badge");
this.badgeTarget.classList.add(...classes.split(" "));
}
}

View File

@@ -22,6 +22,8 @@ import '../../css/components/tom-select_extensions.css';
import TomSelect from "tom-select";
import {Controller} from "@hotwired/stimulus";
import {trans, ENTITY_SELECT_GROUP_NEW_NOT_ADDED_TO_DB} from '../../translator.js'
export default class extends Controller {
_tomSelect;
@@ -40,8 +42,7 @@ export default class extends Controller {
allowEmptyOption: true,
selectOnTab: true,
maxOptions: null,
create: allowAdd,
createFilter: /\D/, //Must contain a non-digit character, otherwise they would be recognized as DB ID
create: allowAdd ? this.createItem.bind(this) : false,
searchField: [
{field: "text", weight : 2},
@@ -57,10 +58,39 @@ export default class extends Controller {
'<small class="text-muted float-end">(' + addHint +')</small>' +
'</div>';
},
}
},
//Add callbacks to update validity
onInitialize: this.updateValidity.bind(this),
onChange: this.updateValidity.bind(this),
};
this._tomSelect = new TomSelect(this.element, settings);
//Do not do a sync here as this breaks the initial rendering of the empty option
//this._tomSelect.sync();
}
createItem(input, callback) {
callback({
//$%$ is a special value prefix, that is used to identify items, that are not yet in the DB
value: '$%$' + input,
text: input,
not_in_db_yet: true,
});
}
updateValidity() {
//Mark this input as invalid, if the selected option is disabled
const input = this.element;
const selectedOption = input.options[input.selectedIndex];
if (selectedOption && selectedOption.disabled) {
input.setCustomValidity("This option was disabled. Please select another option.");
} else {
input.setCustomValidity("");
}
}
getTomSelect() {
@@ -78,14 +108,27 @@ export default class extends Controller {
}
if (data.short) {
return '<div><b>' + escape(data.short) + '</b></div>';
let short = escape(data.short)
//Make text italic, if the item is not yet in the DB
if (data.not_in_db_yet) {
short = '<i>' + short + '</i>';
}
return '<div><b>' + short + '</b></div>';
}
let name = "";
if (data.parent) {
name += escape(data.parent) + "&nbsp;→&nbsp;";
}
name += "<b>" + escape(data.text) + "</b>";
if (data.not_in_db_yet) {
//Not yet added items are shown italic and with a badge
name += "<i><b>" + escape(data.text) + "</b></i>" + "<span class='ms-3 badge bg-info badge-info'>" + trans(ENTITY_SELECT_GROUP_NEW_NOT_ADDED_TO_DB) + "</span>";
} else {
name += "<b>" + escape(data.text) + "</b>";
}
return '<div>' + (data.image ? "<img class='structural-entity-select-image' style='margin-right: 5px;' ' src='" + data.image + "'/>" : "") + name + '</div>';
}

View File

@@ -81,6 +81,14 @@ export default class extends Controller {
this._tree.remove();
}
const BS53Theme = {
getOptions() {
return {
onhoverColor: 'var(--bs-secondary-bg)',
};
}
}
this._tree = new BSTreeView(this.treeTarget, {
levels: 1,
showTags: this._showTags,
@@ -93,7 +101,7 @@ export default class extends Controller {
}
},
//onNodeContextmenu: contextmenu_handler,
}, [BS5Theme, FAIconTheme]);
}, [BS5Theme, BS53Theme, FAIconTheme]);
this.treeTarget.addEventListener(EVENT_INITIALIZED, (event) => {
/** @type {BSTreeView} */

View File

@@ -0,0 +1,65 @@
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2022 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/>.
*/
import {Controller} from "@hotwired/stimulus";
/**
* This controller is used on a checkbox, which toggles the max value of all number input fields
*/
export default class extends Controller {
_checkbox;
getCheckbox() {
if (this._checkbox) {
return this._checkbox;
}
//Find the checkbox inside the controller element
this._checkbox = this.element.querySelector('input[type="checkbox"]');
return this._checkbox;
}
connect() {
//Add event listener to the checkbox
this.getCheckbox().addEventListener('change', this.toggleInputLimits.bind(this));
}
toggleInputLimits() {
//Find all input fields with the data-toggle-input-limits-target="max"
const inputFields = document.querySelectorAll("input[type='number']");
inputFields.forEach((inputField) => {
//Ensure that the input field has either a max or a data-max attribute
if (!inputField.hasAttribute('max') && !inputField.hasAttribute('data-max')) {
return;
}
//If the checkbox is checked, rename the max attribute to data-max
if (this.getCheckbox().checked) {
inputField.setAttribute('data-max', inputField.getAttribute('max'));
inputField.removeAttribute('max');
} else {
//If the checkbox is not checked, rename the data-max attribute back to max
inputField.setAttribute('max', inputField.getAttribute('data-max'));
inputField.removeAttribute('data-max');
}
});
}
}

View File

@@ -99,10 +99,25 @@ label:not(.form-check-label, .custom-control-label) {
form .col-form-label.required:after, form label.required:after {
bottom: 4px;
color: var(--bs-dark);
color: var(--bs-secondary-color);
content: "\2022";
filter: opacity(75%);
position: relative;
right: -2px;
z-index: 700;
}
/****************************************
* HTML diff styling
****************************************/
/* Insertations are marked with green background and bold */
ins {
background-color: #95f095;
font-weight: bold;
}
del {
background-color: #f09595;
font-weight: bold;
}

View File

@@ -67,7 +67,6 @@ ul.structural_link {
padding-bottom: 7px;
padding-left: 0;
list-style: none;
background-color: inherit;
}
/* Display list items side by side */
@@ -79,7 +78,7 @@ ul.structural_link li {
/* Add a slash symbol (/) before/behind each list item */
ul.structural_link li+li:before {
padding: 2px;
color: grey;
color: var(--bs-tertiary-color);
/*content: "/\00a0";*/
font-family: "Font Awesome 5 Free";
font-weight: 900;
@@ -89,13 +88,13 @@ ul.structural_link li+li:before {
/* Add a color to all links inside the list */
ul.structural_link li a {
color: #0275d8;
color: var(--bs-link-color);
text-decoration: none;
}
/* Add a color on mouse-over */
ul.structural_link li a:hover {
color: #01447e;
color: var(--bs-link-hover-color);
text-decoration: underline;
}

View File

@@ -78,8 +78,6 @@ body {
overflow: -moz-scrollbars-none;
/* Use standard version for hiding the scrollbar */
scrollbar-width: none;
background-color: var(--light);
}
#sidebar-container {

View File

@@ -91,7 +91,7 @@ th.select-checkbox {
/** Fix datatables select-checkbox position */
table.dataTable tr.selected td.select-checkbox:after
{
margin-top: -28px !important;
margin-top: -20px !important;
}
@@ -116,23 +116,33 @@ table.dataTable > thead > tr > th.select-checkbox:before,
table.dataTable > thead > tr > th.select-checkbox:after {
display: block;
position: absolute;
top: 1.2em;
top: 0.9em;
left: 50%;
width: 12px;
height: 12px;
width: 1em !important;
height: 1em !important;
box-sizing: border-box;
}
table.dataTable > thead > tr > th.select-checkbox:before {
content: " ";
margin-top: -5px;
margin-left: -6px;
border: 1px solid black;
border: 2px solid var(--bs-tertiary-color);
border-radius: 3px;
}
table.dataTable > tbody > tr > td.select-checkbox:before, table.dataTable > tbody > tr > th.select-checkbox:before {
border: 2px solid var(--bs-tertiary-color) !important;
}
table.dataTable > tbody > tr > td.select-checkbox:before, table.dataTable > tbody > tr > td.select-checkbox:after, table.dataTable > tbody > tr > th.select-checkbox:before, table.dataTable > tbody > tr > th.select-checkbox:after {
width: 1em !important;
height: 1em !important;
}
table.dataTable > thead > tr.selected > th.select-checkbox:after {
content: "✓";
font-size: 20px;
margin-top: -23px;
margin-top: -20px;
margin-left: -6px;
text-align: center;
/*text-shadow: 1px 1px #B0BED9, -1px -1px #B0BED9, 1px -1px #B0BED9, -1px 1px #B0BED9; */

View File

@@ -36,3 +36,42 @@
.ck-html-label .ck-content hr {
margin: 2px;
}
/***********************************************
* Hide CKEditor powered by message
***********************************************/
.ck-powered-by {
display: none;
}
/***********************************************
* Use Bootstrap color vars for CKEditor
***********************************************/
:root {
--ck-color-base-foreground: var(--bs-secondary-bg);
--ck-color-base-background: var(--bs-body-bg);
--ck-color-base-border: var(--bs-border-color);
--ck-color-base-action: var(--bs-success);
--ck-color-base-focus: var(--bs-primary-border-subtle);
--ck-color-base-text: var(--bs-body-color);
--ck-color-base-active: var(--bs-primary-bg-subtle);
--ck-color-base-active-focus: var(--bs-primary);
--ck-color-base-error: var(--bs-danger);
/* Improve contrast between text and toolbar */
--ck-color-toolbar-background: var(--bs-tertiary-bg);
/* Buttons */
--ck-color-button-default-hover-background: var(--bs-secondary-bg);
--ck-color-button-default-active-background: var(--bs-secondary-bg);
--ck-color-button-on-background: var(--bs-body-bg);
--ck-color-button-on-hover-background: var(--bs-secondary-bg);
--ck-color-button-on-active-background: var(--bs-secondary-bg);
--ck-color-button-on-disabled-background: var(--bs-secondary-bg);
--ck-color-button-on-color: var(--bs-primary)
}

View File

@@ -18,6 +18,29 @@
*/
.tagsinput.ts-wrapper.multi .ts-control > div {
background: var(--bs-secondary);
color: var(--bs-white);
}
background: var(--bs-secondary-bg);
color: var(--bs-body-color);
}
/*********
* BS 5.3 compatible dark mode
***************/
.ts-dropdown .active {
background-color: var(--bs-secondary-bg) !important;
color: var(--bs-body-color) !important;
}
.ts-dropdown, .ts-control, .ts-control input {
color: var(--bs-body-color) !important;
}
.ts-dropdown, .ts-dropdown.form-control, .ts-dropdown.form-select {
background: var(--bs-body-bg);
}
.ts-dropdown .optgroup-header {
color: var(--bs-tertiary-color);
background: var(--bs-body-bg);
cursor: default;
}

3
assets/fonts/dompdf/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
# Ignore font files
*.otf
*.ttf

View File

@@ -0,0 +1 @@
Put your font ttf files in this folder to make them available to the label generator.

View File

@@ -22,7 +22,6 @@
import '../css/app/layout.css';
import '../css/app/helpers.css';
import '../css/app/darkmode.css';
import '../css/app/tables.css';
import '../css/app/bs-overrides.css';
import '../css/app/treeview.css';

View File

@@ -47,7 +47,8 @@
method: config.method,
data: {
_dt: config.name,
_init: true
_init: true,
order: config.initial_order ?? undefined,
}
}).done(function(data) {
var baseState;
@@ -72,6 +73,17 @@
}
} else {
request._dt = config.name;
//Try to resolve the original column index when the column was reordered (using the ColReorder plugin)
//Only do this when _ColReorder_iOrigCol is available
if (settings.aoColumns && settings.aoColumns.length && settings.aoColumns[0]._ColReorder_iOrigCol !== undefined) {
if (request.order && request.order.length) {
request.order.forEach(function (order) {
order.column = settings.aoColumns[order.column]._ColReorder_iOrigCol;
});
}
}
$.ajax(typeof config.url === 'function' ? config.url(dt) : config.url, {
method: config.method,
data: request

View File

@@ -20,6 +20,7 @@
'use strict';
import {Dropdown} from "bootstrap";
import ClipboardJS from "clipboard";
class RegisterEventHelper {
constructor() {
@@ -27,6 +28,11 @@ class RegisterEventHelper {
this.configureDropdowns();
this.registerSpecialCharInput();
//Initialize ClipboardJS
this.registerLoadHandler(() => {
new ClipboardJS('.btn');
})
this.registerModalDropRemovalOnFormSubmit();
}
@@ -59,13 +65,16 @@ class RegisterEventHelper {
}
registerTooltips() {
this.registerLoadHandler(() => {
const handler = () => {
$(".tooltip").remove();
//Exclude dropdown buttons from tooltips, otherwise we run into endless errors from bootstrap (bootstrap.esm.js:614 Bootstrap doesn't allow more than one instance per element. Bound instance: bs.dropdown.)
$('a[title], button[title]:not([data-bs-toggle="dropdown"]), p[title], span[title], h6[title], h3[title], i.fas[title]')
$('a[title], label[title], button[title]:not([data-bs-toggle="dropdown"]), p[title], span[title], h6[title], h3[title], i[title], small[title]')
//@ts-ignore
.tooltip("hide").tooltip({container: "body", placement: "auto", boundary: 'window'});
});
};
this.registerLoadHandler(handler);
document.addEventListener('dt:loaded', handler);
}
registerSpecialCharInput() {

View File

@@ -21,8 +21,13 @@
class WebauthnTFA {
// Decodes a Base64Url string
_base64UrlDecode = (input) => {
_b64UrlSafeEncode = (str) => {
const b64 = btoa(str);
return b64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
}
// Decodes a Base64Url string
_b64UrlSafeDecode = (input) => {
input = input
.replace(/-/g, '+')
.replace(/_/g, '/');
@@ -39,13 +44,16 @@ class WebauthnTFA {
};
// Converts an array of bytes into a Base64Url string
_arrayToBase64String = (a) => btoa(String.fromCharCode(...a));
_arrayToBase64String = (a) => {
const str = String.fromCharCode(...a);
return this._b64UrlSafeEncode(str);
}
// 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),
this._b64UrlSafeDecode(publicKey.challenge),
c => c.charCodeAt(0)
);
@@ -67,7 +75,7 @@ class WebauthnTFA {
return {
...data,
id: Uint8Array.from(
this._base64UrlDecode(data.id),
this._b64UrlSafeDecode(data.id),
c => c.charCodeAt(0)
),
};
@@ -81,7 +89,7 @@ class WebauthnTFA {
return {
...data,
id: Uint8Array.from(
this._base64UrlDecode(data.id),
this._b64UrlSafeDecode(data.id),
c => c.charCodeAt(0)
),
};

16
assets/translator.js Normal file
View File

@@ -0,0 +1,16 @@
import { localeFallbacks } from '../var/translations/configuration';
import { trans, getLocale, setLocale, setLocaleFallbacks } from '@symfony/ux-translator';
/*
* This file is part of the Symfony UX Translator package.
*
* If folder "../var/translations" does not exist, or some translations are missing,
* you must warmup your Symfony cache to refresh JavaScript translations.
*
* If you use TypeScript, you can rename this file to "translator.ts" to take advantage of types checking.
*/
setLocaleFallbacks(localeFallbacks);
export { trans };
export * from '../var/translations';

View File

@@ -4,6 +4,13 @@
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
//Increase xdebug.max_nesting_level to 1000 if required (see issue #411)
//Check if xdebug extension is active, and xdebug.max_nesting_level is set to 256 or lower
if (extension_loaded('xdebug') && ((int) ini_get('xdebug.max_nesting_level')) <= 256) {
//Increase xdebug.max_nesting_level to 1000
ini_set('xdebug.max_nesting_level', '1000');
}
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

View File

@@ -5,4 +5,5 @@ coverage:
status:
project:
default:
threshold: 5%
threshold: 10%
target: 40%

View File

@@ -2,74 +2,82 @@
"type": "project",
"license": "AGPL-3.0-or-later",
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.1",
"ext-ctype": "*",
"ext-dom": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-dom": "*",
"api-platform/core": "^3.1",
"beberlei/doctrineextensions": "^1.2",
"brick/math": "^0.8.15",
"composer/package-versions-deprecated": "1.11.99.4",
"doctrine/annotations": "^1.6",
"brick/math": "^0.11.0",
"composer/package-versions-deprecated": "^1.11.99.5",
"doctrine/annotations": "1.14.3",
"doctrine/data-fixtures": "^1.6.6",
"doctrine/dbal": "^3.4.6",
"doctrine/doctrine-bundle": "^2.0",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.9",
"dompdf/dompdf": "^2.0.0",
"doctrine/orm": "^2.16",
"dompdf/dompdf": "dev-master#87bea32efe0b0db309e1d31537201f64d5508280 as v2.0.3",
"erusev/parsedown": "^1.7",
"florianv/swap": "^4.0",
"florianv/swap-bundle": "dev-master",
"gregwar/captcha-bundle": "^2.1.0",
"hslavich/oneloginsaml-bundle": "^2.10",
"jbtronics/2fa-webauthn": "^1.0.0",
"jbtronics/2fa-webauthn": "^v2.0.0",
"jbtronics/dompdf-font-loader-bundle": "^1.0.0",
"jfcherng/php-diff": "^6.14",
"knpuniversity/oauth2-client-bundle": "^2.15",
"league/csv": "^9.8.0",
"league/html-to-markdown": "^5.0.1",
"liip/imagine-bundle": "^2.2",
"nbgrp/onelogin-saml-bundle": "^1.3",
"nelexa/zip": "^4.0",
"nelmio/cors-bundle": "^2.3",
"nelmio/security-bundle": "^3.0",
"nyholm/psr7": "^1.1",
"ocramius/proxy-manager": "2.2.*",
"omines/datatables-bundle": "^0.5.0",
"php-translation/symfony-bundle": "^0.12.0",
"omines/datatables-bundle": "^0.7.2",
"part-db/label-fonts": "^1.0",
"php-translation/symfony-bundle": "^0.14.0",
"phpdocumentor/reflection-docblock": "^5.2",
"phpstan/phpdoc-parser": "^1.23",
"s9e/text-formatter": "^2.1",
"scheb/2fa-backup-code": "^5.13",
"scheb/2fa-bundle": "^5.13",
"scheb/2fa-google-authenticator": "^5.13",
"scheb/2fa-trusted-device": "^5.13",
"sensio/framework-extra-bundle": "^6.1.1",
"scheb/2fa-backup-code": "^6.8.0",
"scheb/2fa-bundle": "^6.8.0",
"scheb/2fa-google-authenticator": "^6.8.0",
"scheb/2fa-trusted-device": "^6.8.0",
"shivas/versioning-bundle": "^4.0",
"spatie/db-dumper": "^2.21",
"spatie/db-dumper": "^3.3.1",
"symfony/apache-pack": "^1.0",
"symfony/asset": "5.4.*",
"symfony/console": "5.4.*",
"symfony/dotenv": "5.4.*",
"symfony/expression-language": "5.4.*",
"symfony/flex": "^1.1",
"symfony/form": "5.4.*",
"symfony/framework-bundle": "5.4.*",
"symfony/http-client": "5.4.*",
"symfony/http-kernel": "5.4.*",
"symfony/mailer": "5.4.*",
"symfony/asset": "6.3.*",
"symfony/console": "6.3.*",
"symfony/dotenv": "6.3.*",
"symfony/expression-language": "6.3.*",
"symfony/flex": "^v2.3.1",
"symfony/form": "6.3.*",
"symfony/framework-bundle": "6.3.*",
"symfony/http-client": "6.3.*",
"symfony/http-kernel": "6.3.*",
"symfony/mailer": "6.3.*",
"symfony/monolog-bundle": "^3.1",
"symfony/process": "5.4.*",
"symfony/property-access": "5.4.*",
"symfony/property-info": "5.4.*",
"symfony/proxy-manager-bridge": "5.4.*",
"symfony/rate-limiter": "5.4.*",
"symfony/runtime": "5.4.*",
"symfony/security-bundle": "5.4.*",
"symfony/serializer": "5.4.*",
"symfony/translation": "5.4.*",
"symfony/twig-bundle": "5.4.*",
"symfony/process": "6.3.*",
"symfony/property-access": "6.3.*",
"symfony/property-info": "6.3.*",
"symfony/proxy-manager-bridge": "6.3.*",
"symfony/rate-limiter": "6.3.*",
"symfony/runtime": "6.3.*",
"symfony/security-bundle": "6.3.*",
"symfony/serializer": "6.3.*",
"symfony/translation": "6.3.*",
"symfony/twig-bundle": "6.3.*",
"symfony/ux-translator": "^2.10",
"symfony/ux-turbo": "^2.0",
"symfony/validator": "5.4.*",
"symfony/web-link": "5.4.*",
"symfony/webpack-encore-bundle": "^1.1",
"symfony/yaml": "5.4.*",
"symfony/validator": "6.3.*",
"symfony/web-link": "6.3.*",
"symfony/webpack-encore-bundle": "^v2.0.1",
"symfony/yaml": "6.3.*",
"tecnickcom/tc-lib-barcode": "^1.15",
"twig/cssinliner-extra": "^3.0",
"twig/extra-bundle": "^3.0",
@@ -77,7 +85,7 @@
"twig/inky-extra": "^3.0",
"twig/intl-extra": "^3.0",
"twig/markdown-extra": "^3.0",
"web-auth/webauthn-symfony-bundle": "^3.3",
"web-auth/webauthn-symfony-bundle": "^4.0.0",
"webmozart/assert": "^1.4"
},
"require-dev": {
@@ -87,17 +95,20 @@
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.4.7",
"phpstan/phpstan-doctrine": "^1.2.11",
"phpstan/phpstan-strict-rules": "^1.5",
"phpstan/phpstan-symfony": "^1.1.7",
"phpunit/phpunit": "^9.5",
"psalm/plugin-symfony": "^v5.0.1",
"rector/rector": "^0.18.0",
"roave/security-advisories": "dev-latest",
"symfony/browser-kit": "^5.2",
"symfony/css-selector": "^5.2",
"symfony/debug-bundle": "^5.2",
"symfony/browser-kit": "6.3.*",
"symfony/css-selector": "6.3.*",
"symfony/debug-bundle": "6.3.*",
"symfony/maker-bundle": "^1.13",
"symfony/phpunit-bridge": "5.4.*",
"symfony/stopwatch": "^5.2",
"symfony/web-profiler-bundle": "^5.2",
"symplify/easy-coding-standard": "^11.0",
"symfony/phpunit-bridge": "6.3.*",
"symfony/stopwatch": "6.3.*",
"symfony/web-profiler-bundle": "6.3.*",
"symplify/easy-coding-standard": "^12.0",
"vimeo/psalm": "^5.6.0"
},
"suggest": {
@@ -109,7 +120,7 @@
"*": "dist"
},
"platform": {
"php": "7.4.0"
"php": "8.1.0"
},
"sort-packages": true,
"allow-plugins": {
@@ -141,7 +152,7 @@
"post-update-cmd": [
"@auto-scripts"
],
"phpstan": "vendor/bin/phpstan analyse src --level 2 --memory-limit 1G"
"phpstan": "vendor/bin/phpstan analyse src --level 5 --memory-limit 1G"
},
"conflict": {
"symfony/symfony": "*"
@@ -149,9 +160,7 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.4.*"
"require": "6.3.*"
}
},
"repositories": [
]
}
}

9120
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +0,0 @@
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Dotenv::class)) {
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
}
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
(new Dotenv(false))->populate($env);
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
}
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

View File

@@ -2,7 +2,6 @@
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
@@ -27,5 +26,11 @@ return [
Scheb\TwoFactorBundle\SchebTwoFactorBundle::class => ['all' => true],
SpomkyLabs\CborBundle\SpomkyLabsCborBundle::class => ['all' => true],
Webauthn\Bundle\WebauthnBundle::class => ['all' => true],
Hslavich\OneloginSamlBundle\HslavichOneloginSamlBundle::class => ['all' => true],
Nbgrp\OneloginSamlBundle\NbgrpOneloginSamlBundle::class => ['all' => true],
Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
Symfony\UX\Translator\UxTranslatorBundle::class => ['all' => true],
Jbtronics\DompdfFontLoaderBundle\DompdfFontLoaderBundle::class => ['all' => true],
KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
];

View File

@@ -0,0 +1,26 @@
api_platform:
title: 'Part-DB API'
description: 'API of Part-DB'
version: '0.1.0'
# eager_loading:
# max_joins: 100
swagger:
api_keys:
# overridden in OpenApiFactoryDecorator
access_token:
name: Authorization
type: header
defaults:
# TODO: Change this to true later. In the moment it is false, because we use the session in somewhere
stateless: false
cache_headers:
vary: ['Content-Type', 'Authorization', 'Origin']
extra_properties:
standard_put: true
pagination_client_items_per_page: true # Allow clients to override the default items per page

View File

@@ -20,3 +20,6 @@ framework:
tree.cache:
adapter: cache.app
tags: true
info_provider.cache:
adapter: cache.app

View File

@@ -9,7 +9,7 @@ datatables:
# Set options, as documented at https://datatables.net/reference/option/
options:
lengthMenu : [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]]
pageLength: 50
pageLength: '%partdb.table.default_page_size%' # Set to -1 to disable pagination (i.e. show all rows) by default
#dom: "<'row' <'col-sm-12' tr>><'row' <'col-sm-6'l><'col-sm-6 text-right'pif>>"
dom: " <'row'<'col mb-2 input-group' B l> <'col mb-2' <'pull-end' p>>>
<'card'

View File

@@ -21,12 +21,15 @@ doctrine:
orm:
auto_generate_proxy_classes: true
enable_lazy_ghost_objects: true
report_fields_where_declared: true
validate_xml_mapping: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
type: attribute
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
@@ -35,6 +38,8 @@ doctrine:
string_functions:
regexp: DoctrineExtensions\Query\Mysql\Regexp
ifnull: DoctrineExtensions\Query\Mysql\IfNull
field: DoctrineExtensions\Query\Mysql\Field
field2: App\Doctrine\Functions\Field2
when@test:
doctrine:

View File

@@ -0,0 +1,11 @@
dompdf_font_loader:
auto_install: true
fonts:
unifont:
normal: "%kernel.project_dir%/vendor/part-db/label-fonts/fonts/unifont.ttf"
# Enable autodiscovery of fonts, so that font installation is much easier
autodiscovery:
paths:
- "%kernel.project_dir%/assets/fonts/dompdf"

View File

@@ -2,8 +2,12 @@
framework:
secret: '%env(APP_SECRET)%'
csrf_protection: true
handle_all_throwables: true
# Must be set to true, to enable the change of HTTP methhod via _method parameter, otherwise our delete routines does not work anymore
# We set this header by ourself, so we can disable it here
disallow_search_engine_index: false
# Must be set to true, to enable the change of HTTP method via _method parameter, otherwise our delete routines does not work anymore
# TODO: Rework delete routines to work without _method parameter as it is not recommended anymore (see https://github.com/symfony/symfony/issues/45278)
http_method_override: true
@@ -29,9 +33,6 @@ framework:
php_errors:
log: true
form:
legacy_error_messages: false # Enable to use the new Form component validation messages
when@test:
framework:
test: true

View File

@@ -1,60 +0,0 @@
# See https://github.com/SAML-Toolkits/php-saml for more information about the SAML settings
hslavich_onelogin_saml:
# Basic settings
idp:
entityId: '%env(string:SAML_IDP_ENTITY_ID)%'
singleSignOnService:
url: '%env(string:SAML_IDP_SINGLE_SIGN_ON_SERVICE)%'
binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
singleLogoutService:
url: '%env(string:SAML_IDP_SINGLE_LOGOUT_SERVICE)%'
binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
x509cert: '%env(string:SAML_IDP_X509_CERT)%'
sp:
entityId: '%env(string:SAML_SP_ENTITY_ID)%'
assertionConsumerService:
url: '%partdb.default_uri%saml/acs'
binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
singleLogoutService:
url: '%partdb.default_uri%logout'
binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
x509cert: '%env(string:SAML_SP_X509_CERT)%'
privateKey: '%env(string:SAMLP_SP_PRIVATE_KEY)%'
# Optional settings
#baseurl: 'http://myapp.com'
strict: true
debug: false
security:
allowRepeatAttributeName: true
# nameIdEncrypted: false
authnRequestsSigned: true
logoutRequestSigned: true
logoutResponseSigned: true
# wantMessagesSigned: false
# wantAssertionsSigned: true
# wantNameIdEncrypted: false
# requestedAuthnContext: true
# signMetadata: false
# wantXMLValidation: true
# relaxDestinationValidation: false
# destinationStrictlyMatches: true
# rejectUnsolicitedResponsesWithInResponseTo: false
# signatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'
# digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256'
#contactPerson:
# technical:
# givenName: 'Tech User'
# emailAddress: 'techuser@example.com'
# support:
# givenName: 'Support User'
# emailAddress: 'supportuser@example.com'
# administrative:
# givenName: 'Administrative User'
# emailAddress: 'administrativeuser@example.com'
#organization:
# en:
# name: 'Part-DB-name'
# displayname: 'Displayname'
# url: 'http://example.com'

View File

@@ -0,0 +1,5 @@
framework:
http_client:
default_options:
headers:
'User-Agent': 'Part-DB'

View File

@@ -0,0 +1,10 @@
services:
Psr\Http\Message\RequestFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\ResponseFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\ServerRequestFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\StreamFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\UploadedFileFactoryInterface: '@http_discovery.psr17_factory'
Psr\Http\Message\UriFactoryInterface: '@http_discovery.psr17_factory'
http_discovery.psr17_factory:
class: Http\Discovery\Psr17Factory

View File

@@ -0,0 +1,38 @@
knpu_oauth2_client:
clients:
# configure your clients as described here: https://github.com/knpuniversity/oauth2-client-bundle#configuration
ip_digikey_oauth:
type: generic
provider_class: '\League\OAuth2\Client\Provider\GenericProvider'
client_id: '%env(PROVIDER_DIGIKEY_CLIENT_ID)%'
client_secret: '%env(PROVIDER_DIGIKEY_SECRET)%'
redirect_route: 'oauth_client_check'
redirect_params: {name: 'ip_digikey_oauth'}
provider_options:
urlAuthorize: 'https://api.digikey.com/v1/oauth2/authorize'
urlAccessToken: 'https://api.digikey.com/v1/oauth2/token'
urlResourceOwnerDetails: ''
# Sandbox
#urlAuthorize: 'https://sandbox-api.digikey.com/v1/oauth2/authorize'
#urlAccessToken: 'https://sandbox-api.digikey.com/v1/oauth2/token'
#urlResourceOwnerDetails: ''
ip_octopart_oauth:
type: generic
provider_class: '\League\OAuth2\Client\Provider\GenericProvider'
client_id: '%env(PROVIDER_OCTOPART_CLIENT_ID)%'
client_secret: '%env(PROVIDER_OCTOPART_SECRET)%'
redirect_route: 'oauth_client_check'
redirect_params: { name: 'ip_octopart_oauth' }
provider_options:
urlAuthorize: 'https://identity.nexar.com/connect/authorize'
urlAccessToken: 'https://identity.nexar.com/connect/token'
urlResourceOwnerDetails: ''

View File

@@ -1,2 +0,0 @@
framework:
lock: '%env(LOCK_DSN)%'

View File

@@ -0,0 +1,68 @@
# See https://github.com/SAML-Toolkits/php-saml for more information about the SAML settings
# Define a parameter here, so we can access it later in the default fallback
parameters:
saml.sp.privateKey: '%env(string:SAML_SP_PRIVATE_KEY)%'
nbgrp_onelogin_saml:
onelogin_settings:
default:
# Basic settings
idp:
entityId: '%env(string:SAML_IDP_ENTITY_ID)%'
singleSignOnService:
url: '%env(string:SAML_IDP_SINGLE_SIGN_ON_SERVICE)%'
binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
singleLogoutService:
url: '%env(string:SAML_IDP_SINGLE_LOGOUT_SERVICE)%'
binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
x509cert: '%env(string:SAML_IDP_X509_CERT)%'
sp:
entityId: '%env(string:SAML_SP_ENTITY_ID)%'
assertionConsumerService:
url: '%partdb.default_uri%saml/acs'
binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
singleLogoutService:
url: '%partdb.default_uri%logout'
binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
x509cert: '%env(string:SAML_SP_X509_CERT)%'
# Before the env variable was wrongly named "SAMLP_SP_PRIVATE_KEY".
# For compatibility reasons we keep it and only fallback to the new name if the old one is not set. This may be removed in the future.
privateKey: '%env(string:default:saml.sp.privateKey:string:SAMLP_SP_PRIVATE_KEY)%'
# Optional settings
#baseurl: 'http://myapp.com'
strict: true
debug: false
security:
allowRepeatAttributeName: true
# nameIdEncrypted: false
authnRequestsSigned: true
logoutRequestSigned: true
logoutResponseSigned: true
# wantMessagesSigned: false
# wantAssertionsSigned: true
# wantNameIdEncrypted: false
# requestedAuthnContext: true
# signMetadata: false
# wantXMLValidation: true
# relaxDestinationValidation: false
# destinationStrictlyMatches: true
# rejectUnsolicitedResponsesWithInResponseTo: false
# signatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'
# digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256'
#contactPerson:
# technical:
# givenName: 'Tech User'
# emailAddress: 'techuser@example.com'
# support:
# givenName: 'Support User'
# emailAddress: 'supportuser@example.com'
# administrative:
# givenName: 'Administrative User'
# emailAddress: 'administrativeuser@example.com'
#organization:
# en:
# name: 'Part-DB-name'
# displayname: 'Displayname'
# url: 'http://example.com'

View File

@@ -0,0 +1,10 @@
nelmio_cors:
defaults:
origin_regex: true
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
expose_headers: ['Link']
max_age: 3600
paths:
'^/': null

View File

@@ -12,6 +12,13 @@ nelmio_security:
external_redirects:
abort: true
log: true
allow_list:
# Whitelist the domain of the SAML IDP, so we can redirect to it during the SAML login process
- '%env(string:key:host:url:SAML_IDP_SINGLE_SIGN_ON_SERVICE)%'
# Whitelist the info provider APIs (OAuth redirects)
- 'digikey.com'
- 'nexar.com'
# forces Microsoft's XSS-Protection with
# its block mode

View File

@@ -1,10 +1,10 @@
# See the configuration reference at https://symfony.com/bundles/SchebTwoFactorBundle/5.x/configuration.html
# See the configuration reference at https://symfony.com/bundles/SchebTwoFactorBundle/6.x/configuration.html
scheb_two_factor:
google:
enabled: true # If Google Authenticator should be enabled, default false
server_name: '%partdb.title%' # Server name used in QR code
issuer: 'Part-DB' # Issuer name used in QR code
server_name: '$$DOMAIN$$' # This field is replaced by the domain name of the server in DecoratedGoogleAuthenticator
issuer: '%partdb.title%' # Issuer name used in QR code
digits: 6 # Number of digits in authentication code
window: 1 # How many codes before/after the current one would be accepted as valid
template: security/2fa_form.html.twig
@@ -23,6 +23,6 @@ scheb_two_factor:
security_tokens:
- Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken
# If you're using guard-based authentication, you have to use this one:
# - Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken
# - Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken
# 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

View File

@@ -1,6 +1,5 @@
security:
enable_authenticator_manager: true
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
@@ -22,6 +21,12 @@ security:
user_checker: App\Security\UserChecker
entry_point: form_login
# Enable user impersonation
switch_user: { role: CAN_SWITCH_USER }
custom_authenticators:
- App\Security\ApiTokenAuthenticator
two_factor:
auth_form_path: 2fa_login
check_path: 2fa_login_check
@@ -64,3 +69,5 @@ security:
# We get into trouble with the U2F authentication, if the calls to the trees trigger an 2FA login
# This settings should not do much harm, because a read only access to show available data structures is not really critical
- { path: "^/\\w{2}/tree", role: PUBLIC_ACCESS }
# Restrict access to API to users, which has the API access permission
- { path: "^/api", allow_if: 'is_granted("@api.access_api") and is_authenticated()' }

View File

@@ -1,3 +0,0 @@
sensio_framework_extra:
router:
annotations: false

View File

@@ -1,4 +1,2 @@
framework:
test: true
session:
storage_id: session.storage.mock_file

4
config/packages/uid.yaml Normal file
View File

@@ -0,0 +1,4 @@
framework:
uid:
default_uuid_version: 7
time_based_uuid_version: 7

View File

@@ -0,0 +1,3 @@
ux_translator:
# The directory where the JavaScript translations are dumped
dump_directory: '%kernel.project_dir%/var/translations'

View File

@@ -4,7 +4,9 @@ when@dev:
intercept_redirects: false
framework:
profiler: { only_exceptions: false }
profiler:
only_exceptions: false
collect_serializer_data: true
when@test:
web_profiler:

View File

@@ -11,7 +11,7 @@ parameters:
partdb.banner: '%env(trim:string:BANNER)%' # The info text shown in the homepage, if empty config/banner.md is used
partdb.default_currency: '%env(string:BASE_CURRENCY)%' # The currency that is used inside the DB (and is assumed when no currency is set). This can not be changed later, so be sure to set it the currency used in your country
partdb.global_theme: '' # The theme to use globally (see public/build/themes/ for choices, use name without .css). Set to '' for default bootstrap theme
partdb.locale_menu: ['en', 'de', 'fr', 'ru', 'ja'] # The languages that are shown in user drop down menu
partdb.locale_menu: ['en', 'de', 'it', 'fr', 'ru', 'ja'] # The languages that are shown in user drop down menu
partdb.enforce_change_comments_for: '%env(csv:ENFORCE_CHANGE_COMMENTS_FOR)%' # The actions for which a change comment is required (e.g. "part_edit", "part_create", etc.). If this is empty, change comments are not required at all.
partdb.default_uri: '%env(string:DEFAULT_URI)%' # The default URI to use for the Part-DB instance (e.g. https://part-db.example.com/). This is used for generating links in emails
@@ -19,10 +19,12 @@ parameters:
######################################################################################################################
# Users and Privacy
######################################################################################################################
partdb.gpdr_compliance: true # If this option is activated, IP addresses are anonymized to be GPDR compliant
partdb.gdpr_compliance: true # If this option is activated, IP addresses are anonymized to be GDPR compliant
partdb.users.use_gravatar: '%env(bool:USE_GRAVATAR)%' # Set to false, if no Gravatar images should be used for user profiles.
partdb.users.email_pw_reset: '%env(bool:ALLOW_EMAIL_PW_RESET)%' # Config if users are able, to reset their password by email. By default this enabled, when a mail server is configured.
partdb.check_for_updates: '%env(bool:CHECK_FOR_UPDATES)' # Set to false, if Part-DB should not contact the GitHub API to check for updates
######################################################################################################################
# Mail settings
######################################################################################################################
@@ -48,6 +50,12 @@ parameters:
######################################################################################################################
partdb.saml.enabled: '%env(bool:SAML_ENABLED)%' # If this is set to true, SAML authentication is enabled
######################################################################################################################
# Table settings
######################################################################################################################
partdb.table.default_page_size: '%env(int:TABLE_DEFAULT_PAGE_SIZE)%' # The default number of entries shown per page in tables
partdb.table.parts.default_columns: '%env(trim:string:TABLE_PARTS_DEFAULT_COLUMNS)%' # The default columns in part tables and their order
######################################################################################################################
# Sidebar
######################################################################################################################
@@ -119,9 +127,17 @@ parameters:
env(EMAIL_SENDER_NAME): 'Part-DB Mailer'
env(ALLOW_EMAIL_PW_RESET): 0
env(TABLE_DEFAULT_PAGE_SIZE): 50
env(TRUSTED_PROXIES): '127.0.0.1' #By default trust only our own server
env(TRUSTED_HOSTS): '' # Trust all host names by default
env(DEFAULT_URI): 'https://partdb.changeme.invalid/'
env(SAML_ROLE_MAPPING): '{}'
env(HISTORY_SAVE_CHANGED_DATA): 1
env(HISTORY_SAVE_CHANGED_FIELDS): 1
env(HISTORY_SAVE_REMOVED_DATA): 1
env(HISTORY_SAVE_NEW_DATA): 1

View File

@@ -25,27 +25,35 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
# If a part can be read by a user, he can also see all the datastructures (except devices)
alsoSet: ['storelocations.read', 'footprints.read', 'categories.read', 'suppliers.read', 'manufacturers.read',
'currencies.read', 'attachment_types.read', 'measurement_units.read']
apiTokenRole: ROLE_API_READ_ONLY
edit:
label: "perm.edit"
alsoSet: ['read', 'parts_stock.withdraw', 'parts_stock.add', 'parts_stock.move']
apiTokenRole: ROLE_API_EDIT
create:
label: "perm.create"
alsoSet: ['read', 'edit']
apiTokenRole: ROLE_API_EDIT
delete:
label: "perm.delete"
alsoSet: ['read', 'edit']
apiTokenRole: ROLE_API_EDIT
change_favorite:
label: "perm.part.change_favorite"
alsoSet: ['edit']
apiTokenRole: ROLE_API_EDIT
show_history:
label: "perm.part.show_history"
alsoSet: ['read']
apiTokenRole: ROLE_API_READ_ONLY
revert_element:
label: "perm.revert_elements"
alsoSet: ["read", "edit", "create", "delete", "show_history"]
apiTokenRole: ROLE_API_EDIT
import:
label: "perm.import"
alsoSet: ["read", "edit", "create"]
apiTokenRole: ROLE_API_EDIT
parts_stock:
group: "data"
@@ -53,10 +61,13 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
operations:
withdraw:
label: "perm.parts_stock.withdraw"
apiTokenRole: ROLE_API_EDIT
add:
label: "perm.parts_stock.add"
apiTokenRole: ROLE_API_EDIT
move:
label: "perm.parts_stock.move"
apiTokenRole: ROLE_API_EDIT
storelocations: &PART_CONTAINING
@@ -65,23 +76,30 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
operations:
read:
label: "perm.read"
apiTokenRole: ROLE_API_READ_ONLY
edit:
label: "perm.edit"
alsoSet: 'read'
apiTokenRole: ROLE_API_EDIT
create:
label: "perm.create"
alsoSet: ['read', 'edit']
apiTokenRole: ROLE_API_EDIT
delete:
label: "perm.delete"
alsoSet: ['read', 'edit']
apiTokenRole: ROLE_API_EDIT
show_history:
label: "perm.show_history"
apiTokenRole: ROLE_API_READ_ONLY
revert_element:
label: "perm.revert_elements"
alsoSet: ["read", "edit", "create", "delete", "show_history"]
apiTokenRole: ROLE_API_EDIT
import:
label: "perm.import"
alsoSet: [ "read", "edit", "create" ]
apiTokenRole: ROLE_API_EDIT
footprints:
<<: *PART_CONTAINING
@@ -139,32 +157,48 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
ic_logos:
label: "perm.tools.ic_logos"
info_providers:
label: "perm.part.info_providers"
operations:
create_parts:
label: "perm.part.info_providers.create_parts"
alsoSet: ['parts.create']
apiTokenRole: ROLE_API_EDIT
groups:
label: "perm.groups"
group: "system"
operations:
read:
label: "perm.read"
apiTokenRole: ROLE_API_ADMIN
edit:
label: "perm.edit"
alsoSet: 'read'
apiTokenRole: ROLE_API_ADMIN
create:
label: "perm.create"
alsoSet: ['read', 'edit']
apiTokenRole: ROLE_API_ADMIN
delete:
label: "perm.delete"
alsoSet: ['read', 'delete']
apiTokenRole: ROLE_API_ADMIN
edit_permissions:
label: "perm.edit_permissions"
alsoSet: ['read', 'edit']
apiTokenRole: ROLE_API_ADMIN
show_history:
label: "perm.show_history"
apiTokenRole: ROLE_API_ADMIN
revert_element:
label: "perm.revert_elements"
alsoSet: ["read", "edit", "create", "delete", "edit_permissions", "show_history"]
apiTokenRole: ROLE_API_ADMIN
import:
label: "perm.import"
alsoSet: [ "read", "edit", "create" ]
apiTokenRole: ROLE_API_ADMIN
users:
label: "perm.users"
@@ -172,34 +206,49 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
operations:
read:
label: "perm.read"
apiTokenRole: ROLE_API_ADMIN
create:
label: "perm.create"
alsoSet: ['read', 'edit_username', 'edit_infos']
apiTokenRole: ROLE_API_ADMIN
delete:
label: "perm.delete"
alsoSet: ['read', 'edit_username', 'edit_infos']
apiTokenRole: ROLE_API_ADMIN
edit_username:
label: "perm.users.edit_user_name"
alsoSet: ['read']
apiTokenRole: ROLE_API_ADMIN
edit_infos:
label: "perm.users.edit_infos"
alsoSet: 'read'
apiTokenRole: ROLE_API_ADMIN
edit_permissions:
label: "perm.users.edit_permissions"
alsoSet: 'read'
apiTokenRole: ROLE_API_ADMIN
set_password:
label: "perm.users.set_password"
alsoSet: 'read'
apiTokenRole: ROLE_API_FULL
impersonate:
label: "perm.users.impersonate"
alsoSet: ['set_password']
apiTokenRole: ROLE_API_FULL
change_user_settings:
label: "perm.users.change_user_settings"
apiTokenRole: ROLE_API_ADMIN
show_history:
label: "perm.show_history"
apiTokenRole: ROLE_API_ADMIN
revert_element:
label: "perm.revert_elements"
alsoSet: ["read", "create", "delete", "edit_permissions", "show_history", "edit_infos", "edit_username"]
apiTokenRole: ROLE_API_ADMIN
import:
label: "perm.import"
alsoSet: [ "read", "create" ]
apiTokenRole: ROLE_API_ADMIN
#database:
# label: "perm.database"
@@ -234,60 +283,94 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
operations:
show_logs:
label: "perm.show_logs"
apiTokenRole: ROLE_API_ADMIN
delete_logs:
label: "perm.delete_logs"
alsoSet: 'show_logs'
apiTokenRole: ROLE_API_ADMIN
server_infos:
label: "perm.server_infos"
apiTokenRole: ROLE_API_ADMIN
manage_oauth_tokens:
label: "Manage OAuth tokens"
apiTokenRole: ROLE_API_ADMIN
show_updates:
label: "perm.system.show_available_updates"
apiTokenRole: ROLE_API_ADMIN
attachments:
label: "perm.part.attachments"
operations:
show_private:
label: "perm.attachments.show_private"
apiTokenRole: ROLE_API_READ_ONLY
list_attachments:
label: "perm.attachments.list_attachments"
alsoSet: ['attachment_types.read']
apiTokenRole: ROLE_API_READ_ONLY
self:
label: "perm.self"
operations:
edit_infos:
label: "perm.self.edit_infos"
apiTokenRole: ROLE_API_FULL
edit_username:
label: "perm.self.edit_username"
apiTokenRole: ROLE_API_FULL
show_permissions:
label: "perm.self.show_permissions"
apiTokenRole: ROLE_API_READ_ONLY
show_logs:
label: "perm.self.show_logs"
apiTokenRole: ROLE_API_FULL
labels:
label: "perm.labels"
operations:
create_labels:
label: "perm.self.create_labels"
apiTokenRole: ROLE_API_READ_ONLY
edit_options:
label: "perm.self.edit_options"
alsoSet: ['create_labels']
apiTokenRole: ROLE_API_READ_ONLY
read_profiles:
label: "perm.self.read_profiles"
apiTokenRole: ROLE_API_READ_ONLY
edit_profiles:
label: "perm.self.edit_profiles"
alsoSet: ['read_profiles']
apiTokenRole: ROLE_API_EDIT
create_profiles:
label: "perm.self.create_profiles"
alsoSet: ['read_profiles', 'edit_profiles']
apiTokenRole: ROLE_API_EDIT
delete_profiles:
label: "perm.self.delete_profiles"
alsoSet: ['read_profiles', 'edit_profiles', 'create_profiles']
apiTokenRole: ROLE_API_EDIT
use_twig:
label: "perm.labels.use_twig"
alsoSet: ['create_labels', 'edit_options']
apiTokenRole: ROLE_API_ADMIN
show_history:
label: "perm.show_history"
alsoSet: ['read_profiles']
apiTokenRole: ROLE_API_READ_ONLY
revert_element:
label: "perm.revert_elements"
alsoSet: ['read_profiles', 'edit_profiles', 'create_profiles', 'delete_profiles']
apiTokenRole: ROLE_API_EDIT
api:
label: "perm.api"
operations:
access_api:
label: "perm.api.access_api"
apiTokenRole: ROLE_API_READ_ONLY
manage_tokens:
label: "perm.api.manage_tokens"
alsoSet: ['access_api']
apiTokenRole: ROLE_API_FULL

View File

@@ -1,12 +1,8 @@
#index:
# path: /
# controller: App\Controller\DefaultController::index
# Redirect every url without an locale to the locale of the user/the global base locale
scan_qr:
path: /scan/{type}/{id}
controller: App\Controller\ScanController:scanQRCode
controller: App\Controller\ScanController::scanQRCode
csp_report:
path: /csp/report
@@ -19,5 +15,5 @@ redirector:
requirements:
url: ".*"
controller: App\Controller\RedirectController::addLocalePart
# Dont match localized routes (no redirection loop, if no root with that name exists)
condition: "not (request.getPathInfo() matches '/^\\\\/[a-z]{2}(_[A-Z]{2})?\\\\//')"
# Dont match localized routes (no redirection loop, if no root with that name exists) or API prefixed routes
condition: "not (request.getPathInfo() matches '/^\\\\/([a-z]{2}(_[A-Z]{2})?|api)\\\\//')"

View File

@@ -0,0 +1,4 @@
api_platform:
resource: .
type: api_platform
prefix: /api

View File

@@ -1,6 +1,8 @@
controllers:
resource: ../../src/Controller/
type: annotation
resource:
path: ../../src/Controller/
namespace: App\Controller
type: attribute
prefix: '{_locale}'
defaults:
@@ -11,4 +13,4 @@ controllers:
kernel:
resource: ../../src/Kernel.php
type: annotation
type: attribute

View File

@@ -1,4 +1,4 @@
hslavich_saml_sp:
resource: "@HslavichOneloginSamlBundle/Resources/config/routing.yml"
nbgrp_saml:
resource: "@NbgrpOneloginSamlBundle/Resources/config/routes.php"
# Only load the SAML routes if SAML is enabled
condition: "env('SAML_ENABLED') == '1' or env('SAML_ENABLED') == 'true'"

View File

@@ -14,16 +14,19 @@ services:
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
bind:
bool $demo_mode: '%partdb.demo_mode%'
bool $gpdr_compliance : '%partdb.gpdr_compliance%'
bool $kernel_debug: '%kernel.debug%'
bool $gdpr_compliance: '%partdb.gdpr_compliance%'
bool $kernel_debug_enabled: '%kernel.debug%'
string $kernel_cache_dir: '%kernel.cache_dir%'
string $partdb_title: '%partdb.title%'
string $default_currency: '%partdb.default_currency%'
string $base_currency: '%partdb.default_currency%'
_instanceof:
App\Services\LabelSystem\PlaceholderProviders\PlaceholderProviderInterface:
tags: ['app.label_placeholder_provider']
App\Services\InfoProviderSystem\Providers\InfoProviderInterface:
tags: ['app.info_provider']
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
@@ -78,6 +81,7 @@ services:
$save_changed_fields: '%env(bool:HISTORY_SAVE_CHANGED_FIELDS)%'
$save_changed_data: '%env(bool:HISTORY_SAVE_CHANGED_DATA)%'
$save_removed_data: '%env(bool:HISTORY_SAVE_REMOVED_DATA)%'
$save_new_data: '%env(bool:HISTORY_SAVE_NEW_DATA)%'
tags:
- { name: 'doctrine.event_subscriber' }
@@ -87,7 +91,7 @@ services:
App\Form\AttachmentFormType:
arguments:
$allow_attachments_downloads: '%partdb.attachments.allow_downloads%'
$allow_attachments_download: '%partdb.attachments.allow_downloads%'
$max_file_size: '%partdb.attachments.max_file_size%'
App\Services\Attachments\AttachmentSubmitHandler:
@@ -96,12 +100,6 @@ services:
$mimeTypes: '@mime_types'
$max_upload_size: '%partdb.attachments.max_file_size%'
App\EventSubscriber\LogSystem\LogoutLoggerListener:
tags:
- name: 'kernel.event_listener'
event: 'Symfony\Component\Security\Http\Event\LogoutEvent'
dispatcher: security.event_dispatcher.main
App\Services\LogSystem\EventCommentNeededHelper:
arguments:
$enforce_change_comments_for: '%partdb.enforce_change_comments_for%'
@@ -182,7 +180,7 @@ services:
App\EventSubscriber\UserSystem\SetUserTimezoneSubscriber:
arguments:
$timezone: '%partdb.timezone%'
$default_timezone: '%partdb.timezone%'
App\Controller\SecurityController:
arguments:
@@ -213,6 +211,15 @@ services:
arguments:
$saml_enabled: '%partdb.saml.enabled%'
####################################################################################################################
# Table settings
####################################################################################################################
App\DataTables\PartsDataTable:
arguments:
$visible_columns: '%partdb.table.parts.default_columns%'
App\DataTables\Helpers\ColumnSortHelper:
shared: false # Service has a state so not share it between different tables
####################################################################################################################
# Label system
@@ -226,6 +233,11 @@ services:
tags:
- { name: 'app.label_placeholder_provider', priority: 10}
App\Services\LabelSystem\DompdfFactory:
arguments:
$fontDirectory: '%kernel.project_dir%/var/dompdf/fonts/'
$tmpDirectory: '%kernel.project_dir%/var/dompdf/tmp/'
####################################################################################################################
# Trees
####################################################################################################################
@@ -234,6 +246,62 @@ services:
$rootNodeExpandedByDefault: '%partdb.sidebar.root_expanded%'
$rootNodeEnabled: '%partdb.sidebar.root_node_enable%'
####################################################################################################################
# Part info provider system
####################################################################################################################
App\Services\InfoProviderSystem\ProviderRegistry:
arguments:
$providers: !tagged_iterator 'app.info_provider'
App\Services\InfoProviderSystem\Providers\Element14Provider:
arguments:
$api_key: '%env(string:PROVIDER_ELEMENT14_KEY)%'
$store_id: '%env(string:PROVIDER_ELEMENT14_STORE_ID)%'
App\Services\InfoProviderSystem\Providers\DigikeyProvider:
arguments:
$clientId: '%env(string:PROVIDER_DIGIKEY_CLIENT_ID)%'
$currency: '%env(string:PROVIDER_DIGIKEY_CURRENCY)%'
$language: '%env(string:PROVIDER_DIGIKEY_LANGUAGE)%'
$country: '%env(string:PROVIDER_DIGIKEY_COUNTRY)%'
App\Services\InfoProviderSystem\Providers\TMEClient:
arguments:
$secret: '%env(string:PROVIDER_TME_SECRET)%'
$token: '%env(string:PROVIDER_TME_KEY)%'
App\Services\InfoProviderSystem\Providers\TMEProvider:
arguments:
$currency: '%env(string:PROVIDER_TME_CURRENCY)%'
$country: '%env(string:PROVIDER_TME_COUNTRY)%'
$language: '%env(string:PROVIDER_TME_LANGUAGE)%'
$get_gross_prices: '%env(bool:PROVIDER_TME_GET_GROSS_PRICES)%'
App\Services\InfoProviderSystem\Providers\OctopartProvider:
arguments:
$clientId: '&env(string:PROVIDER_OCTOPART_CLIENT_ID)%'
$secret: '%env(string:PROVIDER_OCTOPART_SECRET)%'
$country: '%env(string:PROVIDER_OCTOPART_COUNTRY)%'
$currency: '%env(string:PROVIDER_OCTOPART_CURRENCY)%'
$search_limit: '%env(int:PROVIDER_OCTOPART_SEARCH_LIMIT)%'
$onlyAuthorizedSellers: '%env(bool:PROVIDER_OCTOPART_ONLY_AUTHORIZED_SELLERS)%'
App\Services\InfoProviderSystem\Providers\MouserProvider:
arguments:
$api_key: '%env(string:PROVIDER_MOUSER_KEY)%'
$language: '%env(string:PROVIDER_MOUSER_SEARCH_WITH_SIGNUP_LANGUAGE)%'
$options: '%env(string:PROVIDER_MOUSER_SEARCH_OPTION)%'
$search_limit: '%env(int:PROVIDER_MOUSER_SEARCH_LIMIT)%'
####################################################################################################################
# API system
####################################################################################################################
App\State\PartDBInfoProvider:
arguments:
$default_uri: '%partdb.default_uri%'
$global_locale: '%partdb.locale%'
$global_timezone: '%partdb.timezone%'
####################################################################################################################
# Symfony overrides
####################################################################################################################
@@ -264,7 +332,7 @@ services:
tags:
- { name: 'doctrine.fixtures.purger_factory', alias: 'reset_autoincrement_purger' }
# We are needing this service inside of a migration, where only the container is injected. So we need to define it as public, to access it from the container.
# We are needing this service inside a migration, where only the container is injected. So we need to define it as public, to access it from the container.
App\Services\UserSystem\PermissionPresetsHelper:
public: true
@@ -272,6 +340,16 @@ services:
arguments:
$project_dir: '%kernel.project_dir%'
App\Services\System\UpdateAvailableManager:
arguments:
$check_for_updates: '%partdb.check_for_updates%'
App\Services\System\BannerHelper:
arguments:
$partdb_banner: '%partdb.banner%'
$project_dir: '%kernel.project_dir%'
####################################################################################################################
# Monolog
####################################################################################################################
@@ -288,3 +366,14 @@ services:
autowire: true
tags:
- { name: monolog.processor }
when@test:
services:
# Decorate the doctrine fixtures load command to use our custom purger by default
doctrine.fixtures_load_command.custom:
decorates: doctrine.fixtures_load_command
class: Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand
arguments:
- '@doctrine.fixtures.loader'
- '@doctrine'
- { default: '@App\Doctrine\Purger\ResetAutoIncrementPurgerFactory' }

View File

@@ -0,0 +1,78 @@
---
title: Authentication
layout: default
parent: API
nav_order: 2
---
# Authentication
To use API endpoints, the external application has to authenticate itself, so that Part-DB knows which user is accessing
the data and which permissions
the application should have during the access. Authentication is always bound to a specific user, so the external
applications is acting on behalf of a
specific user. This user limits the permissions of the application, so that it can only access data, which the user is
allowed to access.
The only method currently available for authentication is to use API tokens:
## API tokens
An API token is a long alphanumeric string, which is bound to a specific user and can be used to authenticate as this
user, when accessing the API.
The API token is passed via the `Authentication` HTTP header during the API request, like the
following: `Authentication: Bearer tcp_sdjfks....`.
{: .important }
> Everybody who knows the API token can access the API as the user, which is bound to the token. So you should treat the
> API token like a password
> and keep it secret. Only share it with trusted applications.
API tokens can be created and managed on the user settings page in the API token section. You can create as many API
tokens as you want and also delete them again.
When deleting a token, it is immediately invalidated and can not be used anymore, which means that the application can
not access the API anymore with this token.
### Token permissions and scopes
API tokens are ultimately limited by the permissions of the user, which belongs to the token. That means that the token
can only access data, which the user is allowed to access, no matter the token permissions.
But you can further limit the permissions of a token by choosing a specific scope for the token. The scope defines which
subset of permissions the token has, which can be less than the permissions of the user. For example, you can have a
user
with full read and write permissions, but create a token with only read permissions, which can only read data, but not
change anything in the database.
{: .warning }
> In general, you should always use the least possible permissions for a token, to limit the possible damage, which can
> be done with a stolen token or a bug in the application.
> Only use the full or admin scope, if you really need it, as they could potentially be used to do a lot of damage to
> your Part-DB instance.
Following token scopes are available:
* **Read-Only**: The token can only read non-sensitive data (like parts, but no users or groups) from the API and can
not change anything.
* **Edit**: The token can read and write non-sensitive data via the API. This includes creating, updating and deleting
data. This should be enough for most applications.
* **Admin**: The token can read and write all data via the API, including sensitive data like users and groups. This
should only be used for trusted applications, which need to access sensitive data, and perform administrative actions.
* **Full**: The token can do anything the user can do, including changing the users password and create new tokens. This
should only be used for highly trusted applications!!
Please note, that in early versions of the API, there might be no endpoints yet, to really perform the actions, which
would be allowed by the token scope.
### Expiration date
API tokens can have an expiration date, which means that the token is only valid until the expiration date. After that
the token is automatically invalidated and can not be used anymore. The token is still listed on the user settings page,
and can be deleted there, but the code can not be used to access Part-DB anymore after the expiration date.
### Get token information
When authenticating with an API token, you can get information about the currently used token by accessing
the `/api/tokens/current` endpoint.
It gives you information about the token scope, expiration date and the user, which is bound to the token and the last
time the token was used.

11
docs/api/index.md Normal file
View File

@@ -0,0 +1,11 @@
---
layout: default
title: API
nav_order: 7
has_children: true
---
# API
Part-DB provides a REST API to access the data stored in the database.
In this section you can find information about the API and how to use it.

178
docs/api/intro.md Normal file
View File

@@ -0,0 +1,178 @@
---
title: Introduction
layout: default
parent: API
nav_order: 1
---
# Introduction
Part-DB provides a [REST API](https://en.wikipedia.org/wiki/REST) to programmatically access the data stored in the
database.
This allows external applications to interact with Part-DB, extend it or integrate it into other applications.
{: .warning }
> This feature is currently in beta. Please report any bugs you find.
> The API should not be considered stable yet and could change in future versions, without prior notice.
> Some features might be missing or not working yet.
> Also be aware, that there might be security issues in the API, which could allow attackers to access or edit data via
> the API, which
> they normally should be able to access. So currently you should only use the API with trusted users and trusted
> applications.
Part-DB uses [API Platform](https://api-platform.com/) to provide the API, which allows for easy creation of REST APIs
with Symfony and gives you a lot of features out of the box.
See the [API Platform documentation](https://api-platform.com/docs/core/) for more details about the API Platform
features and how to use them.
## Enable the API
The API is available under the `/api` path, but not reachable without proper permissions.
You have to give the users, which should be able to access the API the proper permissions (Miscellaneous -> API).
Please note that there are two relevant permissions, the first one allows users to access the `/api/` path at all and
showing the documentation,
and the second one allows them to create API tokens which is needed for authentication of external applications.
## Authentication
To use API endpoints, the external application has to authenticate itself, so that Part-DB knows which user is accessing
the data and
which permissions the application should have. Basically this is done by creating an API token for a user and then
passing it on every request
with the `Authorization` header as bearer token, so you add a header `Authorization: Bearer <your token>`.
See [Authentication chapter]({% link api/authentication.md %}) for more details.
## API endpoints
The API is split into different endpoints, which are reachable under the `/api/` path of your Part-DB instance (
so `https://your-part-db.local/api/`).
There are various endpoints for each entity type (like `part`, `manufacturer`, etc.), which allow you to read and write
data and some special endpoints like `search` or `statistics`.
For example all API endpoints for managing categories are available under `/api/categories/`. Depending on the exact
path and the HTTP method used, you can read, create, update or delete categories.
For most entities, there are endpoints like this:
* **GET**: `/api/categories/` - List all categories in the database (with pagination of the results)
* **POST**: `/api/categories/` - Create a new category
* **GET**: `/api/categories/{id}` - Get a specific category by its ID
* **DELETE**: `/api/categories/{id}` - Delete a specific category by its ID
* **UPDATE**: `/api/categories/{id}` - Update a specific category by its ID. Only the fields which are sent in the
request are updated, all other fields are left unchanged.
Be aware that you have to set the [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) content type
header (`Content-Type: application/merge-patch+json`) for this to work.
A full (interactive) list of endpoints can be displayed when visiting the `/api/` path in your browser, when you are
logged in with a user, which is allowed to access the API.
There is also a link to this page, on the user settings page in the API token section.
This documentation also list all available fields for each entity type and the allowed operations.
## Formats
The API supports different formats for the request and response data, which you can control via the `Accept`
and `Content-Type` headers.
You should use [JSON-LD](https://json-ld.org/) as format, which is basically JSON with some additional metadata, which
allows
to describe the data in a more structured way and also allows to link between different entities. You can achieve this
by setting `Accept: application/ld+json` header to the API requests.
To get plain JSON without any metadata or links, use the `Accept: application/json` header.
Without an `Accept` header (e.g. when you call the endpoint in a browser), the API will return an HTML page with the
documentation, so be sure to include the desired `Accept` header in your API requests.
If you can not control the `Accept` header, you can add an `.json` or `.jsonld` suffix to the URL to enforce a JSON or
JSON-LD response (e.g. `/api/parts.jsonld`).
## OpenAPI schema
Part-DB provides a [OpenAPI](https://swagger.io/specification/) (formally Swagger) schema for the API
under `/api/docs.json` (so `https://your-part-db.local/api/docs.json`).
This schema is a machine-readable description of the API, which can be imported in software to test the API or even
automatically generate client libraries for the API.
API generators which can generate a client library for the API from the schema are available for many programming
languages, like [OpenAPI Generator](https://openapi-generator.tech/).
An JSONLD/Hydra version of the schema is also available under `/api/docs.jsonld` (
so `https://your-part-db.local/api/docs.jsonld`).
## Interactive documentation
Part-DB provides an interactive documentation for the API, which is available under `/api/docs` (
so `https://your-part-db.local/api/docs`).
You can pass your API token in the form on the top of the page, to authenticate yourself, and then you can try out the
API directly in the browser.
This is a great way to test the API and see how it works, without having to write any code.
## Pagination
By default, all list endpoints are paginated, which means only a certain number of results is returned per request.
To get another page of the results, you have to use the `page` query parameter, which contains the page number you want
to get (e.g. `/api/categoues/?page=2`).
When using JSONLD, the links to the next page are also included in the `hydra:view` property of the response.
To change the size of the pages (the number of items in a single page) use the `itemsPerPage` query parameter (
e.g. `/api/categoues/?itemsPerPage=50`).
See [API Platform docs](https://api-platform.com/docs/core/pagination) for more infos.
## Filtering results / Searching
When retrieving a list of entities, you can restrict the results by various filters. Almost all entities have a search
filter,
which allows you to only include entities, which (text) fields match the given search term: For example if you only want
to
get parts, with the Name "BC547", you can use `/api/parts.jsonld?name=BC547`. You can use `%` as wildcard for multiple
characters
in the search term (Be sure to properly encode the search term, if you use special characters). For example if you want
to get all parts,
whose name starts with "BC", you can use `/api/parts.jsonld?name=BC%25` (the `%25` is the url encoded version of `%`).
There are other filters available for some entities, allowing you to search on other fields, or restricting the results
by numeric values or dates. See the endpoint documentation for the available filters.
## Filter by associated entities
To get all parts with a certain category, manufacturer, etc. you can use the `category`, `manufacturer`, etc. query
parameters of the `/api/parts` endpoint.
They are so-called entity filters and accept a comma separated list of IDs of the entities you want to filter by.
For example if you want to get all parts with the category "Resistor" (Category ID 1) and "Capacitor" (Category ID 2),
you can use `/api/parts.jsonld?category=1,2`.
Suffix an id with `+` to suffix, to include all direct children categories of the given category. Use the `++` suffix to
include all children categories recursively.
To get all parts with the category "Resistor" (Category ID 1) and all children categories of "Capacitor" (Category ID
2), you can use `/api/parts.jsonld?category=1,2++`.
See the endpoint documentation for the available entity filters.
## Ordering results
When retrieving a list of entities, you can order the results by various fields using the `order` query parameter.
For example if you want to get all parts ordered by their name, you can use `/api/parts/?order[name]=asc`. You can use
this parameter multiple times to order by multiple fields.
See the endpoint documentation for the available fields to order by.
## Property filter
Sometimes you only want to get a subset of the properties of an entity, for example when you only need the name of a
part, but not all the other properties.
You can achieve this using the `properties[]` query parameter with the name of the field you want to get. You can use
this parameter multiple times to get multiple fields.
For example if you only want to get the name and the description of a part, you can
use `/api/parts/123?properties[]=name&properties[]=description`.
It is also possible to use this filters on list endpoints (get collection), to only get a subset of the properties of
all entities in the collection.
See [API Platform docs](https://api-platform.com/docs/core/filters/#property-filter) for more infos.
## Change comment
Similar to the changes using Part-DB web interface, you can add a change comment to every change you make via the API,
which will be
visible in the log of the entity.
You can pass the text for this via the `_comment` query parameter (beware the proper encoding). For
example `/api/parts/123?_comment=This%20is%20a%20change%20comment`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

View File

@@ -5,6 +5,7 @@ nav_order: 2
---
# Concepts
This page explains the different concepts of Part-DB and what their intended use is:
1. TOC
@@ -13,42 +14,76 @@ This page explains the different concepts of Part-DB and what their intended use
## Part managment
### Part
A part is the central concept of Part-DB. A part represents a single kind (or type) of a thing, like an electronic component, an device, an book or similar (depending on what you use Part-DB for). A part entity just represents a certain type of a thing, so if you have 1000 times an BC547 transistor you would create ONE part with the name BC547 and set its quantity to 1000. The individual quantities (so a single BC547 transistor) of a part, should be indistinguishable from each other, so that it does not matter which one of your 1000 things of Part you use.
A part is the central concept of Part-DB. A part represents a single kind (or type) of a thing, like an electronic
component, a device, a book or similar (depending on what you use Part-DB for). A part entity just represents a certain
type of thing, so if you have 1000 times an BC547 transistor you would create ONE part with the name BC547 and set its
quantity to 1000. The individual quantities (so a single BC547 transistor) of a part, should be indistinguishable from
each other, so that it does not matter which one of your 1000 things of Part you use.
A part entity have many fields, which can be used to describe it better. Most of the fields are optional:
* **Name** (Required): The name of the part or how you wanna call it. This could be an manufacturer provided name, or a name you thought of your self. The name have to be unique in a single category.
* **Description**: A short (single-line) description of what this part is/does. For longer informations you should use the comment field or the specifications
* **Name** (Required): The name of the part or how you want to call it. This could be a manufacturer provided name, or a
name you thought of your self. The name have to be unique in a single category.
* **Description**: A short (single-line) description of what this part is/does. For longer information you should use
the comment field or the specifications
* **Category** (Required): The category (see there) to which this part belongs to.
* **Tags**: The list of tags this part belong to. Tags can be used to group parts logically (similar to the category), but tags are much less strict and formal (they dont have to be defined forehands) and you can assign multiple tags to a part. When clicking on a tag, a list with all parts which have the same tag, is shown.
* **Min Instock**: *Not really implemented yet*. Parts where the total instock is below this value, will show up for ordering.
* **Footprint**: See there. Useful especially for electronic parts, which have one of the common electronic footprints (like DIP8, SMD0805 or similar). If a part has no explicit defined preview picture, the preview picture of its footprint will be shown instead in tables.
* **Tags**: The list of tags this part belong to. Tags can be used to group parts logically (similar to the category),
but tags are much less strict and formal (they don't have to be defined forehands) and you can assign multiple tags to
a part. When clicking on a tag, a list with all parts which have the same tag, is shown.
* **Min Instock**: *Not really implemented yet*. Parts where the total instock is below this value, will show up for
ordering.
* **Footprint**: See there. Useful especially for electronic parts, which have one of the common electronic footprints (
like DIP8, SMD0805 or similar). If a part has no explicit defined preview picture, the preview picture of its
footprint will be shown instead in tables.
* **Manufacturer**: The manufacturer which has manufactured (not sold) this part. See Manufacturer entity for more info.
* **Manufacturer part number** (MPN): If you have used your own name for a part, you can put the part number the manufacturer uses in this field, so that you can find a part also under its manufacturer number.
* **Link to product page**: If you want to link to the manufacturer website of a part, and it is not possible to determine it automatically from the part name, set in the manufacturer entity (or no manfacturer is set), you can set the link here for each part individually.
* **Manufacturing Status**: The manufacturing status of this part, meaning the information about where the part is in its manufacturing lifecycle.
* **Needs review**: If you think parts informations maybe are inaccurate or incomplete and needs some later review/checking, you can set this flag. A part with this flag is marked, so that users know the informations are not completly trustworthy.
* **Manufacturer part number** (MPN): If you have used your own name for a part, you can put the part number the
manufacturer uses in this field, so that you can find a part also under its manufacturer number.
* **Link to product page**: If you want to link to the manufacturer website of a part, and it is not possible to
determine it automatically from the part name, set in the manufacturer entity (or no manufacturer is set), you can set
the link here for each part individually.
* **Manufacturing Status**: The manufacturing status of this part, meaning the information about where the part is in
its manufacturing lifecycle.
* **Needs review**: If you think parts information maybe are inaccurate or incomplete and needs some later
review/checking, you can set this flag. A part with this flag is marked, so that users know the information are not
completely trustworthy.
* **Favorite**: Parts with this flag are highlighted in parts lists
* **Mass**: The mass of a single piece of this part (so of a single transistor). Given in grams.
* **Internal Part number** (IPN): Each part is automatically assigned an numerical ID which identifies a part in the database. This ID depends on when a part was created and can not be changed. If you want to assign your own unique identifiers, or sync parts identifiers with the identifiers of another database you can use this field.
* **Internal Part number** (IPN): Each part is automatically assigned a numerical ID which identifies a part in the
database. This ID depends on when a part was created and can not be changed. If you want to assign your own unique
identifiers, or sync parts identifiers with the identifiers of another database you can use this field.
### Stock / Part lot
A part can have many stock at multiple different locations. This is represented by part lots / stocks, which consists basically of a storelocation (so where are the parts of this lot are stored) and an amount (how many parts are there).
### Purchase Informations
The purchase informations describe where the part can be bought (at which vendors) and to which prices.
The first part (the order information) describes at which supplier the part can be bought and which is the name of the part under which you can order the part there.
An order information can contain multiple price informations, which describes the prices for the part at the supplier including bulk discount, etc.
A part can have many stock at multiple different locations. This is represented by part lots / stocks, which consists
basically of a storage location (so where are the parts of this lot are stored) and an amount (how many parts are there).
### Purchase Information
The purchase information describe where the part can be bought (at which vendors) and to which prices.
The first part (the order information) describes at which supplier the part can be bought and which is the name of the
part under which you can order the part there.
An order information can contain multiple price information, which describes the prices for the part at the supplier
including bulk discount, etc.
### Parameters
Parameters represents various specifications / parameters of a part, like the the maximum current of a diode, etc. The advantage of using parameters instead of just putting the data in the comment field or so, is that you can filter for parameters values (including ranges and more) later on.
Parameters describe can describe numeric values and/or text values for which they can be filtered. This basically allows you to define custom fields on a part.
Using the group field a parameter allows you to group parameters together in the info page later (all parameters with the same group value will be shown under the same group title).
Parameters represents various specifications / parameters of a part, like the maximum current of a diode, etc. The
advantage of using parameters instead of just putting the data in the comment field or so, is that you can filter for
parameters values (including ranges and more) later on.
Parameters describe can describe numeric values and/or text values for which they can be filtered. This basically allows
you to define custom fields on a part.
Using the group field a parameter allows you to group parameters together in the info page later (all parameters with
the same group value will be shown under the same group title).
## Core data
### Category
A category is used to group parts logically by their function (e.g. all NPN transistors would be put in a "NPN-Transistors" category).
Categories are hierarchical structures meaning that you can create logical trees to group categories together. A possible category tree could look like this:
A category is used to group parts logically by their function (e.g. all NPN transistors would be put in a "
NPN-Transistors" category).
Categories are hierarchical structures meaning that you can create logical trees to group categories together. A
possible category tree could look like this:
* Active Components
* Transistors
@@ -60,97 +95,145 @@ Categories are hierarchical structures meaning that you can create logical trees
* MCUs
* Passive Components
* Capacitors
* Resitors
* Resistors
### Supplier
A Supplier is a vendor / distributor where you can buy/order parts. Price informations of parts are associated with a supplier.
A Supplier is a vendor / distributor where you can buy/order parts. Price information of parts are associated with a
supplier.
### Manufacturer
A manufacturer represents the company that manufacturer / build various parts (not necessary sell them). If the manufacturer also sell the parts, you have to create a supplier for that.
### Storelocation
A storelocation represents a place where parts can be stored. This could be a box, a shelf or other things (like the SMD feeder of a machine or so).
A manufacturer represents the company that manufacturer / build various parts (not necessary sell them). If the
manufacturer also sell the parts, you have to create a supplier for that.
Storelocations are hierarchical to represent storelocations contained in each other.
### Storage location
A storage location represents a place where parts can be stored. This could be a box, a shelf or other things (like the
SMD feeder of a machine or so).
Storage locations are hierarchical to represent storage locations contained in each other.
An example tree could look like this:
* Shelf 1
* Box 1
* Box 2
* Box shelf A1
* Box shelf A2
* Box shelf B1
* Box shelf B2
* Box 1
* Box 2
* Box shelf A1
* Box shelf A2
* Box shelf B1
* Box shelf B2
* Shelf 2
* Cupboard
Storelocations should be defined down to the smallest possible location, to make finding the part again easy.
Storage locations should be defined down to the smallest possible location, to make finding the part again easy.
### Footprint
In electronics many components have one of the common components cases / footprints. The footprint entity describes such common footprints, which can be assigned to parts.
You can assign an image (and an 3D model) as an attachment to a footprint, which will be used as preview for parts with this footprint, even if the parts do not have an explicitly assigned preview image.
Footprints are a hierachically which allows you to build logical sorted trees. An example tree could look like this:
In electronics many components have one of the common components cases / footprints. The footprint entity describes such
common footprints, which can be assigned to parts.
You can assign an image (and an 3D model) as an attachment to a footprint, which will be used as preview for parts with
this footprint, even if the parts do not have an explicitly assigned preview image.
Footprints are a hierarchically which allows you to build logical sorted trees. An example tree could look like this:
* Through-Hole components
* DIP
* DIP-8
* DIP-28
* DIP-28W
* DIP-8
* DIP-28
* DIP-28W
* TO
* TO-92
* TO-92
* SMD components
* SOIC
* SO-8
* SO-8
* Resistors
* 0805
* 0603
* 0805
* 0603
### Measurement Unit
By default part instock is counted in number of individual parts, which is fine for things like electronic components, which exists only in integer quantities. However if you have things with fractional units like the length of a wire or the volume of a liquid, you have to define a measurement unit.
By default, part instock is counted in number of individual parts, which is fine for things like electronic components,
which exists only in integer quantities. However, if you have things with fractional units like the length of a wire or
the volume of a liquid, you have to define a measurement unit.
The measurement unit represents a physical quantity like mass, volume or length.
You can define a short unit for it (like m for Meters, or g for gramms) which will be shown, when a quantity of a part with this unit is shown.
You can define a short unit for it (like m for Meters, or g for gramms) which will be shown, when a quantity of a part
with this unit is shown.
### Currency
By default all prices are set in the base currency configured for the instance (by default euros). If you want to use multiple currencies together (as e.g. vendors use foreign currencies for their price and you do not want to update the prices for every exchange rate change), you have to define these currencies here.
You can set an exchange rate here in terms of the base currency (or fetch it from the internet if configured). The exchange rate will be used to show users the prices in their preferred currency.
By default, all prices are set in the base currency configured for the instance (by default euros). If you want to use
multiple currencies together (as e.g. vendors use foreign currencies for their price, and you do not want to update the
prices for every exchange rate change), you have to define these currencies here.
You can set an exchange rate here in terms of the base currency (or fetch it from the internet if configured). The
exchange rate will be used to show users the prices in their preferred currency.
## Attachments
### Attachment
An attachment is an file that can be associated with another entity (like a Part, Storelocation, User, etc.). This could for example be a datasheet in a Part, the logo of a vendor or some CAD drawing of a footprint.
An attachment has an attachment type (see below), which groups the attachments logically (and optionally restricts the allowed file types), a name describing the attachment and a file. The file can either be uploaded to the server and stored there, or given as a link to a file on another webpath. If configured in the settings, it is also possible that the webserver downloads the file from the supplied website and stores it locally on the server.
An attachment is a file that can be associated with another entity (like a Part, Storelocation, User, etc.). This could
for example be a datasheet in a Part, the logo of a vendor or some CAD drawing of a footprint.
By default all uploaded files, are accessible for everyone (even non logged in users), if the link is known. If your Part-DB instance is publicly available and you want to store private/sensitve files on it, you should mark the attachment as "Private attachment". Private attachments are only accessible to users, which has the permission to access private attachments.
Please not, that no thumbnails are generated for private attachments, which can have an performance impact.
An attachment has an attachment type (see below), which groups the attachments logically (and optionally restricts the
allowed file types), a name describing the attachment and a file. The file can either be uploaded to the server and
stored there, or given as a link to a file on another web path. If configured in the settings, it is also possible that
the webserver downloads the file from the supplied website and stores it locally on the server.
Part-DB ships some preview images for various common footprints like DIP-8 and others, as internal ressources. These can be accessed/searched by typing the keyword in the URL field of a part and choosing one of the choices from the dropdown.
By default, all uploaded files, are accessible for everyone (even non-logged-in users), if the link is known. If your
Part-DB instance is publicly available, and you want to store private/sensitive files on it, you should mark the
attachment as "Private attachment". Private attachments are only accessible to users, which has the permission to access
private attachments.
Please not, that no thumbnails are generated for private attachments, which can have a performance impact.
Part-DB ships some preview images for various common footprints like DIP-8 and others, as internal resources. These can
be accessed/searched by typing the keyword in the URL field of a part and choosing one of the choices from the dropdown.
### Preview image / attachment
Most entities with attachments allow you to select one of the defined attachments as "Preview image". You can select an image attachment here, that previews the entity, this could be a picture of a Part, the logo of a manufacturer or supplier, the schematic symbol of a category or the image of an footprint.
Most entities with attachments allow you to select one of the defined attachments as "Preview image". You can select an
image attachment here, that previews the entity, this could be a picture of a Part, the logo of a manufacturer or
supplier, the schematic symbol of a category or the image of a footprint.
The preview image will be shown in various locations together with the entities name.
Please note that as long as the picture is not secret, it should be stored on the Part-DB instance (by upload, or letting Part-DB download the file) and *not* be marked as a private attachments, so that thumbnails can be generated for the picture (which improves performance).
Please note that as long as the picture is not secret, it should be stored on the Part-DB instance (by upload, or
letting Part-DB download the file) and *not* be marked as a private attachments, so that thumbnails can be generated for
the picture (which improves performance).
### Attachment types
Attachment types define logical groups of attachments. For example you could define an attachment group "Datasheets" where all datasheets of Parts, Footprints, etc. belong in, "Pictures" for preview images and more.
Attachment types define logical groups of attachments. For example, you could define an attachment group "Datasheets"
where all datasheets of Parts, Footprints, etc. belong in, "Pictures" for preview images and more.
You can define file type restrictions, which file types and extensions are allowed for files with that attachment type.
## User System
### User
Each person which should be able to use Part-DB (by logging in) is represented by an user entity, which defines things like access rights, the password, and other things. For security reasons, every person which will use Part-DB should use its own personal account with an secret password. This allows to track activity of the users via the log.
There is a special user called `anonymous`, whose access rights are used to determine what an non-logged in user can do. Normally the anonymous user should be the most restricted user.
### User
Each person which should be able to use Part-DB (by logging in) is represented by a user entity, which defines things
like access rights, the password, and other things. For security reasons, every person which will use Part-DB should use
its own personal account with a secret password. This allows to track activity of the users via the log.
There is a special user called `anonymous`, whose access rights are used to determine what a non-logged in user can do.
Normally the anonymous user should be the most restricted user.
For simplification of access management users can be assigned to groups.
### Group
A group is entity, to which users can be assigned to. This can be used to logically group users by for example organisational structures and to simplify permissions managment, as you can define groups with access rights for common use cases and then just assign users to them, without the need to change every permission on the users individually.
A group is entity, to which users can be assigned to. This can be used to logically group users by for example
organisational structures and to simplify permissions management, as you can define groups with access rights for common
use cases and then just assign users to them, without the need to change every permission on the users individually.
## Labels
### Label profiles
A label profile represents an template for a label (for a storelocation, a part or part lot). It consists of a size, an barcode type and the content. There are various placeholders which can be inserted in the text content and which will be used replaced with data for the actual thing.
You do not have to define a label profile to generate labels (you can just set the settings on the fly in the label dialog), however if you want to generate many labels, it is recommended to save the settings as label profile, to save it for later usage. This ensures that all generated labels look the same.
### Label profiles
A label profile represents a template for a label (for a storage location, a part or part lot). It consists of a size, a
barcode type and the content. There are various placeholders which can be inserted in the text content and which will be
used replaced with data for the actual thing.
You do not have to define a label profile to generate labels (you can just set the settings on the fly in the label
dialog), however if you want to generate many labels, it is recommended to save the settings as label profile, to save
it for later usage. This ensures that all generated labels look the same.

View File

@@ -6,99 +6,216 @@ nav_order: 5
# Configuration
Part-DBs behavior can be configured to your needs. There are different kind of configuration options: Options which are user changable (changable dynamically via frontend), options which can be configured by environment variables, and options which are only configurable via symfony config files.
Part-DBs behavior can be configured to your needs. There are different kind of configuration options: Options which are
user changeable (changeable dynamically via frontend), options which can be configured by environment variables, and
options which are only configurable via symfony config files.
## User changable
Following things can be changed for every user and a user can change it for himself (if he has the correct permission for it). Configuration is either possible via the users own setting page (where you can also change the password) or via the user admin page:
* **Language**: The language that the users prefers, and which will be used when no language is explicitly specified. Language can still always be changed via the language selector. By default the global configured language is used.
* **Timezone**: The timezone which the user resides in and in which all dates and times should be shown. By default the globally configured language.
## User changeable
Following things can be changed for every user and a user can change it for himself (if he has the correct permission
for it). Configuration is either possible via the users own setting page (where you can also change the password) or via
the user admin page:
* **Language**: The language that the users prefers, and which will be used when no language is explicitly specified.
Language can still always be changed via the language selector. By default, the global configured language is used.
* **Timezone**: The timezone which the user resides in and in which all dates and times should be shown. By default, the
globally configured language.
* **Theme**: The theme to use for the frontend. Allows the user to choose the frontend design, he prefers.
* **Prefered currency**: One of the defined currencies, in which all prices should be shown, if possible. Prices with other currencies will be converted to the price selected here
* **Preferred currency**: One of the defined currencies, in which all prices should be shown, if possible. Prices with
other currencies will be converted to the price selected here
## Environment variables (.env.local)
The following configuration options can only be changed by the server administrator, by either changing the server variables, changing the `.env.local` file or setting env for your docker container. Here are just the most important options listed, see `.env` file for full list of possible env variables.
The following configuration options can only be changed by the server administrator, by either changing the server
variables, changing the `.env.local` file or setting env for your docker container. Here are just the most important
options listed, see `.env` file for full list of possible env variables.
### General options
* `DATABASE_URL`: Configures the database which Part-DB uses. For mysql use a string in the form of `mysql://<USERNAME>:<PASSWORD>@<HOST>:<PORT>/<TABLE_NAME>` here (e.g. `DATABASE_URL=mysql://user:password@127.0.0.1:3306/part-db`. For sqlite use the following format to specify the absolute path where it should be located `sqlite:///path/part/app.db`. You can use `%kernel.project_dir%` as placeholder for the Part-DB root folder (e.g. `sqlite:///%kernel.project_dir%/var/app.db`)
* `DEFAULT_LANG`: The default language to use serverwide (when no language is explictly specified by a user or via language chooser). Must be something like `en`, `de`, `fr`, etc.
* `DEFAULT_TIMEZONE`: The default timezone to use globally, when a user has not timezone specified. Must be something like `Europe/Berlin`. See [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) under TZ Database name for a list of available options.
* `BASE_CURRENCY`: The currency to use internally for monetary values and when no currency is explictly specified. When migrating from a legacy Part-DB version, this should be the same as the currency in the old Part-DB instance (normally euro). This should be the currency you use the most. **Please note that you can not really change this setting after you have created data**. The value has to be a valid [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code, like `EUR` or `USD`.
* `INSTANCE_NAME`: The name of your installation. It will be shown as a title in the navbar and other places. By default `Part-DB`, but you can customize it to something likes `ExampleCorp. Inventory`.
* `ALLOW_ATTACHMENT_DOWNLOADS` (allowed values `0` or `1`): By setting this option to 1, users can make Part-DB directly download a file specified as an URL and create it as local file. Please not that this allows users access to all ressources publicly available to the server (so full access to other servers in the same local network), which could be a security risk.
* `USE_GRAVATAR`: Set to `1` to use [gravatar.com](gravatar.com) images for user avatars (as long as they have not set their own picture). The users browsers have to download the pictures from a third-party (gravatars) server, so this might be a privacy risk.
* `MAX_ATTACHMENT_FILE_SIZE`: The maximum file size (in bytes) for attachments. You can use the suffix `K`, `M` or `G` to specify the size in kilobytes, megabytes or gigabytes. By default `100M` (100 megabytes). Please note that this only the limit of Part-DB. You still need to configure the php.ini `upload_max_filesize` and `post_max_size` to allow bigger files to be uploaded.
* `DEFAULT_URI`: The default URI base to use for the Part-DB, when no URL can be determined from the browser request. This should be the primary URL/Domain, which is used to access Part-DB. This value is used to create correct links in emails and other places, where the URL is needed. It is also used, when SAML is enabled.s If you are using a reverse proxy, you should set this to the URL of the reverse proxy (e.g. `https://part-db.example.com`). **This value must end with a slash**.
* `ENFORCE_CHANGE_COMMENTS_FOR`: With this option you can configure, where users are enforced to give a change reason, which will be written to the log. This is a comma separated list of values (e.g. `part_edit,part_delete`). Leave empty to make change comments optional everywhere. Possible values are:
* `part_edit`: Edit operation of a existing part
* `part_delete`: Delete operation of a existing part
* `part_create`: Creation of a new part
* `part_stock_operation`: Stock operation on a part (therefore withdraw, add or move stock)
* `datastructure_edit`: Edit operation of a existing datastructure (e.g. category, manufacturer, ...)
* `datastructure_delete`: Delete operation of a existing datastructure (e.g. category, manufacturer, ...)
* `datastructure_create`: Creation of a new datastructure (e.g. category, manufacturer, ...)
* `DATABASE_URL`: Configures the database which Part-DB uses. For mysql use a string in the form
of `mysql://<USERNAME>:<PASSWORD>@<HOST>:<PORT>/<TABLE_NAME>` here
(e.g. `DATABASE_URL=mysql://user:password@127.0.0.1:3306/part-db`). For sqlite use the following format to specify the
absolute path where it should be located `sqlite:///path/part/app.db`. You can use `%kernel.project_dir%` as
placeholder for the Part-DB root folder (e.g. `sqlite:///%kernel.project_dir%/var/app.db`)
* `DEFAULT_LANG`: The default language to use server wide (when no language is explicitly specified by a user or via
language chooser). Must be something like `en`, `de`, `fr`, etc.
* `DEFAULT_TIMEZONE`: The default timezone to use globally, when a user has no timezone specified. Must be something
like `Europe/Berlin`. See [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) under TZ Database name
for a list of available options.
* `BASE_CURRENCY`: The currency to use internally for monetary values and when no currency is explicitly specified. When
migrating from a legacy Part-DB version, this should be the same as the currency in the old Part-DB instance (normally
euro). This should be the currency you use the most. **Please note that you can not really change this setting after
you have created data**. The value has to be a valid [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code,
like `EUR` or `USD`.
* `INSTANCE_NAME`: The name of your installation. It will be shown as a title in the navbar and other places. By
default `Part-DB`, but you can customize it to something likes `ExampleCorp. Inventory`.
* `ALLOW_ATTACHMENT_DOWNLOADS` (allowed values `0` or `1`): By setting this option to 1, users can make Part-DB directly
download a file specified as a URL and create it as local file. Please note that this allows users access to all
resources publicly available to the server (so full access to other servers in the same local network), which could
be a security risk.
* `USE_GRAVATAR`: Set to `1` to use [gravatar.com](https://gravatar.com/) images for user avatars (as long as they have
not set their own picture). The users browsers have to download the pictures from a third-party (gravatar) server, so
this might be a privacy risk.
* `MAX_ATTACHMENT_FILE_SIZE`: The maximum file size (in bytes) for attachments. You can use the suffix `K`, `M` or `G`
to specify the size in kilobytes, megabytes or gigabytes. By default `100M` (100 megabytes). Please note that this
only the limit of Part-DB. You still need to configure the php.ini `upload_max_filesize` and `post_max_size` to allow
bigger files to be uploaded.
* `DEFAULT_URI`: The default URI base to use for the Part-DB, when no URL can be determined from the browser request.
This should be the primary URL/Domain, which is used to access Part-DB. This value is used to create correct links in
emails and other places, where the URL is needed. It is also used, when SAML is enabled.s If you are using a reverse
proxy, you should set this to the URL of the reverse proxy (e.g. `https://part-db.example.com`). **This value must end
with a slash**.
* `ENFORCE_CHANGE_COMMENTS_FOR`: With this option you can configure, where users are enforced to give a change reason,
which will be written to the log. This is a comma separated list of values (e.g. `part_edit,part_delete`). Leave empty
to make change comments optional everywhere. Possible values are:
* `part_edit`: Edit operation of an existing part
* `part_delete`: Delete operation of an existing part
* `part_create`: Creation of a new part
* `part_stock_operation`: Stock operation on a part (therefore withdraw, add or move stock)
* `datastructure_edit`: Edit operation of an existing datastructure (e.g. category, manufacturer, ...)
* `datastructure_delete`: Delete operation of a existing datastructure (e.g. category, manufacturer, ...)
* `datastructure_create`: Creation of a new datastructure (e.g. category, manufacturer, ...)
* `CHECK_FOR_UPDATES` (default `1`): Set this to 0, if you do not want Part-DB to connect to GitHub to check for new
versions, or if your server can not connect to the internet.
### E-Mail settings
* `MAILER_DSN`: You can configure the mail provider which should be used for email delivery (see https://symfony.com/doc/current/components/mailer.html for full documentation). If you just want to use an SMTP mail account, you can use the following syntax `MAILER_DSN=smtp://user:password@smtp.mailserver.invalid:587`
* `EMAIL_SENDER_EMAIL`: The email address from which emails should be sent from (in most cases this has to be the same as the email address used for SMTP access)
* `EMAIL_SENDER_NAME`: Similar to `EMAIL_SENDER_EMAIL` but this allows you to specify the name from which the mails are sent from.
* `ALLOW_EMAIL_PW_RESET`: Set this value to true, if you wan to allow users to reset their password via an email notification. You have to configure the mailprovider first before via the MAILER_DSN setting.
* `MAILER_DSN`: You can configure the mail provider which should be used for email delivery (
see https://symfony.com/doc/current/components/mailer.html for full documentation). If you just want to use an SMTP
mail account, you can use the following syntax `MAILER_DSN=smtp://user:password@smtp.mailserver.invalid:587`
* `EMAIL_SENDER_EMAIL`: The email address from which emails should be sent from (in most cases this has to be the same
as the email address used for SMTP access)
* `EMAIL_SENDER_NAME`: Similar to `EMAIL_SENDER_EMAIL` but this allows you to specify the name from which the mails are
sent from.
* `ALLOW_EMAIL_PW_RESET`: Set this value to true, if you want to allow users to reset their password via an email
notification. You have to configure the mailprovider first before via the MAILER_DSN setting.
### Table related settings
* `TABLE_DEFAULT_PAGE_SIZE`: The default page size for tables. This is the number of rows which are shown per page. Set
to `-1` to disable pagination and show all rows at once.
* `TABLE_PARTS_DEFAULT_COLUMNS`: The columns in parts tables, which are visible by default (when loading table for first
time).
Also specify the default order of the columns. This is a comma separated list of column names. Available columns
are: `name`, `id`, `ipn`, `description`, `category`, `footprint`, `manufacturer`, `storage_location`, `amount`, `minamount`, `partUnit`, `addedDate`, `lastModified`, `needs_review`, `favorite`, `manufacturing_status`, `manufacturer_product_number`, `mass`, `tags`, `attachments`, `edit`.
### History/Eventlog related settings
The following options are used to configure, which (and how much) data is written to the system log:
* `HISTORY_SAVE_CHANGED_FIELDS`: When this option is set to true, the name of the fields which are changed, are saved to the DB (so for example it is logged that a user has changed, that the user has changed the name and description of the field, but not the data/content of these changes)
* `HISTORY_SAVE_CHANGED_DATA`: When this option is set to true, the changed data is saved to log (so it is logged, that a user has changed the name of a part and what the name was before). This can increase database size, when you have a lot of changes to enties.
* `HISTORY_SAVE_REMOVED_DATA`: When this option is set to true, removed data is saved to log, meaning that you can easily undelete an entity, when it was removed accidentally.
If you wanna use want to revert changes or view older revisions of entities, then `HISTORY_SAVE_CHANGED_FIELDS`, `HISTORY_SAVE_CHANGED_DATA` and `HISTORY_SAVE_REMOVED_DATA` all have to be true.
The following options are used to configure, which (and how much) data is written to the system log:
* `HISTORY_SAVE_CHANGED_FIELDS`: When this option is set to true, the name of the fields which are changed, are saved to
the DB (so for example it is logged that a user has changed, that the user has changed the name and description of the
field, but not the data/content of these changes)
* `HISTORY_SAVE_CHANGED_DATA`: When this option is set to true, the changed data is saved to log (so it is logged, that
a user has changed the name of a part and what the name was before). This can increase database size, when you have a
lot of changes to entities.
* `HISTORY_SAVE_REMOVED_DATA`: When this option is set to true, removed data is saved to log, meaning that you can
easily undelete an entity, when it was removed accidentally.
* `HISTORY_SAVE_NEW_DATA`: When this option is set to true, the new data (the data after a change) is saved to element
changed log entries. This allows you to easily see the changes between two revisions of an entity. This can increase
database size, when you have a lot of changes to entities.
If you want to use want to revert changes or view older revisions of entities,
then `HISTORY_SAVE_CHANGED_FIELDS`, `HISTORY_SAVE_CHANGED_DATA` and `HISTORY_SAVE_REMOVED_DATA` all have to be true.
### Error pages settings
* `ERROR_PAGE_ADMIN_EMAIL`: You can set an email-address here, which is shown on the error page, who should be contacted about the issue (e.g. an IT support email of your company)
* `ERROR_PAGE_SHOW_HELP`: Set this 0, to disable the solution hints shown on an error page. These hints should not contain senstive informations, but could confuse end-users.
* `ERROR_PAGE_ADMIN_EMAIL`: You can set an email-address here, which is shown on the error page, who should be contacted
about the issue (e.g. an IT support email of your company)
* `ERROR_PAGE_SHOW_HELP`: Set this 0, to disable the solution hints shown on an error page. These hints should not
contain sensitive information, but could confuse end-users.
### SAML SSO settings
The following settings can be used to enable and configure Single-Sign on via SAML. This allows users to login to Part-DB without entering a username and password, but instead they are redirected to a SAML Identity Provider (IdP) and are logged in automatically. This is especially useful, when you want to use Part-DB in a company, where all users have a SAML account (e.g. via Active Directory or LDAP).
You can find more advanced settings in the `config/packages/hslavich_onelogin_saml.yaml` file. Please note that this file is not backuped by the backup script, so you have to backup it manually, if you want to keep your changes. If you want to edit it on docker, you have to map the file to a volume.
* `SAML_ENABLED`: When this is set to 1, SAML SSO is enabled and the SSO Login button is shown in the login form. You have to configure the SAML settings below, before you can use this feature.
* `SAML_ROLE_MAPPING`: A [JSON](https://en.wikipedia.org/wiki/JSON) encoded map which specifies how Part-DB should convert the user roles given by SAML attribute `group` should be converted to a Part-DB group (specified by ID). You can use a wildcard `*` to map all otherwise unmapped roles to a certain group. Example: `{"*": 1, "admin": 2, "editor": 3}`. This would map all roles to the group with ID 1, except the role `admin`, which is mapped to the group with ID 2 and the role `editor`, which is mapped to the group with ID 3.
* `SAML_UPDATE_GROUP_ON_LOGIN`: When this is enabled the group of the user is updated on every login of the user based on the SAML role attributes. When this is disabled, the group is only assigned on the first login of the user, and a Part-DB administrator can change the group afterwards by editing the user.
* `SAML_IDP_ENTITY_ID`: The entity ID of your SAML Identity Provider (IdP). You can find this value in the metadata XML file or configuration UI of your IdP.
* `SAML_IDP_SINGLE_SIGN_ON_SERVICE`: The URL of the SAML IdP Single Sign-On Service (SSO). You can find this value in the metadata XML file or configuration UI of your IdP.
* `SAML_IDP_SINGLE_LOGOUT_SERVICE`: The URL of the SAML IdP Single Logout Service (SLO). You can find this value in the metadata XML file or configuration UI of your IdP.
* `SAML_IDP_X509_CERT`: The base64 encoded X.509 public certificate of your SAML IdP. You can find this value in the metadata XML file or configuration UI of your IdP. It should start with `MIIC` and end with `=`.
* `SAML_SP_ENTITY_ID`: The entity ID of your SAML Service Provider (SP). This is the value you have configured for the Part-DB client in your IdP.
* `SAML_SP_X509_CERT`: The public X.509 certificate of your SAML SP (here Part-DB). This is the value you have configured for the Part-DB client in your IdP. It should start with `MIIC` and end with `=`. IdPs like keycloak allows you to generate a public/private key pair for the client which you can setup here and in the `SAML_SP_PRIVATE_KEY` setting.
* `SAML_SP_PRIVATE_KEY`: The private key of your SAML SP (here Part-DB), corresponding the public key specified in `SAML_SP_X509_CERT`. This is the value you have configured for the Part-DB client in your IdP. It should start with `MIIE` and end with `=`. IdPs like keycloak allows you to generate a public/private key pair for the client which you can setup here and in the `SAML_SP_X509_CERT` setting.
The following settings can be used to enable and configure Single-Sign on via SAML. This allows users to log in to
Part-DB without entering a username and password, but instead they are redirected to a SAML Identity Provider (IdP) and
are logged in automatically. This is especially useful, when you want to use Part-DB in a company, where all users have
a SAML account (e.g. via Active Directory or LDAP).
You can find more advanced settings in the `config/packages/hslavich_onelogin_saml.yaml` file. Please note that this
file is not backed up by the backup script, so you have to back up it manually, if you want to keep your changes. If you
want to edit it on docker, you have to map the file to a volume.
* `SAML_ENABLED`: When this is set to 1, SAML SSO is enabled and the SSO Login button is shown in the login form. You
have to configure the SAML settings below, before you can use this feature.
* `SAML_ROLE_MAPPING`: A [JSON](https://en.wikipedia.org/wiki/JSON) encoded map which specifies how Part-DB should
convert the user roles given by SAML attribute `group` should be converted to a Part-DB group (specified by ID). You
can use a wildcard `*` to map all otherwise unmapped roles to a certain group.
Example: `{"*": 1, "admin": 2, "editor": 3}`. This would map all roles to the group with ID 1, except the
role `admin`, which is mapped to the group with ID 2 and the role `editor`, which is mapped to the group with ID 3.
* `SAML_UPDATE_GROUP_ON_LOGIN`: When this is enabled the group of the user is updated on every login of the user based
on the SAML role attributes. When this is disabled, the group is only assigned on the first login of the user, and a
Part-DB administrator can change the group afterward by editing the user.
* `SAML_IDP_ENTITY_ID`: The entity ID of your SAML Identity Provider (IdP). You can find this value in the metadata XML
file or configuration UI of your IdP.
* `SAML_IDP_SINGLE_SIGN_ON_SERVICE`: The URL of the SAML IdP Single Sign-On Service (SSO). You can find this value in
the metadata XML file or configuration UI of your IdP.
* `SAML_IDP_SINGLE_LOGOUT_SERVICE`: The URL of the SAML IdP Single Logout Service (SLO). You can find this value in the
metadata XML file or configuration UI of your IdP.
* `SAML_IDP_X509_CERT`: The base64 encoded X.509 public certificate of your SAML IdP. You can find this value in the
metadata XML file or configuration UI of your IdP. It should start with `MIIC` and end with `=`.
* `SAML_SP_ENTITY_ID`: The entity ID of your SAML Service Provider (SP). This is the value you have configured for the
Part-DB client in your IdP.
* `SAML_SP_X509_CERT`: The public X.509 certificate of your SAML SP (here Part-DB). This is the value you have
configured for the Part-DB client in your IdP. It should start with `MIIC` and end with `=`. IdPs like keycloak allows
you to generate a public/private key pair for the client which you can set up here and in the `SAML_SP_PRIVATE_KEY`
setting.
* `SAML_SP_PRIVATE_KEY`: The private key of your SAML SP (here Part-DB), corresponding the public key specified
in `SAML_SP_X509_CERT`. This is the value you have configured for the Part-DB client in your IdP. It should start
with `MIIE` and end with `=`. IdPs like keycloak allows you to generate a public/private key pair for the client which
you can set up here and in the `SAML_SP_X509_CERT` setting.
### Information provider settings
The settings prefixes with `PROVIDER_*` are used to configure the information providers.
See the [information providers]({% link usage/information_provider_system.md %}) page for more information.
### Other / less used options
* `TRUSTED_PROXIES`: Set the IP addresses (or IP blocks) of trusted reverse proxies here. This is needed to get correct IP informations (see [here](https://symfony.com/doc/current/deployment/proxies.html) for more info).
* `TRUSTED_HOSTS`: To prevent `HTTP Host header attacks` you can set a regex containing all host names via which Part-DB should be accessible. If accessed via the wrong hostname, an error will be shown.
* `DEMO_MODE`: Set Part-DB into demo mode, which forbids users to change their passwords and settings. Used for the demo instance, should not be needed for normal installations.
* `NO_URL_REWRITE_AVAILABLE` (allowed values `true` or `false`): Set this value to true, if your webserver does not support rewrite. In this case, all URL pathes will contain index.php/, which is needed then. Normally this setting do not need to be changed.
* `FIXER_API_KEY`: If you want to automatically retrieve exchange rates for base currencies other than euros, you have configure an exchange rate provider API. [Fixer.io](https://fixer.io/) is preconfigured, and you just have to register there and set the retrieved API key in this environment variable.
* `APP_ENV`: This value should always be set to `prod` in normal use. Set it to `dev` to enable debug/development mode. (**You should not do this on a publicly accessible server, as it will leak sensitive informations!**)
* `BANNER`: You can configure the text that should be shown as the banner on the homepage. Useful especially for docker container. In all other applications you can just change the `config/banner.md` file.
* `TRUSTED_PROXIES`: Set the IP addresses (or IP blocks) of trusted reverse proxies here. This is needed to get correct
IP information (see [here](https://symfony.com/doc/current/deployment/proxies.html) for more info).
* `TRUSTED_HOSTS`: To prevent `HTTP Host header attacks` you can set a regex containing all host names via which Part-DB
should be accessible. If accessed via the wrong hostname, an error will be shown.
* `DEMO_MODE`: Set Part-DB into demo mode, which forbids users to change their passwords and settings. Used for the demo
instance, should not be needed for normal installations.
* `NO_URL_REWRITE_AVAILABLE` (allowed values `true` or `false`): Set this value to true, if your webserver does not
support rewrite. In this case, all URL paths will contain index.php/, which is needed then. Normally this setting do
not need to be changed.
* `FIXER_API_KEY`: If you want to automatically retrieve exchange rates for base currencies other than euros, you have to
configure an exchange rate provider API. [Fixer.io](https://fixer.io/) is preconfigured, and you just have to register
there and set the retrieved API key in this environment variable.
* `APP_ENV`: This value should always be set to `prod` in normal use. Set it to `dev` to enable debug/development
mode. (**You should not do this on a publicly accessible server, as it will leak sensitive information!**)
* `BANNER`: You can configure the text that should be shown as the banner on the homepage. Useful especially for docker
container. In all other applications you can just change the `config/banner.md` file.
## Banner
To change the banner you can find on the homepage, you can either set the `BANNER` environment variable to the text you
want to show, or you can edit the `config/banner.md` file. The banner is written in markdown, so you can use all
markdown (and even some subset of HTML) syntax to format the text.
## parameters.yaml
You can also configure some options via the `config/parameters.yaml` file. This should normally not needed,
and you should know what you are doing, when you change something here. You should expect, that you will have to do some
manual merge, when you have changed something here and update to a newer version of Part-DB. It is possible that configuration
You can also configure some options via the `config/parameters.yaml` file. This should normally not need,
and you should know what you are doing, when you change something here. You should expect, that you will have to do some
manual merge, when you have changed something here and update to a newer version of Part-DB. It is possible that
configuration
options here will change or completely removed in future versions of Part-DB.
If you change something here, you have to clear the cache, before the changes will take effect with the command `bin/console cache:clear`.
If you change something here, you have to clear the cache, before the changes will take effect with the
command `bin/console cache:clear`.
The following options are available:
* `partdb.global_theme`: The default theme to use, when no user specific theme is set. Should be one of the themes from the `partdb.available_themes` config option.
* `partdb.locale_menu`: The codes of the languages, which should be shown in the language chooser menu (the one with the user icon in the navbar). The first language in the list will be the default language.
* `partdb.gpdr_compliance`: When set to true (default value), IP addresses which are saved in the database will be anonymized, by removing the last byte of the IP. This is required by the GDPR (General Data Protection Regulation) in the EU.
* `partdb.sidebar.items`: The panel contents which should be shown in the sidebar by default. You can also change the number of sidebar panels by changing the number of items in this list.
* `partdb.global_theme`: The default theme to use, when no user specific theme is set. Should be one of the themes from
the `partdb.available_themes` config option.
* `partdb.locale_menu`: The codes of the languages, which should be shown in the language chooser menu (the one with the
user icon in the navbar). The first language in the list will be the default language.
* `partdb.gdpr_compliance`: When set to true (default value), IP addresses which are saved in the database will be
anonymized, by removing the last byte of the IP. This is required by the GDPR (General Data Protection Regulation) in
the EU.
* `partdb.sidebar.items`: The panel contents which should be shown in the sidebar by default. You can also change the
number of sidebar panels by changing the number of items in this list.
* `partdb.sidebar.root_node_enable`: Show a root node in the sidebar trees, of which all nodes are children of
* `partdb.sidebar.root_expanded`: Expand the root node in the sidebar trees by default
* `partdb.available_themes`: The list of available themes a user can choose from.

View File

@@ -5,38 +5,50 @@ nav_order: 0
---
# Part-DB
Part-DB is an Open-Source inventory management system for your electronic components.
It is installed on a web server and so can be accessed with any browser without the need to install additional software.
{: .important-title }
> Demo
>
> If you want to test Part-DB without installing it, you can use [this](https://part-db.herokuapp.com) Heroku instance.
> (Or this link for the [German Version](https://part-db.herokuapp.com/de/)).
>
> If you want to test Part-DB without installing it, you can use [this](https://part-db.herokuapp.com) Heroku instance.
> (Or this link for the [German Version](https://part-db.herokuapp.com/de/)).
>
> You can log in with username: **user** and password: **user**, to change/create data.
>
> Every change to the master branch gets automatically deployed, so it represents the currenct development progress and is
> maybe not completly stable. Please mind, that the free Heroku instance is used, so it can take some time when loading the page
> Every change to the master branch gets automatically deployed, so it represents the current development progress and
> is
> maybe not completely stable. Please mind, that the free Heroku instance is used, so it can take some time when loading
> the page
> for the first time.
## Features
* Inventory management of your electronic parts. Each part can be assigned to a category, footprint, manufacturer
and multiple store locations and price information. Parts can be grouped using tags. You can associate various files like datasheets or pictures with the parts.
and multiple store locations and price information. Parts can be grouped using tags. You can associate various files
like datasheets or pictures with the parts.
* Multi-Language support (currently German, English, Russian, Japanese and French (experimental))
* Barcodes/Labels generator for parts and storage locations, scan barcodes via webcam using the builtin barcode scanner
* User system with groups and detailed (fine granular) permissions.
Two-factor authentication is supported (Google Authenticator and Webauthn/U2F keys) and can be enforced for groups. Password reset via email can be setuped.
* Optional support for single sign-on (SSO) via SAML (using an intermediate service like [Keycloak](https://www.keycloak.org/) you can connect Part-DB to an existing LDAP or Active Directory server)
Two-factor authentication is supported (Google Authenticator and Webauthn/U2F keys) and can be enforced for groups.
Password reset via email can be setup.
* Optional support for single sign-on (SSO) via SAML (using an intermediate service
like [Keycloak](https://www.keycloak.org/) you can connect Part-DB to an existing LDAP or Active Directory server)
* Import/Export system
* Project management: Create projects and assign parts to the bill of material (BOM), to show how often you could build this project and directly withdraw all components needed from DB
* Event log: Track what changes happens to your inventory, track which user does what. Revert your parts to older versions.
* Project management: Create projects and assign parts to the bill of material (BOM), to show how often you could build
this project and directly withdraw all components needed from DB
* Event log: Track what changes happens to your inventory, track which user does what. Revert your parts to older
versions.
* Responsive design: You can use Part-DB on your PC, your tablet and your smartphone using the same interface.
* MySQL and SQLite supported as database backends
* Support for rich text descriptions and comments in parts
* Support for multiple currencies and automatic update of exchange rates supported
* Powerful search and filter function, including parametric search (search for parts according to some specifications)
* Easy migration from an existing PartKeepr instance (see [here]({%link partkeepr_migration.md %}))
* Use cloud providers (like Octopart, Digikey, farnell or TME) to automatically get part information, datasheets and
prices for parts (see [here]({% link usage/information_provider_system.md %}))
* API to access Part-DB from other applications/scripts
With these features Part-DB is useful to hobbyists, who want to keep track of their private electronic parts inventory,
or makerspaces, where many users have should have (controlled) access to the shared inventory.
@@ -44,25 +56,31 @@ or makerspaces, where many users have should have (controlled) access to the sha
Part-DB is also used by small companies and universities for managing their inventory.
## License
Part-DB is licensed under the GNU Affero General Public License v3.0 (or at your opinion any later).
This mostly means that you can use Part-DB for whatever you want (even use it commercially)
as long as you publish the source code for every change you make under the AGPL, too.
See [LICENSE](https://github.com/Part-DB/Part-DB-symfony/blob/master/LICENSE) for more informations.
See [LICENSE](https://github.com/Part-DB/Part-DB-symfony/blob/master/LICENSE) for more information.
## Donate for development
If you want to donate to the Part-DB developer, see the sponsor button in the top bar (next to the repo name).
There you will find various methods to support development on a monthly or a one time base.
## Built with
* [Symfony 5](https://symfony.com/): The main framework used for the serverside PHP
* [Bootstrap 5](https://getbootstrap.com/) and [Bootswatch](https://bootswatch.com/): Used as website theme
* [Fontawesome](https://fontawesome.com/): Used as icon set
* [Hotwire Stimulus](https://stimulus.hotwired.dev/) and [Hotwire Turbo](https://turbo.hotwired.dev/): Frontend Javascript
* [Hotwire Stimulus](https://stimulus.hotwired.dev/) and [Hotwire Turbo](https://turbo.hotwired.dev/): Frontend
Javascript
## Authors
* **Jan Böhmer** - *Inital work and Maintainer* - [Github](https://github.com/jbtronics/)
See also the list of [contributors](https://github.com/Part-DB/Part-DB-symfony/graphs/contributors) who participated in this project.
* **Jan Böhmer** - *Initial work and Maintainer* - [GitHub](https://github.com/jbtronics/)
See also the list of [contributors](https://github.com/Part-DB/Part-DB-symfony/graphs/contributors) who participated in
this project.
Based on the original Part-DB by Christoph Lechner and K. Jacobs

View File

@@ -7,24 +7,38 @@ nav_order: 1
# Choosing database: SQLite or MySQL
Part-DB saves its data in a [relational (SQL) database](https://en.wikipedia.org/wiki/Relational_database). Part-DB supports either the use of [SQLite](https://www.sqlite.org/index.html) or [MySQL](https://www.mysql.com/) / [MariaDB](https://mariadb.org/) (which are mostly the same, except for some minor differences).
Part-DB saves its data in a [relational (SQL) database](https://en.wikipedia.org/wiki/Relational_database). Part-DB
supports either the use of [SQLite](https://www.sqlite.org/index.html)
or [MySQL](https://www.mysql.com/) / [MariaDB](https://mariadb.org/) (which are mostly the same, except for some minor
differences).
{: .important }
You have to choose between the database types before you start using Part-DB and **you can not change it (easily) after you have started creating data**. So you should choose the database type for your usecase (and possible future uses).
You have to choose between the database types before you start using Part-DB and **you can not change it (easily) after
you have started creating data**. So you should choose the database type for your use case (and possible future uses).
## Comparison
**SQLite** is the default database type which is configured out of the box. All data is saved in a single file (normally `var/app.db` in the Part-DB folder) and no additional installation or configuration besides Part-DB is needed.
To use **MySQL/MariaDB** as database, you have to install and configure the MySQL server, configure it and create a database and user for Part-DB, which needs some additional work. When using docker you need an additional docker container, and volume for the data
**SQLite** is the default database type which is configured out of the box. All data is saved in a single file (
normally `var/app.db` in the Part-DB folder) and no additional installation or configuration besides Part-DB is needed.
To use **MySQL/MariaDB** as database, you have to install and configure the MySQL server, configure it and create a
database and user for Part-DB, which needs some additional work. When using docker you need an additional docker
container, and volume for the data
When using **SQLite** The database can be backuped easily by just copying the SQLite file to a safe place. Ideally the **MySQL** database has to be dumped to a SQL file (using `mysqldump`). The `console partdb:backup` command can do this automatically
However SQLite does not support certain operations like regex search, which has to be emulated by PHP and therefore are pretty slow compared to the same operation at MySQL. In future there might be features that may only be available, when using MySQL.
When using **SQLite** The database can be backuped easily by just copying the SQLite file to a safe place. Ideally the *
*MySQL** database has to be dumped to a SQL file (using `mysqldump`). The `console partdb:backup` command can do this
automatically
In general MySQL might perform better for big Part-DB instances with many entries, lots of users and high activity, than SQLite.
However, SQLite does not support certain operations like regex search, which has to be emulated by PHP and therefore are
pretty slow compared to the same operation at MySQL. In future there might be features that may only be available, when
using MySQL.
In general MySQL might perform better for big Part-DB instances with many entries, lots of users and high activity, than
SQLite.
## Conclusion and Suggestion
When you are a hobbyist and use Part-DB for your own small inventory managment with only you as user (or maybe sometimes a few other people), then the easy to use SQLite database will be fine.
When you are a hobbyist and use Part-DB for your own small inventory management with only you as user (or maybe sometimes
a few other people), then the easy-to-use SQLite database will be fine.
When you are planning to have a very big database, with a lot of entries and many users which regulary (and concurrently) using Part-DB you should maybe use MySQL as this will scale better.
When you are planning to have a very big database, with a lot of entries and many users which regularly (and
concurrently) using Part-DB you should maybe use MySQL as this will scale better.

View File

@@ -7,31 +7,34 @@ nav_order: 12
# Email
Part-DB can communicate with its users via email.
Part-DB can communicate with its users via email.
At the moment this is only used to send password reset links, but in future this will be used for other things too.
To make emails work you have to properly configure a mail provider in Part-DB.
## Configuration
Part-DB uses [Symfony Mailer](https://symfony.com/doc/current/mailer.html) to send emails, which supports multiple
automatic mail providers (like MailChimp or SendGrid). If you want to use one of these providers, check the Symfony Mailer documentation for more information.
We will only cover the configuration of a SMTP provider here, which is sufficient for most usecases.
You will need an email account, which you can use send emails from via password-bases SMTP authentication, this account
Part-DB uses [Symfony Mailer](https://symfony.com/doc/current/mailer.html) to send emails, which supports multiple
automatic mail providers (like MailChimp or SendGrid). If you want to use one of these providers, check the Symfony
Mailer documentation for more information.
We will only cover the configuration of an SMTP provider here, which is sufficient for most use-cases.
You will need an email account, which you can use send emails from via password-bases SMTP authentication, this account
should be dedicated to Part-DB.
To configure the SMTP provider, you have to set the following environment variables:
`MAILER_DSN`: You have to provide the SMTP server address and the credentials for the email account here. The format is the following:
`smtp://<username>:<password>@<smtp-server-address>:<port>`. In most cases the username is the email address of the account, and the port is 587.
`MAILER_DSN`: You have to provide the SMTP server address and the credentials for the email account here. The format is
the following:
`smtp://<username>:<password>@<smtp-server-address>:<port>`. In most cases the username is the email address of the
account, and the port is 587.
So the resulting DSN could look like this: `smtp://j.doe@mail.invalid:SUPER_SECRET_PA$$WORD@smtp.mail.invalid:587`.
`EMAIL_SENDER_EMAIL`: This is the email address which will be used as sender address for all emails sent by Part-DB.
This should be the same email address as the one used in the `MAILER_DSN` (the email adress of your email account):
This should be the same email address as the one used in the `MAILER_DSN` (the email address of your email account):
e.g. `j.doe@mail.invalid`.
`EMAIL_SENDER_NAME`: This is the name which will be used as sender name for all emails sent by Part-DB.
`EMAIL_SENDER_NAME`: This is the name which will be used as sender name for all emails sent by Part-DB.
This can be anything you want, e.g. `My Part-DB Mailer`.
Now you can enable the possibility to reset password by setting the `ALLOW_EMAIL_PW_RESET` env to `1` (or `true`).

View File

@@ -7,17 +7,18 @@ nav_order: 2
# Installation of Part-DB via docker
Part-DB can be installed containerized via docker. This is the easiest way to get Part-DB up and running and works on all platforms,
where docker is available (especially recommended for Windows and MacOS).
Part-DB can be installed containerized via docker. This is the easiest way to get Part-DB up and running and works on
all platforms,
where docker is available (especially recommended for Windows and macOS).
{: .warning }
> The methods described here, configure PHP without HTTPS and therefore should only be used locally in a trusted network.
> The methods described here, configure PHP without HTTPS and therefore should only be used locally in a trusted
> network.
> If you want to expose Part-DB to the internet, you have to configure a reverse proxy with an SSL certificate!
## Docker-compose
Docker-compose configures the needed images and automatically creates the needed containers and volumes.
Docker-compose configures the needed images and automatically creates the needed containers and volumes.
1. Install docker and docker-compose like described under https://docs.docker.com/compose/install/
2. Create a folder where the Part-DB data should live
@@ -68,19 +69,28 @@ services:
# When this is empty the content of config/banner.md is used as banner
#- BANNER=This is a test banner<br>with a line break
```
4. Customize the settings by changing the environment variables (or add new ones). See [Configuration]({% link configuration.md %}) for more information.
4. Customize the settings by changing the environment variables (or add new ones). See [Configuration]({% link
configuration.md %}) for more information.
5. Inside the folder, run
```bash
docker-compose up -d
```
6. Create the inital database with
6. Create the initial database with
```bash
docker exec --user=www-data partdb php bin/console doctrine:migrations:migrate
```
and watch for the password output
6. Part-DB is available under `http://localhost:8080` and you can log in with username `admin` and the password shown before
The docker image uses a SQLite database and all data (database, uploads and other media) is put into folders relative to the docker-compose.yml.
and watch for the password output
6. Part-DB is available under `http://localhost:8080` and you can log in with username `admin` and the password shown
before
The docker image uses a SQLite database and all data (database, uploads and other media) is put into folders relative to
the docker-compose.yml.
### MySQL
@@ -156,8 +166,10 @@ services:
```
### Update Part-DB
You can update Part-DB by pulling the latest image and restarting the container.
Then you have to run the database migrations again
```bash
docker-compose pull
docker-compose up -d
@@ -165,19 +177,26 @@ docker exec --user=www-data partdb php bin/console doctrine:migrations:migrate
```
## Direct use of docker image
You can use the `jbtronics/part-db1:master` image directly. You have to expose the port 80 to a host port and configure volumes for `/var/www/html/uploads` and `/var/www/html/public/media`.
If you want to use SQLite database (which is default), you have to configure Part-DB to put the database file in a mapped volume via the `DATABASE_URL` environment variable.
For example if you set `DATABASE_URL=sqlite:///%kernel.project_dir%/var/db/app.db` then you will have to map the `/var/www/html/var/db/` folder to the docker container (see docker-compose.yaml for example).
You can use the `jbtronics/part-db1:master` image directly. You have to expose the port 80 to a host port and configure
volumes for `/var/www/html/uploads` and `/var/www/html/public/media`.
If you want to use SQLite database (which is default), you have to configure Part-DB to put the database file in a
mapped volume via the `DATABASE_URL` environment variable.
For example if you set `DATABASE_URL=sqlite:///%kernel.project_dir%/var/db/app.db` then you will have to map
the `/var/www/html/var/db/` folder to the docker container (see docker-compose.yaml for example).
You also have to create the database like described above in step 4.
## Running console commands
You can run the console commands described in README by executing `docker exec --user=www-data -it partdb bin/console [command]`
You can run the console commands described in README by
executing `docker exec --user=www-data -it partdb bin/console [command]`
## Troubleshooting
*Login not possible. Login page is just reloading and no error message is shown or something like "CSFR token invalid"*:
Clear all cookies in your browser or use a inkognito tab for Part-DB.
This related to the fact that Part-DB can not set cookies via HTTP, after some webpage has set cookies before under localhost via https. This is a security mechanism of the browser and can not be bypassed by Part-DB.
Clear all cookies in your browser or use an inkognito tab for Part-DB.
This related to the fact that Part-DB can not set cookies via HTTP, after some webpage has set cookies before under
localhost via https. This is a security mechanism of the browser and can not be bypassed by Part-DB.

View File

@@ -6,25 +6,38 @@ nav_order: 4
---
# Part-DB installation guide for Debian 11 (Bullseye)
This guide shows you how to install Part-DB directly on Debian 11 using apache2 and SQLite. This guide should work with recent Ubuntu and other Debian based distributions with little to no changes.
Depending on what you want to do, using the prebuilt docker images may be a better choice, as you dont need to install this much dependencies. See **TODO** for more information of the docker installation.
This guide shows you how to install Part-DB directly on Debian 11 using apache2 and SQLite. This guide should work with
recent Ubuntu and other Debian based distributions with little to no changes.
Depending on what you want to do, using the prebuilt docker images may be a better choice, as you don't need to install
this many dependencies. See [here]({% link installation/installation_docker.md %}) for more information of the docker
installation.
{: .warning }
> The methods described here, configure PHP without HTTPS and therefore should only be used locally in a trusted network.
> The methods described here, configure PHP without HTTPS and therefore should only be used locally in a trusted
> network.
> If you want to expose Part-DB to the internet, you HAVE to configure an SSL connection!
## Installation with SQLite database
### Install prerequisites
For the installation of Part-DB, we need some prerequisites. They can be installed by running the following command:
```bash
sudo apt install git curl zip ca-certificates software-properties-common apt-transport-https lsb-release nano wget
```
### Install PHP and apache2
Part-DB is written in [PHP](https://php.net) and therefore needs an PHP interpreter to run. Part-DB needs PHP 7.3 or higher, however it is recommended to use the most recent version of PHP for performance reasons and future compatibility.
As Debian 11 does not ship PHP 8.1 in it's default repositories, we have to add a repository for it. You can skip this step if your distribution is shipping a recent version of PHP or you want to use the built-in PHP version.
Part-DB is written in [PHP](https://php.net) and therefore needs an PHP interpreter to run. Part-DB needs PHP 8.1 or
higher, however it is recommended to use the most recent version of PHP for performance reasons and future
compatibility.
As Debian 11 does not ship PHP 8.1 in its default repositories, we have to add a repository for it. You can skip this
step if your distribution is shipping a recent version of PHP or you want to use the built-in PHP version. If you are
using Debian 12, you can skip this step, as PHP 8.1 is already included in the default repositories.
```bash
# Add sury repository for PHP 8.1
sudo curl -sSL https://packages.sury.org/php/README.txt | sudo bash -x
@@ -32,14 +45,21 @@ sudo curl -sSL https://packages.sury.org/php/README.txt | sudo bash -x
# Update package list
sudo apt update && sudo apt upgrade
```
Now you can install PHP 8.1 and required packages (change the 8.1 in the package version according to the version you want to use):
Now you can install PHP 8.1 and required packages (change the 8.1 in the package version according to the version you
want to use):
```bash
sudo apt install php8.1 libapache2-mod-php8.1 php8.1-opcache php8.1-curl php8.1-gd php8.1-mbstring php8.1-xml php8.1-bcmath php8.1-intl php8.1-zip php8.1-xsl php8.1-sqlite3 php8.1-mysql
```
The apache2 webserver should be already installed with this command and configured basically.
### Install composer
Part-DB uses [composer](https://getcomposer.org/) to install required PHP libraries. As the versions shipped in the repositories is pretty old we install it manually:
Part-DB uses [composer](https://getcomposer.org/) to install required PHP libraries. As the versions shipped in the
repositories is pretty old we install it manually:
```bash
# Download composer installer script
wget -O /tmp/composer-setup.php https://getcomposer.org/installer
@@ -50,7 +70,10 @@ chmod +x /usr/local/bin/composer
```
### Install yarn and nodejs
To build the frontend (the user interface) Part-DB uses [yarn](https://yarnpkg.com/). As it dependens on nodejs and the shipped versions are pretty old, we install new versions from offical nodejs repository:
To build the frontend (the user interface) Part-DB uses [yarn](https://yarnpkg.com/). As it depends on Node.js and the
shipped versions are pretty old, we install new versions from official Node.js repository:
```bash
# Add recent node repository (nodejs 18 is supported until 2025)
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
@@ -59,6 +82,7 @@ sudo apt install nodejs
```
We can install yarn with the following commands:
```bash
# Add yarn repository
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
@@ -68,35 +92,64 @@ sudo apt update && sudo apt install yarn
```
### Create a folder for Part-DB and download it
We now have all prerequisites installed and can start to install Part-DB. We will create a folder for Part-DB in a webfolder of apache2 and download it to this folder. The downloading is done via git, which allows you to update easily later.
We now have all prerequisites installed and can start to install Part-DB. We will create a folder for Part-DB in the
webroot of apache2 and download it to this folder. The downloading is done via git, which allows you to update easily
later.
```bash
# Download Part-DB into the new folder /var/www/partdb
git clone https://github.com/Part-DB/Part-DB-symfony.git /var/www/partdb
```
By default, you are now on the latest development version. In most cases you want to use the latest stable version. You
can switch to the latest stable version (tagged) by running the following command:
```bash
# This finds the latest release/tag and checks it out
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
```
Alternatively you can check out a specific version by running (
see [GitHub Releases page](https://github.com/Part-DB/Part-DB-server/releases) for a list of available versions):
```bash
# This checks out the version 1.5.2
git checkout v1.5.2
```
Change ownership of the files to the apache user:
```bash
chown -R www-data:www-data /var/www/partdb
```
For the next steps we should be in the Part-DB folder, so move into it:
```bash
cd /var/www/partdb
```
### Create configuration for Part-DB
The basic configuration of Part-DB is done by a `.env.local` file in the main directory. Create on by from the default configuration:
The basic configuration of Part-DB is done by a `.env.local` file in the main directory. Create on by from the default
configuration:
```bash
cp .env .env.local
```
In your `.env.local` you can configure Part-DB according to your wishes. A full list of configuration options can be found [here]({% link configuration.md %}.
In your `.env.local` you can configure Part-DB according to your wishes. A full list of configuration options can be
found [here](../configuration.md).
Other configuration options like the default language or default currency can be found in `config/parameters.yaml`.
Please check that the `partdb.default_currency` value in `config/parameters.yaml` matches your mainly used currency, as this can not be changed after creating price informations.
Please check that the `partdb.default_currency` value in `config/parameters.yaml` matches your mainly used currency, as
this can not be changed after creating price information.
### Install dependencies for Part-DB and build frontend
Part-DB depends on several other libraries and components. Install them by running the following commands:
```bash
# Install composer dependencies (please note the sudo command, to run it under the web server user)
sudo -u www-data composer install --no-dev -o
@@ -110,32 +163,48 @@ sudo yarn build
### Clear cache
To ensure everything is working, clear the cache:
```bash
sudo -u www-data php bin/console cache:clear
```
### Check if everything is installed
To check if everything is installed, run the following command:
```bash
sudo -u www-data php bin/console partdb:check-requirements
```
The most things should be green, and no red ones. Yellow messages means optional dependencies which are not important but can improve performance and functionality.
The most things should be green, and no red ones. Yellow messages means optional dependencies which are not important
but can improve performance and functionality.
### Create a database for Part-DB
Part-DB by default uses a file based sqlite database to store the data. Use the following command to create the database. The database will normally created at `/var/www/partdb/var/app.db`.
Part-DB by default uses a file based sqlite database to store the data. Use the following command to create the
database. The database will normally be created at `/var/www/partdb/var/app.db`.
```bash
sudo -u www-data php bin/console doctrine:migrations:migrate
```
The command will warn you about schema changes and potential data loss. Continue with typing `yes`.
The command will output several lines of informations. Somewhere should be a a yellow background message like `The initial password for the "admin" user is: f502481134`. Write down this password as you will need it later for inital login.
The command will output several lines of information. Somewhere should be a yellow background message
like `The initial password for the "admin" user is: f502481134`. Write down this password as you will need it later for
initial login.
### Configure apache2 to show Part-DB
Part-DB is now configured, but we have to say apache2 to serve Part-DB as web application. This is done by creating a new apache site:
Part-DB is now configured, but we have to say apache2 to serve Part-DB as web application. This is done by creating a
new apache site:
```bash
sudo nano /etc/apache2/sites-available/partdb.conf
```
and add the following content (change ServerName and ServerAlias to your needs):
```
<VirtualHost *:80>
ServerName partdb.lan
@@ -152,38 +221,53 @@ and add the following content (change ServerName and ServerAlias to your needs):
CustomLog /var/log/apache2/partdb_access.log combined
</VirtualHost>
```
Activate the new site by:
```bash
sudo ln -s /etc/apache2/sites-available/partdb.conf /etc/apache2/sites-enabled/partdb.conf
```
Configure apache to show pretty URL pathes for Part-DB (`/label/dialog` instead of `/index.php/label/dialog`):
Configure apache to show pretty URL paths for Part-DB (`/label/dialog` instead of `/index.php/label/dialog`):
```bash
sudo a2enmod rewrite
```
If you want to access Part-DB via the IP-Address of the server, instead of the domain name, you have to remove the apache2 default configuration with:
If you want to access Part-DB via the IP-Address of the server, instead of the domain name, you have to remove the
apache2 default configuration with:
```bash
sudo rm /etc/apache2/sites-enabled/000-default.conf
```
Restart the apache2 webserver with:
```bash
sudo service apache2 restart
```
and Part-DB should now be available under `http://YourServerIP` (or `http://partdb.lan` if you configured DNS in your network to point on the server).
and Part-DB should now be available under `http://YourServerIP` (or `http://partdb.lan` if you configured DNS in your
network to point on the server).
### Login to Part-DB
Navigate to the Part-DB web interface and login via the user icon in the top right corner. You can login using the username `admin` and the password you have written down earlier.
Navigate to the Part-DB web interface and login via the user icon in the top right corner. You can log in using the
username `admin` and the password you have written down earlier.
## Update Part-DB
If you want to update your existing Part-DB installation, you just have to run the following commands:
```bash
# Move into Part-DB folder
cd /var/www/partdb
# Pull latest Part-DB version from GitHub
git pull
# Checkout the latest version (or use a specific version, like described above)
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
# Apply correct permission
chown -R www-data:www-data .
# Install new composer dependencies
@@ -203,6 +287,7 @@ sudo -u www-data php bin/console cache:clear
```
## MySQL/MariaDB database
To use a MySQL database, follow the steps from above (except the creation of database, we will do this later).
Debian 11 does not ship MySQL in its repositories anymore, so we use the compatible MariaDB instead:
@@ -213,9 +298,11 @@ sudo apt update && sudo apt install mariadb-server
```
2. Configure maria-db with:
```bash
sudo mysql_secure_installation
```
When asked for the root password, just press enter, as we have not set a root password yet.
In the next steps you are asked if you want to switch to unix_socket authentication, answer with `n` and press enter.
Then you are asked if you want to remove anonymous users, answer with `y` and press enter.
@@ -224,33 +311,42 @@ Then you are asked if you want to remove the test database and access to it, ans
Then you are asked if you want to reload the privilege tables now, answer with `y` and press enter.
3. Create a new database and user for Part-DB: Run the following commands:
```bash
sudo mariadb
```
A SQL shell will open, in which you can run the following commands to create a new database and user for Part-DB.
Replace 'YOUR_SECRET_PASSWORD' with a secure password.
```sql
CREATE DATABASE partdb;
GRANT ALL PRIVILEGES ON partdb.* TO 'partdb'@'localhost' IDENTIFIED BY 'YOUR_SECRET_PASSWORD';
```
Finally save the changes with:
Finally, save the changes with:
```sql
FLUSH PRIVILEGES;
```
and exit the SQL shell with:
```sql
exit
```
4. Configure Part-DB to use the new database. Open your `.env.local` file and search the line `DATABASE_URL`.
Change it to the following (you have to replace `YOUR_SECRET_PASSWORD` with the password you have choosen in step 3):
Change it to the following (you have to replace `YOUR_SECRET_PASSWORD` with the password you have chosen in step 3):
```
DATABASE_URL=DATABASE_URL=mysql://partdb:YOUR_SECRET_PASSWORD@127.0.0.1:3306/partdb
```
5. Create the database schema with:
```bash
sudo -u www-data php bin/console doctrine:migrations:migrate
```
6. The migration step should have shown you a password for the admin user, which you can use now to login to Part-DB.
6. The migration step should have shown you a password for the admin user, which you can use now to log in to Part-DB.

View File

@@ -6,14 +6,18 @@ nav_order: 10
---
# Nginx
You can also use [nginx](https://www.nginx.com/) as webserver for Part-DB. Setup Part-DB with apache is a bit easier, so
this is the method shown in the guides. This guide assumes that you already have a working nginx installation with PHP
configured.
## Setup
1. Install composer and yarn like described in the [apache guide]({% link installation/installation_guide-debian.md %}#install-composer).
1. Install composer and yarn like described in the [apache guide]({% link installation/installation_guide-debian.md
%}#install-composer).
2. Create a folder for Part-DB and install and configure it as described
3. Instead of creating the config for apache, add the following snippet to your nginx config:
```nginx
server {
# Redirect all HTTP requests to HTTPS
@@ -64,4 +68,6 @@ server {
ssl_prefer_server_ciphers on;
}
```
4. Restart nginx with `sudo systemctl restart nginx` and you should be able to access Part-DB under your configured domain.
4. Restart nginx with `sudo systemctl restart nginx` and you should be able to access Part-DB under your configured
domain.

View File

@@ -9,13 +9,15 @@ nav_order: 11
If you want to put Part-DB behind a reverse proxy, you have to configure Part-DB correctly to make it work properly.
You have to set the `TRUSTED_PROXIES` environment variable to the IP address of your reverse proxy
(either in your `docker-compose.yaml` in the case of docker, or `.env.local` in case of direct installation).
You have to set the `TRUSTED_PROXIES` environment variable to the IP address of your reverse proxy
(either in your `docker-compose.yaml` in the case of docker, or `.env.local` in case of direct installation).
If you have multiple reverse proxies, you can set multiple IP addresses separated by a comma (or specify a range).
For example, if your reverse proxy has the IP address `192.168.2.10`, your value should be:
For example, if your reverse proxy has the IP address `192.168.2.10`, your value should be:
```
TRUSTED_PROXIES=192.168.2.10
```
Set the `DEFAULT_URI` environment variable to the URL of your Part-DB installation, available from the outside (so via the reverse proxy).
Set the `DEFAULT_URI` environment variable to the URL of your Part-DB installation, available from the outside (so via
the reverse proxy).

View File

@@ -7,42 +7,55 @@ nav_order: 12
# Single Sign-On via SAML
Part-DB supports Single Sign-On via SAML. This means that you can use your existing SAML identity provider to log in to Part-DB.
Using an intermediate SAML server like [Keycloak](https://www.keycloak.org/), also allows you to connect Part-DB to a LDAP or Active Directory server.
Part-DB supports Single Sign-On via SAML. This means that you can use your existing SAML identity provider to log in to
Part-DB.
Using an intermediate SAML server like [Keycloak](https://www.keycloak.org/), also allows you to connect Part-DB to an
LDAP or Active Directory server.
{: .important }
> This feature is for advanced users only. Single Sign-On is useful for large organizations with many users, which are already using SAML for other services.
> This feature is for advanced users only. Single Sign-On is useful for large organizations with many users, which are
> already using SAML for other services.
> If you have only one or a few users, you should use the built-in authentication system of Part-DB.
> This guide assumes that you already have an SAML identity provider set up and working, and have a basic understanding of how SAML works.
> This guide assumes that you already have an SAML identity provider set up and working, and have a basic understanding
> of how SAML works.
{: .warning }
> This feature is currently in beta. Please report any bugs you find.
> So far it has only tested with Keycloak, but it should work with any SAML 2.0 compatible identity provider.
This guide will show you how to configure Part-DB with [Keycloak](https://www.keycloak.org/) as the SAML identity provider,
but it should work with any SAML 2.0 compatible identity provider.
This guide will show you how to configure Part-DB with [Keycloak](https://www.keycloak.org/) as the SAML identity
provider, but it should work with any SAML 2.0 compatible identity provider.
This guide assumes that you have a working Keycloak installation with some users. If you don't, you can follow the [Keycloak Getting Started Guide](https://www.keycloak.org/docs/latest/getting_started/index.html).
This guide assumes that you have a working Keycloak installation with some users. If you don't, you can follow
the [Keycloak Getting Started Guide](https://www.keycloak.org/docs/latest/getting_started/index.html).
{: .important }
> Part-DB associates local users with SAML users by their username. That means if the username of a SAML user changes, a new local user will be created (and the old account can not be accessed).
> You should make sure that the username of a SAML user does not change. If you use Keycloak make sure that the possibility to change the username is disabled (which is by default).
> If you really have to rename a SAML user, a Part-DB admin can rename the local user in the Part-DB in the admin panel, to match the new username of the SAML user.
> Part-DB associates local users with SAML users by their username. That means if the username of a SAML user changes, a
> new local user will be created (and the old account can not be accessed).
> You should make sure that the username of a SAML user does not change. If you use Keycloak make sure that the
> possibility to change the username is disabled (which is by default).
> If you really have to rename a SAML user, a Part-DB admin can rename the local user in the Part-DB in the admin panel,
> to match the new username of the SAML user.
## Configure basic SAML connection
### Create a new SAML client
1. First, you need to configure a new SAML client in Keycloak. Login in to your Keycloak admin console and go to the `Clients` page.
2. Click on `Create client` and select `SAML` as type from the dropdown menu. For the client ID, you can use anything you want, but it should be unique.
*It is recommended to set this value to the domain name of your Part-DB installation, with an attached `/sp` (e.g. `https://partdb.yourdomain.invalid/sp`)*.
The name field should be set to something human-readable, like `Part-DB`.
1. First, you need to configure a new SAML client in Keycloak. Login in to your Keycloak admin console and go to
the `Clients` page.
2. Click on `Create client` and select `SAML` as type from the dropdown menu. For the client ID, you can use anything
you want, but it should be unique.
*It is recommended to set this value to the domain name of your Part-DB installation, with an attached `/sp` (
e.g. `https://partdb.yourdomain.invalid/sp`)*.
The name field should be set to something human-readable, like `Part-DB`.
3. Click on `Save` to create the new client.
### Configure the SAML client
1. Now you need to configure the SAML client. Go to the `Settings` tab and set the following values:
* Set `Home URL` to the homepage of your Part-DB installation (e.g. `https://partdb.yourdomain.invalid/`).
* Set `Valid redirect URIs` to your homepage with a wildcard at the end (e.g. `https://partdb.yourdomain.invalid/*`).
* Set `Valid redirect URIs` to your homepage with a wildcard at the end (
e.g. `https://partdb.yourdomain.invalid/*`).
* Set `Valid post logout redirect URIs` to `+` to allow all urls from the `Valid redirect URIs`.
* Set `Name ID format` to `username`
* Ensure `Force POST binding` is enabled.
@@ -52,30 +65,47 @@ The name field should be set to something human-readable, like `Part-DB`.
Click on `Save` to save the changes.
2. Go to the `Advanced` tab and set the following values:
* Assertion Consumer Service POST Binding URL to your homepage with `/saml/acs` at the end (e.g. `https://partdb.yourdomain.invalid/saml/acs`).
* Logout Service POST Binding URL to your homepage with `/logout` at the end (e.g. `https://partdb.yourdomain.invalid/logout`).
* Assertion Consumer Service POST Binding URL to your homepage with `/saml/acs` at the end (
e.g. `https://partdb.yourdomain.invalid/saml/acs`).
* Logout Service POST Binding URL to your homepage with `/logout` at the end (
e.g. `https://partdb.yourdomain.invalid/logout`).
3. Go to Keys tab and ensure `Client Signature Required` is enabled.
4. In the Keys tab click on `Generate new keys`. This will generate a new key pair for the SAML client. The private key will be downloaded to your computer.
4. In the Keys tab click on `Generate new keys`. This will generate a new key pair for the SAML client. The private key
will be downloaded to your computer.
### Configure Part-DB to use SAML
1. Open the `.env.local` file of Part-DB (or the docker-compose.yaml) for edit
2. Set the `SAMLP_SP_PRIVATE_KEY` environment variable to the content of the private key file you downloaded in the previous step. It should start with `MIEE` and end with `=`.
3. Set the `SAML_SP_X509_CERT` environment variable to the content of the Certificate field shown in the `Keys` tab of the SAML client in Keycloak. It should start with `MIIC` and end with `=`.
4. Set the `SAML_SP_ENTITY_ID` environment variable to the entityID of the SAML client in Keycloak (e.g. `https://partdb.yourdomain.invalid/sp`).
5. In Keycloak navigate to `Realm Settings` -> `SAML 2.0 Identity Provider` (by default something like `https://idp.yourdomain.invalid/realms/master/protocol/saml/descriptor) to show the SAML metadata.
6. Copy the `entityID` value from the metadata to the `SAML_IDP_ENTITY_ID` configuration variable of Part-DB (by default something like `https://idp.yourdomain.invalid/realms/master`).
7. Copy the `Single Sign-On Service` value from the metadata to the `SAML_IDP_SINGLE_SIGN_ON_SERVICE` configuration variable of Part-DB (by default something like `https://idp.yourdomain.invalid/realms/master/protocol/saml`).
8. Copy the `Single Logout Service` value from the metadata to the `SAML_IDP_SINGLE_LOGOUT_SERVICE` configuration variable of Part-DB (by default something like `https://idp.yourdomain.invalid/realms/master/protocol/saml/logout`).
9. Copy the `X.509 Certificate` value from the metadata to the `SAML_IDP_X509_CERT` configuration variable of Part-DB (it should start with `MIIC` and should be pretty long).
10. Set the `DEFAULT_URI` to the homepage (on the publicly available domain) of your Part-DB installation (e.g. `https://partdb.yourdomain.invalid/`). It must end with a slash.
2. Set the `SAMLP_SP_PRIVATE_KEY` environment variable to the content of the private key file you downloaded in the
previous step. It should start with `MIEE` and end with `=`.
3. Set the `SAML_SP_X509_CERT` environment variable to the content of the Certificate field shown in the `Keys` tab of
the SAML client in Keycloak. It should start with `MIIC` and end with `=`.
4. Set the `SAML_SP_ENTITY_ID` environment variable to the entityID of the SAML client in Keycloak (
e.g. `https://partdb.yourdomain.invalid/sp`).
5. In Keycloak navigate to `Realm Settings` -> `SAML 2.0 Identity Provider` (by default something
like `https://idp.yourdomain.invalid/realms/master/protocol/saml/descriptor) to show the SAML metadata.
6. Copy the `entityID` value from the metadata to the `SAML_IDP_ENTITY_ID` configuration variable of Part-DB (by default
something like `https://idp.yourdomain.invalid/realms/master`).
7. Copy the `Single Sign-On Service` value from the metadata to the `SAML_IDP_SINGLE_SIGN_ON_SERVICE` configuration
variable of Part-DB (by default something like `https://idp.yourdomain.invalid/realms/master/protocol/saml`).
8. Copy the `Single Logout Service` value from the metadata to the `SAML_IDP_SINGLE_LOGOUT_SERVICE` configuration
variable of Part-DB (by default something like `https://idp.yourdomain.invalid/realms/master/protocol/saml/logout`).
9. Copy the `X.509 Certificate` value from the metadata to the `SAML_IDP_X509_CERT` configuration variable of Part-DB (
it should start with `MIIC` and should be pretty long).
10. Set the `DEFAULT_URI` to the homepage (on the publicly available domain) of your Part-DB installation (
e.g. `https://partdb.yourdomain.invalid/`). It must end with a slash.
11. Set the `SAML_ENABLED` configuration in Part-DB to 1 to enable SAML authentication.
When you access the Part-DB login form now, you should see a new button to log in via SSO. Click on it to be redirected to the SAML identity provider and log in.
When you access the Part-DB login form now, you should see a new button to log in via SSO. Click on it to be redirected
to the SAML identity provider and log in.
In the following sections, you will learn how to configure that Part-DB uses the data provided by the SAML identity provider to fill out user informations.
In the following sections, you will learn how to configure that Part-DB uses the data provided by the SAML identity
provider to fill out user information.
### Set user information based on SAML attributes
Part-DB can set basic user information like the username, the real name and the email address based on the SAML attributes provided by the SAML identity provider.
Part-DB can set basic user information like the username, the real name and the email address based on the SAML
attributes provided by the SAML identity provider.
To do this, you need to configure your SAML identity provider to provide the following attributes:
* `email` or `urn:oid:1.2.840.113549.1.9.1` for the email address
@@ -83,68 +113,120 @@ To do this, you need to configure your SAML identity provider to provide the fol
* `lastName` or `urn:oid:2.5.4.4` for the last name
* `department` for the department field of the user
You can omit any of these attributes, but then the corresponding field will be empty (but can be overriden by an administrator).
These values are written to Part-DB database, whenever the user logs in via SAML (the user is created on the first login, and updated on every login).
You can omit any of these attributes, but then the corresponding field will be empty (but can be overwritten by an
administrator).
These values are written to Part-DB database, whenever the user logs in via SAML (the user is created on the first
login, and updated on every login).
To configure Keycloak to provide these attributes, you need to go to the `Client scopes` page and select the `sp-dedicatd` client scope (or create a new one).
To configure Keycloak to provide these attributes, you need to go to the `Client scopes` page and select
the `sp-dedicatd` client scope (or create a new one).
In the scope configuration page, click on `Add mappers` and `From predefined mappers`. Select the following mappers:
* `X500 email`
* `X500 givenName`
* `X500 surname`
and click `Add`. Now Part-DB will be provided with the email, first name and last name of the user based on the Keycloak user database.
and click `Add`. Now Part-DB will be provided with the email, first name and last name of the user based on the Keycloak
user database.
### Configure permissions for SAML users
On the first login of a SAML user, Part-DB will create a new user in the database. This user will have the same username as the SAML user, but no password set. The user will be marked as a SAML user, so he can only login via SAML in the future. However in other aspects the user is a normal user, so Part-DB admins can set permissions for SAML users like for any other user and override permissions assigned via groups.
However for large organizations you maybe want to automatically assign permissions to SAML users based on the roles or groups configured in the identity provider. For this purpose Part-DB allows you to map SAML roles or groups to Part-DB groups. See the next section for details.
On the first login of a SAML user, Part-DB will create a new user in the database. This user will have the same username
as the SAML user, but no password set. The user will be marked as a SAML user, so he can only log in via SAML in the
future. However, in other aspects the user is a normal user, so Part-DB admins can set permissions for SAML users like
for any other user and override permissions assigned via groups.
For large organizations you maybe want to automatically assign permissions to SAML users based on the roles or
groups configured in the identity provider. For this purpose Part-DB allows you to map SAML roles or groups to Part-DB
groups. See the next section for details.
### Map SAML roles to Part-DB groups
Part-DB allows you to configure a mapping between SAML roles or groups and Part-DB groups. This allows you to automatically assign permissions to SAML users based on the roles or groups configured in the identity provider. For example if a user at your SAML provider has the role `admin`, you can configure Part-DB to assign the `admin` group to this user. This will give the user all permissions of the `admin` group.
For this you need first have to create the groups in Part-DB, to which you want to assign the users and configure their permissions. You will need the IDs of the groups, which you can find in the `System->Group` page of Part-DB in the Info tab.
Part-DB allows you to configure a mapping between SAML roles or groups and Part-DB groups. This allows you to
automatically assign permissions to SAML users based on the roles or groups configured in the identity provider. For
example if a user at your SAML provider has the role `admin`, you can configure Part-DB to assign the `admin` group to
this user. This will give the user all permissions of the `admin` group.
The map is provided as [JSON](https://en.wikipedia.org/wiki/JSON) encoded map between the SAML role and the group ID, which has the form `{"saml_role": group_id, "*": group_id, ...}`. You can use the `*` key to assign a group to all users, which are not in any other group. The map is configured via the `SAML_ROLE_MAPPING` environment variable, which you can configure via the `.env.local` or `docker-compose.yml` file. Please note that you have to enclose the JSON string in single quotes here, as JSON itself uses double quotes (e.g. `SAML_ROLE_MAPPING='{ "*": 2, "editor": 3, "admin": 1 }`).
For this you need first have to create the groups in Part-DB, to which you want to assign the users and configure their
permissions. You will need the IDs of the groups, which you can find in the `System->Group` page of Part-DB in the Info
tab.
For example if you want to assign the group with ID 1 (by default admin) to every SAML user which has the role `admin`, the role with ID 3 (by default editor) to every SAML user with the role `editor` and everybody else to the group with ID 2 (by default readonly), you can configure the following map:
The map is provided as [JSON](https://en.wikipedia.org/wiki/JSON) encoded map between the SAML role and the group ID,
which has the form `{"saml_role": group_id, "*": group_id, ...}`. You can use the `*` key to assign a group to all
users, which are not in any other group. The map is configured via the `SAML_ROLE_MAPPING` environment variable, which
you can configure via the `.env.local` or `docker-compose.yml` file. Please note that you have to enclose the JSON
string in single quotes here, as JSON itself uses double quotes (
e.g. `SAML_ROLE_MAPPING='{ "*": 2, "editor": 3, "admin": 1 }`).
For example if you want to assign the group with ID 1 (by default admin) to every SAML user which has the role `admin`,
the role with ID 3 (by default editor) to every SAML user with the role `editor` and everybody else to the group with ID
2 (by default readonly), you can configure the following map:
```
SAML_ROLE_MAPPING='{"admin": 1, "editor": 3, "*": 2}'
```
Please not that the order of the mapping is important. The first matching role will be assigned to the user. So if you have a user with the roles `admin` and `editor`, he will be assigned to the group with ID 1 (admin) and not to the group with ID 3 (editor), as the `admin` role comes first in the JSON map.
This mean that you should always put the most specific roles (e.g. admins) first of the map and the most general roles (e.g. normal users) later.
Please note that the order of the mapping is important. The first matching role will be assigned to the user. So if you
have a user with the roles `admin` and `editor`, he will be assigned to the group with ID 1 (admin) and not to the group
with ID 3 (editor), as the `admin` role comes first in the JSON map.
This mean that you should always put the most specific roles (e.g. admins) first of the map and the most general roles (
e.g. normal users) later.
If you want to assign users with a certain role to a empty group, provide the group ID -1 as the value. This is not a valid group ID, so the user will not be assigned to any group.
If you want to assign users with a certain role to an empty group, provide the group ID -1 as the value. This is not a
valid group ID, so the user will not be assigned to any group.
The SAML roles (or groups depending on your configuration), have to be supplied via a SAML attribute `group`. You have to configure your SAML identity provider to provide this attribute. For example in Keycloak you can configure this attribute in the `Client scopes` page. Select the `sp-dedicated` client scope (or create a new one) and click on `Add mappers`. Select `Role mapping` or `Group membership`, change the field name and click `Add`. Now Part-DB will be provided with the groups of the user based on the Keycloak user database.
The SAML roles (or groups depending on your configuration), have to be supplied via a SAML attribute `group`. You have
to configure your SAML identity provider to provide this attribute. For example in Keycloak you can configure this
attribute in the `Client scopes` page. Select the `sp-dedicated` client scope (or create a new one) and click
on `Add mappers`. Select `Role mapping` or `Group membership`, change the field name and click `Add`. Now Part-DB will
be provided with the groups of the user based on the Keycloak user database.
By default, the group is assigned to the user on the first login and updated on every login based on the SAML attributes. This allows you to configure the groups in the SAML identity provider and the users will automatically stay up to date with their permissions. However, if you want to disable this behavior (and let the Part-DB admins configure the groups manually, after the first login), you can set the `SAML_UPDATE_GROUP_ON_LOGIN` environment variable to `false`. If you want to disable the automatic group assignment completly (so not even on the first login of a user), set the `SAML_ROLE_MAPPING` to `{}` (empty JSON object).
By default, the group is assigned to the user on the first login and updated on every login based on the SAML
attributes. This allows you to configure the groups in the SAML identity provider and the users will automatically stay
up to date with their permissions. However, if you want to disable this behavior (and let the Part-DB admins configure
the groups manually, after the first login), you can set the `SAML_UPDATE_GROUP_ON_LOGIN` environment variable
to `false`. If you want to disable the automatic group assignment completely (so not even on the first login of a user),
set the `SAML_ROLE_MAPPING` to `{}` (empty JSON object).
## Overview of possible SAML attributes used by Part-DB
The following table shows all SAML attributes, which can be usedby Part-DB. If your identity provider is configured to provide these attributes, you can use to automatically fill the corresponding fields of the user in Part-DB.
The following table shows all SAML attributes, which can be used by Part-DB. If your identity provider is configured to
provide these attributes, you can use to automatically fill the corresponding fields of the user in Part-DB.
| SAML attribute | Part-DB user field | Description |
|-------------------------------------------|-------------------|-------------------------------------------------------------------|
| `urn:oid:1.2.840.113549.1.9.1` or `email` | email | The email address of the user. |
| `urn:oid:2.5.4.42` or `firstName` | firstName | The first name of the user. |
| `urn:oid:2.5.4.4` or `lastName` | lastName | The last name of the user. |
| `department` | department | The department of the user. |
| `group` | group | The group of the user (determined by `SAML_ROLE_MAPPING` option). |
|-------------------------------------------|--------------------|-------------------------------------------------------------------|
| `urn:oid:1.2.840.113549.1.9.1` or `email` | email | The email address of the user. |
| `urn:oid:2.5.4.42` or `firstName` | firstName | The first name of the user. |
| `urn:oid:2.5.4.4` or `lastName` | lastName | The last name of the user. |
| `department` | department | The department of the user. |
| `group` | group | The group of the user (determined by `SAML_ROLE_MAPPING` option). |
## Use SAML Login for existing users
Part-DB distinguishes between local users and SAML users. Local users are users, which can login via Part-DB login form and which use the password (hash) saved in the Part-DB database. SAML users are stored in the database too (they are created on the first login of the user via SAML), but they use the SAML identity provider to authenticate the user and have no password stored in the database. When you try you will get an error message.
For security reasons it is not possible to authenticate via SAML as a local user (and vice versa). So if you have existing users in your Part-DB database and want them to be able to login via SAML in the future, you can use the `php bin/console partdb:user:convert-to-saml-user username` command to convert them to SAML users. This will remove the password hash from the database and mark them as SAML users, so they can login via SAML in the future.
Part-DB distinguishes between local users and SAML users. Local users are users, which can log in via Part-DB login form
and which use the password (hash) saved in the Part-DB database. SAML users are stored in the database too (they are
created on the first login of the user via SAML), but they use the SAML identity provider to authenticate the user and
have no password stored in the database. When you try you will get an error message.
The reverse is also possible: If you have existing SAML users and want them to be able to login via the Part-DB login form, you can use the `php bin/console partdb:user:convert-to-saml-user --to-local username` command to convert them to local users. You have to set an password for the user afterwards.
For security reasons it is not possible to authenticate via SAML as a local user (and vice versa). So if you have
existing users in your Part-DB database and want them to be able to log in via SAML in the future, you can use
the `php bin/console partdb:user:convert-to-saml-user username` command to convert them to SAML users. This will remove
the password hash from the database and mark them as SAML users, so they can log in via SAML in the future.
The reverse is also possible: If you have existing SAML users and want them to be able to log in via the Part-DB login
form, you can use the `php bin/console partdb:user:convert-to-saml-user --to-local username` command to convert them to
local users. You have to set a password for the user afterward.
{: .important }
> It is recommended that you let the original admin user (ID: 2) be a local user, so you can still login to Part-DB if the SAML identity provider is not available.
> It is recommended that you let the original admin user (ID: 2) be a local user, so you can still login to Part-DB if
> the SAML identity provider is not available.
## Advanced SAML configuration
You can find some more advanced SAML configuration options in the `config/packages/hslavich_onelogin_saml.yaml` file. Refer to the file for more information.
You can find some more advanced SAML configuration options in the `config/packages/nbgrp_onelogin_saml.yaml` file. Refer
to the file for more information.
Normally you don't have to change anything here.
Please note that this file is not saved by the Part-DB backup tool, so you have to save it manually if you want to keep your changes. On docker containers you have to configure a volume mapping for it.
Please note that this file is not saved by the Part-DB backup tool, so you have to save it manually if you want to keep
your changes. On docker containers you have to configure a volume mapping for it.

View File

@@ -11,12 +11,13 @@ nav_order: 101
This guide describes how to migrate from [PartKeepr](https://partkeepr.org/) to Part-DB.
Part-DB has a built-in migration tool, which can be used to migrate the data from an existing PartKeepr instance to
Part-DB has a built-in migration tool, which can be used to migrate the data from an existing PartKeepr instance to
a new Part-DB instance. Most of the data can be migrated, however there are some limitations, you can find below.
## What can be imported
* Datastructures (Categories, Footprints, Storage Locations, Manufacturers, Distributors, Part Measurement Units)
* Basic part informations (Name, Description, Comment, etc.)
* Basic part information's (Name, Description, Comment, etc.)
* Attachments and images of parts, projects, footprints, manufacturers and storage locations
* Part prices (distributor infos)
* Part parameters
@@ -24,9 +25,11 @@ a new Part-DB instance. Most of the data can be migrated, however there are some
* Users (optional): Passwords however will be not migrated, and need to be reset later
## What can't be imported
* Metaparts (A dummy version of the metapart will be created in Part-DB, however it will not function as metapart)
* Multiple manufacturers per part (only the last manufacturer of a part will be migrated)
* Overage information for project parts (the overage info will be set as comment in the project BOM, but will have no effect)
* Overage information for project parts (the overage info will be set as comment in the project BOM, but will have no
effect)
* Batch Jobs
* Parameter Units (the units will be written into the parameters)
* Project Reports and Project Runs
@@ -34,18 +37,31 @@ a new Part-DB instance. Most of the data can be migrated, however there are some
* Any kind of PartKeepr preferences
## How to migrate
1. Install Part-DB like described in the installation guide. You can use any database backend you want (mysql or sqlite). Run the database migration, but do not create any new data yet.
2. Export your PartKeepr database as XML file using [mysqldump](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html):
When the MySQL database is running on the local computer and you are root you can just run the command `mysqldump --xml PARTKEEPR_DATABASE --result-file pk.xml`.
If your server is remote or your MySQL authentication is different, you need to run `mysqldump --xml -h PARTKEEPR_HOST -u PARTKEEPR_USER -p PARTKEEPR_DATABASE`, where you replace `PARTKEEPR_HOST`
with the hostname of your MySQL database and `PARTKEEPR_USER` with the username of MySQL user which has access to the PartKeepr database. You will be asked for the MySQL user password.
3. Go the Part-DB main folder and run the command `php bin/console partdb:migrations:import-partkeepr path/to/pk.xml`. This step will delete all existing data in the Part-DB database and import the contents of PartKeepr.
4. Copy the contents of `data/files/` from your PartKeepr installation to the `uploads/` folder of your Part-DB installation and the contents of `data/images` from PartKeepr to `public/media/` of Part-DB.
1. Install Part-DB like described in the installation guide. You can use any database backend you want (mysql or
sqlite). Run the database migration, but do not create any new data yet.
2. Export your PartKeepr database as XML file using [mysqldump](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html):
When the MySQL database is running on the local computer, and you are root you can just run the
command `mysqldump --xml PARTKEEPR_DATABASE --result-file pk.xml`.
If your server is remote or your MySQL authentication is different, you need to
run `mysqldump --xml -h PARTKEEPR_HOST -u PARTKEEPR_USER -p PARTKEEPR_DATABASE`, where you replace `PARTKEEPR_HOST`
with the hostname of your MySQL database and `PARTKEEPR_USER` with the username of MySQL user which has access to the
PartKeepr database. You will be asked for the MySQL user password.
3. Go the Part-DB main folder and run the command `php bin/console partdb:migrations:import-partkeepr path/to/pk.xml`.
This step will delete all existing data in the Part-DB database and import the contents of PartKeepr.
4. Copy the contents of `data/files/` from your PartKeepr installation to the `uploads/` folder of your Part-DB
installation and the contents of `data/images` from PartKeepr to `public/media/` of Part-DB.
5. Clear the cache of Part-DB by running: `php bin/console cache:clear`
6. Go to the Part-DB web interface. You can login with the username `admin` and the password, which is shown during the installation process of Part-DB (step 1). You should be able to see all the data from PartKeepr.
6. Go to the Part-DB web interface. You can log in with the username `admin` and the password, which is shown during the
installation process of Part-DB (step 1). You should be able to see all the data from PartKeepr.
## Import users
If you want to import the users (mostly the username and email address) from PartKeepr, you can add the `--import-users` option on the database import command (step 3): `php bin/console partdb:migrations:import-partkeepr --import-users path/to/pk.xml`.
All imported users of PartKeepr will be assigned to a new group "PartKeepr Users", which has normal user permissions (so editing data, but no administrative tasks). You can change the group and permissions later in Part-DB users managment.
Passwords can not be imported from PartKeepr and all imported users get marked as disabled user. So to allow users to login, you need to enable them in the user management and assign a password.
If you want to import the users (mostly the username and email address) from PartKeepr, you can add the `--import-users`
option on the database import command (step 3):
`php bin/console partdb:migrations:import-partkeepr --import-users path/to/pk.xml`.
All imported users of PartKeepr will be assigned to a new group "PartKeepr Users", which has normal user permissions (so
editing data, but no administrative tasks). You can change the group and permissions later in Part-DB users management.
Passwords can not be imported from PartKeepr and all imported users get marked as disabled user. So to allow users to
login, you need to enable them in the user management and assign a password.

View File

@@ -4,18 +4,26 @@ title: Troubleshooting
---
# Troubleshooting
Sometimes things go wrong and Part-DB shows an error message. This page should help you to solve the problem.
## Error messages
When a common, easy fixable error occurs (like a non up-to-date database), Part-DB will show you some short instructions on how to fix the problem. If you have a problem that is not listed here, please open an issue on GitHub.
When a common, easy fixable error occurs (like a non-up-to-date database), Part-DB will show you some short instructions
on how to fix the problem. If you have a problem that is not listed here, please open an issue on GitHub.
## General procedure
If you encounter an error, try the following steps:
* Clear cache of Part-DB with the console command:
* Clear cache of Part-DB with the console command:
```bash
php bin/console cache:clear
```
* Check if the database needs an update (and perform it when needed) with the console command:
* Check if the database needs an update (and perform it when needed) with the console command:
```bash
php bin/console doctrine:migrations:migrate
```
@@ -23,16 +31,19 @@ php bin/console doctrine:migrations:migrate
If this does not help, please [open an issue on GitHub](https://github.com/Part-DB/Part-DB-symfony).
## Search for user and reset password:
You can list all users with the following command: `php bin/console partdb:users:list`
To reset the password of a user you can use the following command: `php bin/console partdb:users:set-password [username]`
You can list all users with the following command: `php bin/console partdb:users:list`
To reset the password of a user you can use the following
command: `php bin/console partdb:users:set-password [username]`
## Error logs
Detailed error logs can be found in the `var/log` directory.
When Part-DB is installed directly, the errors are written to the `var/log/prod.log` file.
When Part-DB is installed with Docker, the errors are written directly to the console output.
When Part-DB is installed with Docker, the errors are written directly to the console output.
You can see the logs with the following command, when you are in the folder with the `docker-compose.yml` file
```bash
docker-compose logs -f
```
@@ -40,4 +51,5 @@ docker-compose logs -f
Please include the error logs in your issue on GitHub, if you open an issue.
## Report Issue
If an error occurs, or you found a bug, please [open an issue on GitHub](https://github.com/Part-DB/Part-DB-symfony).

View File

@@ -6,55 +6,86 @@ nav_order: 100
# Upgrade from legacy Part-DB version
Part-DB 1.0 was a complete rewrite of the old Part-DB (< 1.0.0), which you can find [here](https://github.com/Part-DB/Part-DB). A lot of things changed internally, but Part-DB was always developed with compatibility in mind, so you can migrate smoothly to the new Part-DB version, and utilize its new features and improvements.
Part-DB 1.0 was a complete rewrite of the old Part-DB (< 1.0.0), which you can
find [here](https://github.com/Part-DB/Part-DB). A lot of things changed internally, but Part-DB was always developed
with compatibility in mind, so you can migrate smoothly to the new Part-DB version, and utilize its new features and
improvements.
Some things changed however to the old version and some features are still missing, so be sure to read the following sections carefully before proceeding to upgrade.
Some things changed however to the old version and some features are still missing, so be sure to read the following
sections carefully before proceeding to upgrade.
## Changes
* PHP 7.4 or higher is required now (Part-DB 0.5 required PHP 5.4+, Part-DB 0.6 PHP 7.0).
PHP 7.4 (or newer) is shipped by all current major Linux distros now (and can be installed by third party sources on others),
Releases are available for Windows too, so almost everybody should be able to use PHP 7.4
* **Console access highly required.** The installation of composer and frontend dependencies require console access, also more sensitive stuff like database migration work via CLI now, so you should have console access on your server.
* PHP 8.1 or higher is required now (Part-DB 0.5 required PHP 5.4+, Part-DB 0.6 PHP 7.0).
Releases are available for Windows too, so almost everybody should be able to use PHP 8.1
* **Console access highly required.** The installation of composer and frontend dependencies require console access,
also more sensitive stuff like database migration work via CLI now, so you should have console access on your server.
* Markdown/HTML is now used instead of BBCode for rich text in description and command fields.
It is possible to migrate your existing BBCode to Markdown via `php bin/console php bin/console partdb:migrations:convert-bbcode`.
* Server exceptions are not logged to Event log anymore. For security reasons (exceptions can contain sensitive informations)
exceptions are only logged to server log (by default under './var/log'), so only the server admins can access it.
* Profile labels are now saved in Database (before they were saved in a seperate JSON file). **The profiles of legacy Part-DB versions can not be imported into new Part-DB 1.0**
* Label placeholders now use the `[[PLACEHOLDER]]` format instead of `%PLACEHOLDER%`. Also some placeholders has changed.
* Configuration is now done via configuration files / environment variables instead of the WebUI (this maybe change in the future).
It is possible to migrate your existing BBCode to Markdown
via `php bin/console php bin/console partdb:migrations:convert-bbcode`.
* Server exceptions are not logged to event log anymore. For security reasons (exceptions can contain sensitive
information)
exceptions are only logged to server log (by default under './var/log'), so only the server admins can access it.
* Profile labels are now saved in Database (before they were saved in a separate JSON file). **The profiles of legacy
Part-DB versions can not be imported into new Part-DB 1.0**
* Label placeholders now use the `[[PLACEHOLDER]]` format instead of `%PLACEHOLDER%`. Also, some placeholders has
changed.
* Configuration is now done via configuration files / environment variables instead of the WebUI (this maybe change in
the future).
* Database updated are now done via console instead of the WebUI
* Permission system changed: **You will have to newly set the permissions of all users and groups!**
* Import / Export file format changed. Fields must be english now (unlike in legacy Part-DB versions, where german fields in CSV were possible)
and you maybe have to change the header line/field names of your CSV files.
* Import / Export file format changed. Fields must be english now (unlike in legacy Part-DB versions, where german
fields in CSV were possible)
and you maybe have to change the header line/field names of your CSV files.
## Missing features
* No possibility to mark parts for ordering (yet)
* No support for 3D models of footprints (yet)
* No possibility to disable footprints, manufacturers globally (or per category). This should not have a big impact, when you forbid users to edit/create them.
* No possibility to disable footprints, manufacturers globally (or per category). This should not have a big impact,
when you forbid users to edit/create them.
* No resistor calculator or SMD labels tools
## Upgrade process
{: .warning }
> Once you have upgraded the database to the latest version, you will not be able to access the database with Part-DB 0.5.*. Doing so could lead to data corruption. So make a a backup before you proceed the upgrade, so you will be able to revert the upgrade, when you are not happy with the new version
> Once you have upgraded the database to the latest version, you will not be able to access the database with Part-DB
> 0.5.*. Doing so could lead to data corruption. So make a backup before you proceed the upgrade, so you will be able to
> revert the upgrade, when you are not happy with the new version
>
> Beware that all user and group permissions will be reset, and you have to set the permissions again
> Beware that all user and group permissions will be reset, and you have to set the permissions again
> the new Part-DB as many permissions changed, and automatic migration is not possible.
1. Upgrade your existing Part-DB version the newest Part-DB 0.5.* version (in the moment Part-DB 0.5.8), like described in the old Part-DB's repository.
2. Make a backup of your database and attachments. If somethings goes wrong during migration, you can use this backup to start over. If you have some more complex permission configuration, you maybe want to do screenshots of it, so you can redo it again later.
3. Setup the new Part-DB like described in installation section. You will need to do the setup for a MySQL instance (either via docker or direct installation). Set the `DATABASE_URL` environment variable in your `.env.local` (or `docker-compose.yaml`) to your existing database. (e.g. `DATABASE_URL=mysql://PARTDB_USER:PASSWORD@localhost:3306/DATABASE_NAME`)
4. Ensure that the correct base currency is configured (`BASE_CURRENCY` env), this must match the currency used in the old Part-DB version. If you used Euro, you do not need to change anything.
5. Run `php bin/console cache:clear` and `php bin/console doctrine:migrations:migrate`.
4. Run `php bin/console partdb:migrations:convert-bbcode` to convert the BBCode used in comments and part description to the newly used markdown.
5. Copy the content of the `data/media` folder from the old Part-DB instance into `public/media` folder in the new version.
6. Run `php bin/console cache:clear`
7. You should be able to login to Part-DB now using your admin account and the old password. If you do not know the admin username, run `php bin/console partdb:users:list` and look for the user with ID 1. You can reset the password of this user using `php bin/console partdb:users:set-password [username]`.
8. All other users besides the admin user are disabled (meaning they can not login). Go to "System->User" and "System->Group" and check the permissions of the users (and change them if needed). If you are done enable the users again, by removing the disabled checkmark in the password section. If you have a lot of users you can enable them all at once using `php bin/console partdb:users:enable --all`
**It is not possible to access the database using the old Part-DB version.
If you do so, this could damage your database.** Therefore it is recommended to remove the old Part-DB version, after everything works.
1. Upgrade your existing Part-DB version the newest Part-DB 0.5.* version (at the moment Part-DB 0.5.8), like described
in the old Part-DB's repository.
2. Make a backup of your database and attachments. If something goes wrong during migration, you can use this backup to
start over. If you have some more complex permission configuration, you maybe want to do screenshots of it, so you
can redo it again later.
3. Set up the new Part-DB like described in installation section. You will need to do the setup for a MySQL instance (
either via docker or direct installation). Set the `DATABASE_URL` environment variable in your `.env.local` (
or `docker-compose.yaml`) to your existing database. (
e.g. `DATABASE_URL=mysql://PARTDB_USER:PASSWORD@localhost:3306/DATABASE_NAME`)
4. Ensure that the correct base currency is configured (`BASE_CURRENCY` env), this must match the currency used in the
old Part-DB version. If you used Euro, you do not need to change anything.
5. Run `php bin/console cache:clear` and `php bin/console doctrine:migrations:migrate`.
6. Run `php bin/console partdb:migrations:convert-bbcode` to convert the BBCode used in comments and part description to
the newly used markdown.
7. Copy the content of the `data/media` folder from the old Part-DB instance into `public/media` folder in the new
version.
8. Run `php bin/console cache:clear`
9. You should be able to log in to Part-DB now using your admin account and the old password. If you do not know the
admin username, run `php bin/console partdb:users:list` and look for the user with ID 1. You can reset the password
of this user using `php bin/console partdb:users:set-password [username]`.
10. All other users besides the admin user are disabled (meaning they can not log in). Go to "System->User" and "System->
Group" and check the permissions of the users (and change them if needed). If you are done enable the users again, by
removing the disabled checkmark in the password section. If you have a lot of users you can enable them all at once
using `php bin/console partdb:users:enable --all`
**It is not possible to access the database using the old Part-DB version.
If you do so, this could damage your database.** Therefore, it is recommended to remove the old Part-DB version, after
everything works.
## Issues
If you encounter any issues (especially during the database migration) or features do not work like intended, please open an issue ticket at GitHub.
If you encounter any issues (especially during the database migration) or features do not work like intended, please
open an issue ticket at GitHub.

View File

@@ -6,48 +6,75 @@ parent: Usage
# Backup and Restore Data
When working productively you should backup the data and configuration of Part-DB regularly to prevent data loss. This is also useful, if you want to migrate your Part-DB instance from one server to another. In that case you just have to backup the data on server 1, move the backup to server 2, install Part-DB on server 2 and restore the backup.
When working productively you should back up the data and configuration of Part-DB regularly to prevent data loss. This
is also useful, if you want to migrate your Part-DB instance from one server to another. In that case you just have to
back up the data on server 1, move the backup to server 2, install Part-DB on server 2 and restore the backup.
## Backup (automatic / Part-DB supported)
Part-DB includes a command `php bin/console partdb:backup` which automatically collects all the needed data (described below) and saves them to a ZIP file.
Part-DB includes a command `php bin/console partdb:backup` which automatically collects all the needed data (described
below) and saves them to a ZIP file.
If you are using a MySQL/MariaDB database you need to have `mysqldump` installed and added to your `$PATH` env.
### Usage
To backup all possible data, run the following command: `php bin/console partdb:backup --full /path/to/backup/partdb_backup.zip`.
It is possible to do only partial backups (config, attachments, or database). See `php bin/console partdb:backup --help` for more infos about these options.
To back up all possible data, run the following
command: `php bin/console partdb:backup --full /path/to/backup/partdb_backup.zip`.
It is possible to do only partial backups (config, attachments, or database). See `php bin/console partdb:backup --help`
for more infos about these options.
## Backup (manual)
There are 3 parts which have to be backup-ed: The configuration files, which contains the instance specific options, the uploaded files of attachments, and the database containing the most data of Part-DB.
There are 3 parts which have to be backup-ed: The configuration files, which contains the instance specific options, the
uploaded files of attachments, and the database containing the most data of Part-DB.
Everything else like thumbnails and cache files, are recreated automatically when needed.
### Configuration files
You have to copy the `.env.local` file and (if you have changed it) the `config/parameters.yaml` and `config/banner.md` to your backup location.
You have to copy the `.env.local` file and (if you have changed it) the `config/parameters.yaml` and `config/banner.md`
to your backup location.
### Attachment files
You have to recursively copy the `uploads/` folder and the `public/media` folder to your backup location.
### Database
#### Sqlite
If you are using sqlite, it is sufficient to just copy your `app.db` from your database location (normally `var/app.db`) to your backup location.
If you are using sqlite, it is sufficient to just copy your `app.db` from your database location (normally `var/app.db`)
to your backup location.
#### MySQL / MariaDB
For MySQL / MariaDB you have to dump the database to an SQL file. You can do this manually with phpmyadmin, or you use [`mysqldump`](https://mariadb.com/kb/en/mariadb-dumpmysqldump/) to dump the database to an SQL file via command line interface (`mysqldump -uBACKUP -pPASSWORD DATABASE`)
For MySQL / MariaDB you have to dump the database to an SQL file. You can do this manually with phpmyadmin, or you
use [`mysqldump`](https://mariadb.com/kb/en/mariadb-dumpmysqldump/) to dump the database to an SQL file via command line
interface (`mysqldump -uBACKUP -pPASSWORD DATABASE`)
## Restore
Install Part-DB as usual as described in the installation section, with the exception of the database creation / migration part. You have to use the same database type (sqlite or mysql) as on the back-uped server instance.
Install Part-DB as usual as described in the installation section, except the database creation / migration part. You
have to use the same database type (sqlite or mysql) as on the back-up server instance.
### Restore configuration
Copy configuration files `.env.local`, (and if existing) `config/parameters.yaml` and `config/banner.md` from the backup to your new Part-DB instance and overwrite the existing files there.
Copy configuration files `.env.local`, (and if existing) `config/parameters.yaml` and `config/banner.md` from the backup
to your new Part-DB instance and overwrite the existing files there.
### Restore attachment files
Copy the `uploads/` and the `public/media/` folder from your backup into your new Part-DB folder.
### Restore database
#### Sqlite
Copy the backup-ed `app.db` into the database folder normally `var/app.db` in Part-DB root folder.
#### MySQL / MariaDB
Recreate a database and user with the same credentials as before (or update the database credentials in the `.env.local` file).
Recreate a database and user with the same credentials as before (or update the database credentials in the `.env.local`
file).
Import the dumped SQL file from the backup into your new database.

View File

@@ -7,23 +7,30 @@ parent: Usage
# Import Bill of Material (BOM) for Projects
Part-DB supports the import of Bill of Material (BOM) files for projects. This allows you to directly import a BOM file from your ECAD software into your Part-DB project.
Part-DB supports the import of Bill of Material (BOM) files for projects. This allows you to directly import a BOM file
from your ECAD software into your Part-DB project.
The import process is currently semi-automatic. This means Part-DB will take the BOM file and create entries for all parts in the BOM file in your project and assign fields like
mountnames (e.g. 'C1, C2, C3'), quantity and more.
However, you still have to assign the parts from Part-DB database to the entries (if applicable) after the import by hand,
The import process is currently semi-automatic. This means Part-DB will take the BOM file and create entries for all
parts in the BOM file in your project and assign fields like
mount names (e.g. 'C1, C2, C3'), quantity and more.
However, you still have to assign the parts from Part-DB database to the entries (if applicable) after the import by
hand,
as Part-DB can not know which part you had in mind when you designed your schematic.
## Usage
In the project view or edit click on the "Import BOM" button, below the BOM table. This will open a dialog where you can
select the BOM file you want to import and some options for the import process:
* **Type**: The format/type of the BOM file. See below for explanations of the different types.
* **Clear existing BOM entries before import**: If this is checked, all existing BOM entries, which are currently associated with the project, will be deleted before the import.
* **Clear existing BOM entries before import**: If this is checked, all existing BOM entries, which are currently
associated with the project, will be deleted before the import.
### Supported BOM file formats
* **KiCAD Pcbnew BOM (CSV file)**: A CSV file of the Bill of Material (BOM) generated by [KiCAD Pcbnew](https://www.kicad.org/).
Please note that you have to export the BOM from the PCB editor, the BOM generated by the schematic editor (Eeschema) has a different format and does not work with this type.
You can generate this BOM file by going to "File" -> "Fabrication Outputs" -> "Bill of Materials" in Pcbnew and save the file to your desired location.
* **KiCAD Pcbnew BOM (CSV file)**: A CSV file of the Bill of Material (BOM) generated
by [KiCAD Pcbnew](https://www.kicad.org/).
Please note that you have to export the BOM from the PCB editor, the BOM generated by the schematic editor (Eeschema)
has a different format and does not work with this type.
You can generate this BOM file by going to "File" -> "Fabrication Outputs" -> "Bill of Materials" in Pcbnew and save
the file to your desired location.

View File

@@ -10,29 +10,46 @@ Part-DB provides some console commands to display various information or perform
The commands are invoked from the main directory of Part-DB with the command `php bin/console [command]` in the context
of the database user (so usually the webserver user), so you maybe have to use `sudo` or `su` to execute the commands.
You can get help for every command with the parameter `--help`. See `php bin/console` for a list of all available commands.
You can get help for every command with the parameter `--help`. See `php bin/console` for a list of all available
commands.
## User management commands
## User managment commands
* `php bin/console partdb:users:list`: List all users of this Part-DB instance
* `php bin/console partdb:users:set-password [username]`: Set/Changes the password of the user with the given username. This allows administrators to reset a password of a user, if he forgot it.
* `php bin/console partdb:users:enable [username]`: Enable/Disable the user with the given username (use `--disable` to disable the user, which prevents login)
* `php bin/console partdb:users:set-password [username]`: Set/Changes the password of the user with the given username.
This allows administrators to reset a password of a user, if he forgot it.
* `php bin/console partdb:users:enable [username]`: Enable/Disable the user with the given username (use `--disable` to
disable the user, which prevents login)
* `php bin/console partdb:users:permissions`: View/Change the permissions of the user with the given username
* `php bin/console partdb:users:upgrade-permissions-schema`: Upgrade the permissions schema of users to the latest version (this is normally automatically done when the user visits a page)
* `php bin/console partdb:users:upgrade-permissions-schema`: Upgrade the permissions schema of users to the latest
version (this is normally automatically done when the user visits a page)
* `php bin/console partdb:logs:show`: Show the most recent entries of the Part-DB event log / recent activity
* `php bin/console partdb:user:convert-to-saml-user`: Convert a local user to a SAML/SSO user. This is needed, if you want to use SAML/SSO authentication for a user, which was created before you enabled SAML/SSO authentication.
* `php bin/console partdb:user:convert-to-saml-user`: Convert a local user to a SAML/SSO user. This is needed, if you
want to use SAML/SSO authentication for a user, which was created before you enabled SAML/SSO authentication.
## Currency commands
* `php bin/console partdb:currencies:update-exchange-rates`: Update the exchange rates of all currencies from the internet)
* `php bin/console partdb:currencies:update-exchange-rates`: Update the exchange rates of all currencies from the
internet
## Installation/Maintenance commands
* `php bin/console partdb:backup`: Backup the database and the attachments
* `php bin/console partdb:version`: Display the current version of Part-DB and the used PHP version
* `php bin/console partdb:check-requirements`: Check if the requirements for Part-DB are met (PHP version, PHP extensions, etc.) and make suggestions what could be improved
* `partdb:migrations:convert-bbcode`: Migrate the old BBCode markup codes used in legacy Part-DB versions (< 1.0.0) to the new markdown syntax
* `partdb:attachments:clean-unused`: Remove all attachments which are not used by any database entry (e.g. orphaned attachments)
* `partdb:cache:clear`: Clears all caches, so the next page load will be slower, but the cache will be rebuild. This can maybe fix some issues, when the cache were corrupted. This command is also needed after changing things in the `parameters.yaml` file or upgrading Part-DB.
* `partdb:migrations:import-partkeepr`: Imports an mysqldump XML dump of a PartKeepr database into Part-DB. This is only needed for users, which want to migrate from PartKeepr to Part-DB. *All existing data in the Part-DB database is deleted!*
* `php bin/console partdb:check-requirements`: Check if the requirements for Part-DB are met (PHP version, PHP
extensions, etc.) and make suggestions what could be improved
* `partdb:migrations:convert-bbcode`: Migrate the old BBCode markup codes used in legacy Part-DB versions (< 1.0.0) to
the new Markdown syntax
* `partdb:attachments:clean-unused`: Remove all attachments which are not used by any database entry (e.g. orphaned
attachments)
* `partdb:cache:clear`: Clears all caches, so the next page load will be slower, but the cache will be rebuilt. This can
maybe fix some issues, when the cache were corrupted. This command is also needed after changing things in
the `parameters.yaml` file or upgrading Part-DB.
* `partdb:migrations:import-partkeepr`: Imports a mysqldump XML dump of a PartKeepr database into Part-DB. This is only
needed for users, which want to migrate from PartKeepr to Part-DB. *All existing data in the Part-DB database is
deleted!*
## Database commands
* `php bin/console doctrine:migrations:migrate`: Migrate the database to the latest version
* `php bin/console doctrine:migrations:up-to-date`: Check if the database is up-to-date

View File

@@ -7,111 +7,146 @@ nav_order: 4
# Getting started
After Part-DB you should begin with customizing the settings, and setting up the basic structures.
Before starting its useful to read a bit about the [concepts of Part-DB]({% link concepts.md %}).
Before starting, it's useful to read a bit about the [concepts of Part-DB]({% link concepts.md %}).
1. TOC
{:toc}
## Customize config files
Before you start creating data structures, you should configure Part-DB to your needs by changing possible configuration options.
This is done either via changing the `.env.local` file in a direct installation or by changing the env variables in your `docker-compose.yaml` file.
Before you start creating data structures, you should configure Part-DB to your needs by changing possible configuration
options.
This is done either via changing the `.env.local` file in a direct installation or by changing the env variables in
your `docker-compose.yaml` file.
A list of possible configuration options, can be found [here]({% link configuration.md %}).
## Change password, Set up Two-Factor-Authentication & Customize User settings
If you have not already done, you should change your user password. You can do this in the user settings (available in the navigation bar drop down with the user symbol).
If you have not already done, you should change your user password. You can do this in the user settings (available in
the navigation bar drop down with the user symbol).
![image]({% link assets/getting_started/change_password.png %})
There you can also find the option, to set up Two Factor Authentication methods like Google Authenticator. Using this is highly recommended (especially if you have admin permissions) to increase the security of your account. (Two Factor Authentication even can be enforced for all members of a user group)
There you can also find the option, to set up Two-Factor Authentication methods like Google Authenticator. Using this is
highly recommended (especially if you have admin permissions) to increase the security of your account. (Two-Factor
Authentication even can be enforced for all members of a user group)
In the user settings panel you can change account infos like your username, your first and last name (which will be shown alongside your username to identify you better), department information and your email address. The email address is used to send password reset mails, if your system is configured to use this.
In the user settings panel you can change account infos like your username, your first and last name (which will be
shown alongside your username to identify you better), department information and your email address. The email address
is used to send password reset mails, if your system is configured to use this.
![image]({% link assets/getting_started/user_settings.png %})
In the configuration tab you can also override global settings, like your preferred UI language (which will automatically be applied after login), the timezone you are in (and in which times will be shown for you), your preferred currency (all money values will be shown converted to this to you, if possible) and the theme that should be used.
In the configuration tab you can also override global settings, like your preferred UI language (which will
automatically be applied after login), the timezone you are in (and in which times will be shown for you), your
preferred currency (all money values will be shown converted to this to you, if possible) and the theme that should be
used.
## (Optional) Customize homepage banner
The banner which is shown on the homepage, can be customized/changed by changing the `config/banner.md` file with a text editor. You can use markdown and (safe) HTML here, to style and customize the banner.
You can even use Latex style equations by wrapping the expressions into `$` (like `$E=mc^2$`, which is rendered inline: $E=mc^2$) or `$$` (like `$$E=mc^2$$`) which will be rendered as a block, like so: $$E=mc^2$$
The banner which is shown on the homepage, can be customized/changed by changing the `config/banner.md` file with a text
editor. You can use markdown and (safe) HTML here, to style and customize the banner.
You can even use Latex style equations by wrapping the expressions into `$` (like `$E=mc^2$`, which is rendered inline:
$E=mc^2$) or `$$` (like `$$E=mc^2$$`) which will be rendered as a block, like so: $$E=mc^2$$
## Create groups, users and customize permissions
### Users
When logged in as administrator, you can open the users menu in the `Tools` section of the sidebar under `System -> Users`.
When logged in as administrator, you can open the users menu in the `Tools` section of the sidebar
under `System -> Users`.
At this page you can create new users, change their passwords and settings and change their permissions.
For each user which should use Part-DB you should setup a own account, so that tracking of what user did what works properly.
For each user which should use Part-DB you should set up an own account, so that tracking of what user did what works
properly.
![image]({% link assets/getting_started/user_admin.png %})
You should check the permissions for every user and ensure that they are in the intended way, and no user has more permissions than he needs.
For each capability you can choose between allow, forbid and inherit. In the last case, the permission is determined by the group a user has (if no group is chosen, it equals forbid)
You should check the permissions for every user and ensure that they are in the intended way, and no user has more
permissions than he needs.
For each capability you can choose between allow, forbid and inherit. In the last case, the permission is determined by
the group a user has (if no group is chosen, it equals forbid)
![image]({% link assets/getting_started/user_permissions.png %})
### Anonymous user
The `anonymous` user is special, as its settings and permissions are used for everybody who is not logged in. By default the anonymous user has read capabilities for your parts. If your Part-DB instance is publicly available you maybe want to restrict the permissions.
The `anonymous` user is special, as its settings and permissions are used for everybody who is not logged in. By default,
the anonymous user has read capabilities for your parts. If your Part-DB instance is publicly available you maybe want
to restrict the permissions.
### Groups
If you have many users which should share the same permissions, it is useful to define the permissions using user groups, which you can create and edit in the `System -> Groups` menu.
If you have many users which should share the same permissions, it is useful to define the permissions using user
groups, which you can create and edit in the `System -> Groups` menu.
By default 3 groups are defined:
* `readonly` which users have only have read permissions (like viewing, searching parts, attachments, etc.)
* `readonly` which users only have read permissions (like viewing, searching parts, attachments, etc.)
* `users` which users also have rights to edit/delete/create elements
* `admin` which users can do administrative operations (like creating new users, show global system log, etc.)
Users only use the setting of a capability from a group, if the user has a group associated and the capability on the user is set to `inherit` (which is the default if creating a new user). You can override the permissions settings of a group per user by explicitly settings the permission at the user.
Groups are organized as trees, meaning a group can have parent and child permissions and child groups can inherit permissions from their parents.
To inherit the permissions from a parent group set the capability to inherit, otherwise set it explicitly to override the parents permission.
Users only use the setting of a capability from a group, if the user has a group associated and the capability on the
user is set to `inherit` (which is the default if creating a new user). You can override the permissions settings of a
group per user by explicitly settings the permission at the user.
Groups are organized as trees, meaning a group can have parent and child permissions and child groups can inherit
permissions from their parents.
To inherit the permissions from a parent group set the capability to inherit, otherwise set it explicitly to override
the parents' permission.
## Create Attachment types
Every attachment (that is an file associated with a part, data structure, etc.) must have an attachment type. They can be used to group attachments logically, like differentiating between datasheets, pictures and other documents.
Every attachment (that is a file associated with a part, data structure, etc.) must have an attachment type. They can
be used to group attachments logically, like differentiating between datasheets, pictures and other documents.
You can create/edit attachment types in the tools sidebar under "Edit -> Attachment types":
![image]({% link assets/getting_started/attachment_type_admin.png %})
Depending on your usecase different entries here make sense. For part mananagment the following (additional) entries maybe make sense:
Depending on your use case different entries here make sense. For part management the following (additional) entries
maybe make sense:
* Datasheets (restricted to pdfs, Allowed filetypes: `application/pdf`)
* Pictures (for generic pictures of components, storage locations, etc., Allowed filetypes: `image/*`
For every attachment type a list of allowed file types, which can be uploaded to an attachment with this attachment type, can be defined. You can either pass a list of allowed file extensions (e.g. `.pdf, .zip, .docx`) and/or a list of [Mime Types](https://en.wikipedia.org/wiki/Media_type) (e.g. `application/pdf, image/jpeg`) or a combination of both here. To allow all browser supported images, you can use `image/*` wildcard here.
For every attachment type a list of allowed file types, which can be uploaded to an attachment with this attachment
type, can be defined. You can either pass a list of allowed file extensions (e.g. `.pdf, .zip, .docx`) and/or a list
of [Mime Types](https://en.wikipedia.org/wiki/Media_type) (e.g. `application/pdf, image/jpeg`) or a combination of both
here. To allow all browser supported images, you can use `image/*` wildcard here.
## (Optional) Create Currencies
If you want to save priceinformations for parts in a currency different to your global currency (by default Euro), you have to define the additional currencies you want to use under `Edit -> Currencies`:
If you want to save price information for parts in a currency different to your global currency (by default Euro), you
have to define the additional currencies you want to use under `Edit -> Currencies`:
![image]({% link assets/getting_started/currencies_admin.png %})
You create a new currency, name it however you want (it is recommended to use the official name of the currency) and select the currency ISO code from the list and save it. The currency symbol is determined automatically from chose ISO code.
You can define a exchange rate in terms of your base currency (e.g. how much euros is one unit of your currency worth) to convert the currencies values in your preferred display currency automatically.
You create a new currency, name it however you want (it is recommended to use the official name of the currency) and
select the currency ISO code from the list and save it. The currency symbol is determined automatically from chose ISO
code.
You can define an exchange rate in terms of your base currency (e.g. how many euros is one unit of your currency worth)
to convert the currencies values in your preferred display currency automatically.
## (Optional) Create Measurement Units
By default Part-DB assumes that the parts in inventory can be counted by individual indivisible pieces, like LEDs in a box or books in a shelf.
However if you want to manage things, that are divisible and and the instock is described by a physical quantity, like length for cables, or volumina of a liquid, you have to define additional measurement units.
By default, Part-DB assumes that the parts in inventory can be counted by individual indivisible pieces, like LEDs in a
box or books in a shelf.
However, if you want to manage things, that are divisible and the stock is described by a physical quantity, like
length for cables, or volumina of a liquid, you have to define additional measurement units.
This is possible under `Edit -> Measurement Units`:
![image]({% link assets/getting_started/units_admin.png %})
You can give the measurement unit a name and an optional unit symbol (like `m` for meters) which is shown when quantities in this unit are displayed. The option `Use SI prefix` is useful for almost all physical quantities, as big and small numbers are automatically formatted with SI-prefixes (like 1.5kg instead 1500 grams).
You can give the measurement unit a name and an optional unit symbol (like `m` for meters) which is shown when
quantities in this unit are displayed. The option `Use SI prefix` is useful for almost all physical quantities, as big
and small numbers are automatically formatted with SI-prefixes (like 1.5kg instead 1500 grams).
The measurement unit can be selected for each part individually, by setting the option in the advanced tab of a part`s edit menu.
The measurement unit can be selected for each part individually, by setting the option in the advanced tab of a part`s
edit menu.
## Create Categories
A category is used to group parts logically by their function (e.g. all NPN transistors would be put in a "NPN-Transistors" category).
A category is used to group parts logically by their function (e.g. all NPN transistors would be put in a "
NPN-Transistors" category).
Categories are hierarchical structures meaning that you can create logical trees to group categories together.
See [Concepts]({% link concepts.md %}) for an example tree structure.
@@ -121,43 +156,51 @@ Every part has to be assigned to a category, so you should create at least one c
## (Optional) Create Footprints
Footprints are used to describe the physical shape of a part, like a resistor or a capacitor.
Footprints are used to describe the physical shape of a part, like a resistor or a capacitor.
They can be used to group parts by their physical shape and to find parts with in the same package.
You can create/edit footprints in the tools sidebar under "Edit -> Footprints".
It is useful to create footprints for the most common packages, like SMD resistors, capacitors, etc. to make it easier to find parts with the same footprint.
It is useful to create footprints for the most common packages, like SMD resistors, capacitors, etc. to make it easier
to find parts with the same footprint.
You should create these as a tree structure, so that you can group footprints by their type.
See [Concepts]({% link concepts.md %}) for an example tree structure.
You can define attachments here which are associated with the footprint. The attachment set as preview image, will be
used whenever a visual representation of the footprint is needed (e.g. in the part list).
For many common footprints, you can use the built-in footprints, which can be found in the "Builtin footprint image gallery", which you can find in the tools menu.
Type the name of the image you want to use in the URL field of the attachment and select the image from the dropdown menu.
For many common footprints, you can use the built-in footprints, which can be found in the "Builtin footprint image
gallery", which you can find in the "tools" menu.
Type the name of the image you want to use in the URL field of the attachment and select the image from the dropdown
menu.
## (Optional) Create Storage locations
A storelocation represents a place where parts can be stored.
A storage location represents a place where parts can be stored.
You can create/edit storage locations in the tools sidebar under "Edit -> Storage locations".
## (Optional) Create Manufacturers and suppliers
You can create/edit [manufacturers]({% link concepts.md %}#manufacturers) and [suppliers]({% link concepts.md %}#suppliers) in the tools sidebar under "Edit -> Manufacturers" and "Edit -> Suppliers".
You can create/edit [manufacturers]({% link concepts.md %}#manufacturers) and [suppliers]({% link concepts.md
%}#suppliers) in the tools sidebar under "Edit -> Manufacturers" and "Edit -> Suppliers".
## Create parts
You are now ready to create your first part. You can do this by clicking either by clicking "Edit -> New Part" in the tools sidebar tree
or by clicking the "Create new Part" above the (empty) part list, after clicking on one of your newly created categories.
You are now ready to create your first part. You can do this by clicking either by clicking "Edit -> New Part" in the
tools sidebar tree
or by clicking the "Create new Part" above the (empty) part list, after clicking on one of your newly created
categories.
You will be presented with a form where you can enter the basic information about your part:
![image]({% link assets/getting_started/new_part.png %})
You have to enter at least a name for the part and choose a category for it, the other fields are optional.
However, it is recommended to fill out as much information as possible, as this will make it easier to find the part later.
However, it is recommended to fill out as much information as possible, as this will make it easier to find the part
later.
You can choose from your created datastructures to add manufacturer information, supplier information, etc. to the part.
You can also create new datastructures on the fly, if you want to add additional information to the part, by typing the
name of the new datastructure in the field and select the "New ..." option in the dropdown menu. See [tips]({% link usage/tips_tricks.md %}) for more information.
name of the new datastructure in the field and select the "New ..." option in the dropdown menu. See [tips]({% link
usage/tips_tricks.md %}) for more information.

View File

@@ -7,50 +7,81 @@ parent: Usage
# Import & Export data
Part-DB offers the possibility to import existing data (parts, datastructures, etc.) from existing datasources into Part-DB. Data can also be exported from Part-DB into various formats.
Part-DB offers the possibility to import existing data (parts, datastructures, etc.) from existing data sources into
Part-DB. Data can also be exported from Part-DB into various formats.
## Import
{: .note }
> As data import is a very powerful feature and can easily fill up your database with lots of data, import is by default only available for
> administrators. If you want to allow other users to import data, or can not import data, check the permissions of the user. You can enable import for each data structure
> As data import is a very powerful feature and can easily fill up your database with lots of data, import is by default
> only available for
> administrators. If you want to allow other users to import data, or can not import data, check the permissions of the
> user. You can enable import for each data structure
> individually in the permissions settings.
If you want to import data from PartKeepr you might want to look into the [PartKeepr migration guide]({% link upgrade_legacy.md %}).
If you want to import data from PartKeepr you might want to look into the [PartKeepr migration guide]({% link
upgrade_legacy.md %}).
### Import parts
Part-DB supports the import of parts from CSV files and other formats. This can be used to import existing parts from other databases or datasources into Part-DB. The import can be done via the "Tools -> Import parts" page, which you can find in the "Tools" sidebar panel.
Part-DB supports the import of parts from CSV files and other formats. This can be used to import existing parts from
other databases or data sources into Part-DB. The import can be done via the "Tools -> Import parts" page, which you can
find in the "Tools" sidebar panel.
{: .important }
> When importing data, the data is immediatley written to database during the import process, when the data is formally valid.
> You will not be able to check the data before it is written to the database, so you should review the data before using the import tool.
> When importing data, the data is immediately written to database during the import process, when the data is formally
> valid.
> You will not be able to check the data before it is written to the database, so you should review the data before
> using the import tool.
You can upload the file which should be imported here and choose various options on how the data should be treated:
* **Format**: By default "auto" is selected here and Part-DB will try to detect the format of the file automatically based on its file extension. If you want to force a specific format or Part-DB can not auto-detect the format, you can select it here.
* **CSV delimiter**: If you upload an CSV file, you can select the delimiter character which is used to separate the columns in the CSV file. Depending on the CSV file, this might be a comma (`,`), semicolon (`;`).
* **Category override**: You can select (or create) a category here, to which all imported parts should be assigned, no matter what was specified in the import file. This can be useful if you want to assign all imports to a certain category or if no category is specified in the data. If you leave this field empty, the category will be determined by the import file (or the export will error, if no category is specified).
* **Mark all imported parts as "Needs review"**: If this is selected, all imported parts will be marked as "Needs review" after the import. This can be useful if you want to review all imported parts before using them.
* **Create unknown datastructures**: If this is selected Part-DB will create new datastructures (like categories, manufacturers, etc.) if no datastructure(s) with the same name and path already exists. If this is not selected, only existing datastructures will be used and if no matching datastrucure is found, the imported parts field will be empty.
* **Path delimiter**: Part-DB allows you to create/select nested datastructures (like categories, manufacturers, etc.) by using a path (e.g. `Category 1->Category 1.1`, which will select/create the `Category 1.1` whose parent is `Category 1`). This path is separated by the path delimiter. If you want to use a different path delimiter than the default one (which is `>`), you can select it here.
* **Abort on validation error**: If this is selected, the import will be aborted if a validation error occurs (e.g. if a required field is empty) for any of the imported parts and validation errors will be shown on top of the page. If this is not selected, the import will continue for the other parts and only the invalid parts will be skipped.
After you have selected the options, you can start the import by clicking the "Import" button. When the import is finished, you will see the results of the import in the lower half of the page. You find a table with the imported parts (including links to them) there.
* **Format**: By default "auto" is selected here and Part-DB will try to detect the format of the file automatically
based on its file extension. If you want to force a specific format or Part-DB can not auto-detect the format, you can
select it here.
* **CSV delimiter**: If you upload an CSV file, you can select the delimiter character which is used to separate the
columns in the CSV file. Depending on the CSV file, this might be a comma (`,`), semicolon (`;`).
* **Category override**: You can select (or create) a category here, to which all imported parts should be assigned, no
matter what was specified in the import file. This can be useful if you want to assign all imports to a certain
category or if no category is specified in the data. If you leave this field empty, the category will be determined by
the import file (or the export will error, if no category is specified).
* **Mark all imported parts as "Needs review"**: If this is selected, all imported parts will be marked as "Needs
review" after the import. This can be useful if you want to review all imported parts before using them.
* **Create unknown datastructures**: If this is selected Part-DB will create new datastructures (like categories,
manufacturers, etc.) if no datastructure(s) with the same name and path already exists. If this is not selected, only
existing datastructures will be used and if no matching datastrucure is found, the imported parts field will be empty.
* **Path delimiter**: Part-DB allows you to create/select nested datastructures (like categories, manufacturers, etc.)
by using a path (e.g. `Category 1->Category 1.1`, which will select/create the `Category 1.1` whose parent
is `Category 1`). This path is separated by the path delimiter. If you want to use a different path delimiter than the
default one (which is `>`), you can select it here.
* **Abort on validation error**: If this is selected, the import will be aborted if a validation error occurs (e.g. if a
required field is empty) for any of the imported parts and validation errors will be shown on top of the page. If this
is not selected, the import will continue for the other parts and only the invalid parts will be skipped.
After you have selected the options, you can start the import by clicking the "Import" button. When the import is
finished, you will see the results of the import in the lower half of the page. You find a table with the imported
parts (including links to them) there.
#### Fields description
For the importing of parts, you can use the following fields which will be imported into each part. Please note that the field names are case sensitive (so `name` is not the same as `Name`). All fields (besides name) are optional, so you can leave them empty or do not include the column in your file.
For the importing of parts, you can use the following fields which will be imported into each part. Please note that the
field names are case-sensitive (so `name` is not the same as `Name`). All fields (besides name) are optional, so you can
leave them empty or do not include the column in your file.
* **`name`** (required): The name of the part. This is the only required field, all other fields are optional.
* **`description`**: The description of the part, you can use markdown/HTML syntax here for rich text formatting.
* **`notes`** or **`comment`**: The notes of the part, you can use markdown/HTML syntax here for rich text formatting.
* **`category`**: The category of the part. This can be a path (e.g. `Category 1->Category 1.1`), which will select/create the `Category 1.1` whose parent is `Category 1`. If you want to use a different path delimiter than the default one (which is `->`), you can select it in the import options. If the category does not exist and the option "Create unknown datastructures" is selected, it will be created.
* **`category`**: The category of the part. This can be a path (e.g. `Category 1->Category 1.1`), which will
select/create the `Category 1.1` whose parent is `Category 1`. If you want to use a different path delimiter than the
default one (which is `->`), you can select it in the import options. If the category does not exist and the option "
Create unknown datastructures" is selected, it will be created.
* **`footprint`**: The footprint of the part. Can be a path similar to the category field.
* **`favorite`**: If this is set to `1`, the part will be marked as favorite.
* **`manufacturer`**: The manufacturer of the part. Can be a path similar to the category field.
* **`manufacturer_product_number`** or **`mpn`**: The manufacturer product number of the part.
* **`manufacturer_product_url`: The URL to the product page of the manufacturer of the part.
* **`manufacturing_status`**: The manufacturing status of the part, must be one of the following values: `announced`, `active`, `nrfnd`, `eol`, `discontinued` or left empty.
* **`manufacturer_product_url`**: The URL to the product page of the manufacturer of the part.
* **`manufacturing_status`**: The manufacturing status of the part, must be one of the following
values: `announced`, `active`, `nrfnd`, `eol`, `discontinued` or left empty.
* **`needs_review`** or **`needs_review`**: If this is set to `1`, the part will be marked as "needs review".
* **`tags`**: A comma separated list of tags for the part.
* **`mass`**: The mass of the part in grams.
@@ -58,46 +89,73 @@ For the importing of parts, you can use the following fields which will be impor
* **`minamount`**: The minimum amount of the part which should be in stock.
* **`partUnit`**: The measurement unit of the part to use. Can be a path similar to the category field.
With the following fields you can specify storage locations and amount / quantiy in stock of the part. An PartLot will be created automatically from the data and assigned to the part. The following fields are helpers for an easy import for parts at one storage location. If you need to create a Part with multiple PartLots you have to use JSON format (or CSV) with nested objects:
With the following fields you can specify storage locations and amount / quantity in stock of the part. An PartLot will
be created automatically from the data and assigned to the part. The following fields are helpers for an easy import for
parts at one storage location. If you need to create a Part with multiple PartLots you have to use JSON format (or CSV)
with nested objects:
**`storage_location`** or **`storelocation`**: The storage location of the part. Can be a path similar to the category field.
**`amount`**, **`quantity`** or **`instock`**: The amount of the part in stock. If this value is not set, the part lot will be marked with "unknown amount"
**`storage_location`** or **`storelocation`**: The storage location of the part. Can be a path similar to the category
field.
**`amount`**, **`quantity`** or **`instock`**: The amount of the part in stock. If this value is not set, the part lot
will be marked with "unknown amount"
The following fields can be used to specify the supplier/distributor, supplier product number and the price of the part. This is only possible for a single supplier/distributor and price with this fields. If you need to specify multiple suppliers/distributors or prices, you have to use JSON format (or CSV) with nested objects.
**Please note that the supplier fields is required, if you want to import prices or supplier product numbers.**. If the supplier is not specified, the price and supplier product number fields will be ignored:
The following fields can be used to specify the supplier/distributor, supplier product number and the price of the part.
This is only possible for a single supplier/distributor and price with these fields. If you need to specify multiple
suppliers/distributors or prices, you have to use JSON format (or CSV) with nested objects.
**Please note that the supplier fields is required, if you want to import prices or supplier product numbers**. If the
supplier is not specified, the price and supplier product number fields will be ignored:
* **`supplier`**: The supplier of the part. Can be a path similar to the category field.
* **`supplier_product_number`** or **`supplier_part_number`** or * **`spn`**: The supplier product number of the part.
* **`price`**: The price of the part in the base currency of the database (by default euro).
#### Example data
Here you can find some example data for the import of parts, you can use it as a template for your own import (especially the CSV file).
Here you can find some example data for the import of parts, you can use it as a template for your own import (
especially the CSV file).
* [Part import CSV example]({% link assets/usage/import_export/part_import_example.csv %}) with all possible fields
## Export
By default every user, who can read the datastructure, can also export the data of this datastructure, as this does not give the user any additional information.
By default, every user, who can read the datastructure, can also export the data of this datastructure, as this does not
give the user any additional information.
### Exporting data structures (categories, manufacturers, etc.)
You can export data structures (like categories, manufacturers, etc.) in the respective edit page (e.g. Tools Panel -> Edit -> Category).
If you select a certain datastructure from your list, you can export it (and optionally all sub-datastructures) in the "Export" tab.
If you want to export all datastructures of a certain type (e.g. all categories in your database), you can select the "Export all" function in the "Import / Export" tab of the "new element" page.
You can export data structures (like categories, manufacturers, etc.) in the respective edit page (e.g. Tools Panel ->
Edit -> Category).
If you select a certain datastructure from your list, you can export it (and optionally all sub-datastructures) in the "
Export" tab.
If you want to export all datastructures of a certain type (e.g. all categories in your database), you can select the "
Export all" function in the "Import / Export" tab of the "new element" page.
You can select between the following export formats:
* **CSV** (Comma Separated Values): A semicolon separated list of values, where every line represents an element. This format can be imported into Excel or LibreOffice Calc and is easy to work with. However it does not support nested datastructures or sub data (like parameters, attachments, etc.), very well (many columns are generated, as every possible sub data is exported as a separate column).
* **JSON** (JavaScript Object Notation): A text-based format, which is easy to work with programming laguages. It supports nested datastructures and sub data (like parameters, attachments, etc.) very well. However it is not easy to work with in Excel or LibreOffice Calc and you maybe need to write some code to work with the exported data efficiently.
* **YAML** (Yet another Markup Language): Very similar to JSON
* **XML** (Extensible Markup Language): Good support with nested datastructures. Similar usecase as JSON and YAML.
Also you can select between the following export levels:
* **CSV** (Comma Separated Values): A semicolon separated list of values, where every line represents an element. This
format can be imported into Excel or LibreOffice Calc and is easy to work with. However, it does not support nested
datastructures or sub data (like parameters, attachments, etc.), very well (many columns are generated, as every
possible sub data is exported as a separate column).
* **JSON** (JavaScript Object Notation): A text-based format, which is easy to work with programming languages. It
supports nested datastructures and sub data (like parameters, attachments, etc.) very well. However, it is not easy to
work with in Excel or LibreOffice Calc and you maybe need to write some code to work with the exported data
efficiently.
* **YAML** (Yet another Markup Language): Very similar to JSON
* **XML** (Extensible Markup Language): Good support with nested datastructures. Similar use case as JSON and YAML.
Also, you can select between the following export levels:
* **Simple**: This will only export very basic information about the name (like the name, or description for parts)
* **Extended**: This will export all commonly used information about this datastructure (like notes, options, etc)
* **Extended**: This will export all commonly used information about this datastructure (like notes, options, etc.)
* **Full**: This will export all available information about this datastructure (like all parameters, attachments)
Please note that the level will also be applied to all sub data or children elements. So if you select "Full" for a part, all the associated categories, manufacturers, footprints, etc. will also be exported with all available information, this can lead to very large export files.
Please note that the level will also be applied to all sub data or children elements. So if you select "Full" for a
part, all the associated categories, manufacturers, footprints, etc. will also be exported with all available
information, this can lead to very large export files.
### Exporting parts
You can export parts in all part tables. Select the parts you want via the checkbox in the table line and select the export format and level in the appearing menu.
You can export parts in all part tables. Select the parts you want via the checkbox in the table line and select the
export format and level in the appearing menu.
See the section about exporting datastructures for more information about the export formats and levels.

View File

@@ -0,0 +1,213 @@
---
title: Information provider system
layout: default
parent: Usage
---
# Information provider system
Part-DB can create parts based on information from external sources: For example with the right setup you can just
search for a part number
and Part-DB will query selected distributors and manufacturers for the part and create a part with the information it
found.
This way your Part-DB parts automatically get datasheet links, prices, parameters and more, with just a few clicks.
## Usage
Before you can use the information provider system, you have to configure at least one information provider, which act
as data source.
See below for a list of available information providers and available configuration options.
For many providers it is enough, to set up the API keys in the env configuration, some require an additional OAuth
connection.
You can list all enabled information providers in the browser
at `https://your-partdb-instance.tld/tools/info_providers/providers` (you need the right permission for it, see below).
To use the information provider system, your user need to have the right permissions. Go to the permission management
page of
a user or a group and assign the permissions of the "Info providers" group in the "Miscellaneous" tab.
If you have the required permission you will find in the sidebar in the "Tools" section the entry "Create part from info
provider".
Click this and you will land on a search page. Enter the part number you want to search for and select the information
providers you want to use.
After you click Search, you will be presented with the results and can select the result that fits best.
With a click on the blue plus button, you will be redirected to the part creation page with the information already
filled in.
![image]({% link assets/usage/information_provider_system/animation.gif %})
## Alternative names
Part-DB tries to automatically find existing elements from your database for the information it got from the providers
for fields like manufacturer, footprint, etc.
For this it searches for an element with the same name (case-insensitive) as the information it got from the provider. So
e.g. if the provider returns "EXAMPLE CORP" as manufacturer,
Part-DB will automatically select the element with the name "Example Corp" from your database.
As the names of these fields differ from provider to provider (and maybe not even normalized for the same provider), you
can define multiple alternative names for an element (on their editing page).
For example if define a manufacturer "Example Corp" with the alternative names "Example Corp.", "Example Corp", "Example
Corp. Inc." and "Example Corporation",
then the provider can return any of these names and Part-DB will still automatically select the right element.
If Part-DB finds no matching element, it will automatically create a new one, when you do not change the value before
saving.
## Attachment types
The information provider system uses attachment types to differentiate between datasheets and image attachments.
For this it will create a "Datasheet" and "Image" attachment type on the first run. You can change the names of these
types in the attachment type settings (as long as you keep the "Datasheet"/"Image" in the alternative names field).
If you already have attachment types for images and datasheets and want the information provider system to use them, you
can
add the alternative names "Datasheet" and "Image" to the alternative names field of the attachment types.
## Data providers
The system tries to be as flexible as possible, so many different information sources can be used.
Each information source is called am "info provider" and handles the communication with the external source.
The providers are just a driver which handles the communication with the different external sources and converts them
into a common format Part-DB understands.
That way it is pretty easy to create new providers as they just need to do very little work.
Normally the providers utilize an API of a service, and you need to create an account at the provider and get an API key.
Also, there are limits on how many requests you can do per day or months, depending on the provider and your contract
with them.
The following providers are currently available and shipped with Part-DB:
(All trademarks are property of their respective owners. Part-DB is not affiliated with any of the companies.)
### Octopart
The Octopart provider uses the [Octopart / Nexar API](https://nexar.com/api) to search for parts and getting
information.
To use it you have to create an account at Nexar and create a new application on
the [Nexar Portal](https://portal.nexar.com/).
The name does not matter, but it is important that the application has access to the "Supply" scope.
In the Authorization tab, you will find the client ID and client secret, which you have to put in the Part-DB env
configuration (see below).
Please note that the Nexar API in the free plan is limited to 1000 results per month.
That means if you search for a keyword and results in 10 parts, then 10 will be subtracted from your monthly limit. You
can see your current usage on the Nexar portal.
Part-DB caches the search results internally, so if you have searched for a part before, it will not count against your
monthly limit again, when you create it from the search results.
Following env configuration options are available:
* `PROVIDER_OCTOPART_CLIENT_ID`: The client ID you got from Nexar (mandatory)
* `PROVIDER_OCTOPART_SECRET`: The client secret you got from Nexar (mandatory)
* `PROVIDER_OCTOPART_CURRENCY`: The currency you want to get prices in if available (optional, 3 letter ISO-code,
default: `EUR`). If an offer is only available in a certain currency,
Part-DB will save the prices in their native currency, and you can use Part-DB currency conversion feature to convert
it to your preferred currency.
* `PROVIDER_OCOTPART_COUNTRY`: The country you want to get prices in if available (optional, 2 letter ISO-code,
default: `DE`). To get correct prices, you have to set this and the currency setting to the correct value.
* `PROVIDER_OCTOPART_SEARCH_LIMIT`: The maximum number of results to return per search (optional, default: `10`). This
affects how quickly your monthly limit is used up.
* `PROVIDER_OCTOPART_ONLY_AUTHORIZED_SELLERS`: If set to `true`, only offers
from [authorized sellers](https://octopart.com/authorized) will be returned (optional, default: `false`).
**Attention**: If you change the octopart clientID after you have already used the provider, you have to remove the
OAuth token in the Part-DB database. Remove the entry in the table `oauth_tokens` with the name `ip_octopart_oauth`.
### Digi-Key
The Digi-Key provider uses the [Digi-Key API](https://developer.digikey.com/) to search for parts and getting shopping
information from [Digi-Key](https://www.digikey.com/).
To use it you have to create an account at Digi-Key and get an API key on
the [Digi-Key API page](https://developer.digikey.com/).
You must create an organization there and create a "Production app". Most settings are not important, you just have to
grant access to the "Product Information" API.
You will get a Client ID and a Client Secret, which you have to put in the Part-DB env configuration (see below).
Following env configuration options are available:
* `PROVIDER_DIGIKEY_CLIENT_ID`: The client ID you got from Digi-Key (mandatory)
* `PROVIDER_DIGIKEY_SECRET`: The client secret you got from Digi-Key (mandatory)
* `PROVIDER_DIGIKEY_CURRENCY`: The currency you want to get prices in (optional, default: `EUR`)
* `PROVIDER_DIGIKEY_LANGUAGE`: The language you want to get the descriptions in (optional, default: `en`)
* `PROVIDER_DIGIKEY_COUNTRY`: The country you want to get the prices for (optional, default: `DE`)
The Digi-Key provider needs an additional OAuth connection. To do this, go to the information provider
list (`https://your-partdb-instance.tld/tools/info_providers/providers`),
go the Digi-Key provider (in the disabled page) and click on the "Connect OAuth" button. You will be redirected to
Digi-Key, where you have to log in and grant access to the app.
To do this your user needs the "Manage OAuth tokens" permission from the "System" section in the "System" tab.
The OAuth connection should only be needed once, but if you have any problems with the provider, just click the button
again, to establish a new connection.
### TME
The TME provider use the API of [TME](https://www.tme.eu/) to search for parts and getting shopping information from
them.
To use it you have to create an account at TME and get an API key on the [TME API page](https://developers.tme.eu/en/).
You have to generate a new anonymous key there and enter the key and secret in the Part-DB env configuration (see
below).
Following env configuration options are available:
* `PROVIDER_TME_KEY`: The API key you got from TME (mandatory)
* `PROVIDER_TME_SECRET`: The API secret you got from TME (mandatory)
* `PROVIDER_TME_CURRENCY`: The currency you want to get prices in (optional, default: `EUR`)
* `PROVIDER_TME_LANGUAGE`: The language you want to get the descriptions in (`en`, `de` and `pl`) (optional,
default: `en`)
* `PROVIDER_TME_COUNTRY`: The country you want to get the prices for (optional, default: `DE`)
* `PROVIDER_TME_GET_GROSS_PRICES`: If this is set to `1` the prices will be gross prices (including tax), otherwise net
prices (optional, default: `0`)
### Farnell / Element14 / Newark
The Farnell provider uses the [Farnell API](https://partner.element14.com/) to search for parts and getting shopping
information from [Farnell](https://www.farnell.com/).
You have to create an account at Farnell and get an API key on the [Farnell API page](https://partner.element14.com/).
Register a new application there (settings does not matter, as long as you select the "Product Search API") and you will
get an API key.
Following env configuration options are available:
* `PROVIDER_ELEMENT14_KEY`: The API key you got from Farnell (mandatory)
* `PROVIDER_ELEMENT14_STORE_ID`: The store ID you want to use. This decides the language of results, currency and
country of prices (optional, default: `de.farnell.com`,
see [here](https://partner.element14.com/docs/Product_Search_API_REST__Description) for available values)
### Mouser
The Mouser provider uses the [Mouser API](https://www.mouser.de/api-home/) to search for parts and getting shopping
information from [Mouser](https://www.mouser.com/).
You have to create an account at Mouser and register for an API key for the Search API on
the [Mouser API page](https://www.mouser.de/api-home/).
You will receive an API token, which you have to put in the Part-DB env configuration (see below):
At the registration you choose a country, language and currency in which you want to get the results.
Following env configuration options are available:
* `PROVIDER_MOUSER_KEY`: The API key you got from Mouser (mandatory)
* `PROVIDER_MOUSER_SEARCH_LIMIT`: The maximum number of results to return per search (maximum 50)
* `PROVIDER_MOUSER_SEARCH_OPTION`: You can choose an option here to restrict the search results to RoHs compliant and
available parts. Possible values are `None`, `Rohs`, `InStock`, `RohsAndInStock`.
* `PROVIDER_MOUSER_SEARCH_WITH_SIGNUP_LANGUAGE`: A bit of an obscure option. The original description of Mouser is: Used
when searching for keywords in the language specified when you signed up for Search API.
### Custom provider
To create a custom provider, you have to create a new class implementing the `InfoProviderInterface` interface. As long
as it is a valid Symfony service, it will be automatically loaded and can be used.
Besides some metadata functions, you have to implement the `searchByKeyword()` and `getDetails()` functions, which do
the actual API requests and return the information to Part-DB.
See the existing providers for examples.
If you created a new provider, feel free to create a pull request to add it to the Part-DB core.
## Result caching
To reduce the number of API calls against the providers, the results are cached:
* The search results (exact search term) are cached for 7 days
* The product details are cached for 4 days
If you need a fresh result, you can clear the cache by running `php .\bin\console cache:pool:clear info_provider.cache`
on the command line.
The default `php bin/console cache:clear` also clears the result cache, as it clears all caches.

Some files were not shown because too many files have changed in this diff Show More