Compare commits

..

1033 Commits

Author SHA1 Message Date
snipe
885ab64c2e Merge branch 'master' of https://github.com/snipe/snipe-it 2022-02-13 12:01:59 -07:00
snipe
8624531f78 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2022-02-13 12:01:37 -07:00
snipe
db0c0e7908 Merge pull request #10665 from snipe/fixes/adds_gate_to_supplier_view
Adds gate to supplier
2022-02-13 10:56:55 -08:00
snipe
d77a47765e Adds gate to supplier
Signed-off-by: snipe <snipe@snipe.net>
2022-02-13 11:53:45 -07:00
snipe
05c0819776 Updated language string
Signed-off-by: snipe <snipe@snipe.net>
2022-02-11 15:55:42 -08:00
snipe
16f963fa3d Merge branch 'master' of https://github.com/snipe/snipe-it 2022-02-11 13:07:29 -08:00
snipe
e032cf1fda Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2022-02-11 13:07:26 -08:00
snipe
10c26f38c4 Merge pull request #10662 from snipe/fixes/tighter_security_on_select_lists
Added additional gate for selectlists
2022-02-11 12:48:55 -08:00
snipe
d6b8222371 Refactor to combine permissions
Signed-off-by: snipe <snipe@snipe.net>
2022-02-11 12:48:30 -08:00
snipe
2c5abaaea4 Fixed copypasta
Signed-off-by: snipe <snipe@snipe.net>
2022-02-11 12:32:09 -08:00
snipe
c1a0653847 Restrict to update or create gate methods for select lists
Signed-off-by: snipe <snipe@snipe.net>
2022-02-11 12:31:11 -08:00
snipe
9226c8292d Fixed typos in comments
Signed-off-by: snipe <snipe@snipe.net>
2022-02-11 12:02:14 -08:00
snipe
5fafa81dc1 Forgot components
Signed-off-by: snipe <snipe@snipe.net>
2022-02-11 11:57:29 -08:00
snipe
b30d1dce89 Removed selectlist
Signed-off-by: snipe <snipe@snipe.net>
2022-02-11 11:55:24 -08:00
snipe
2dad27eed6 Added additional gate for selectlists
Signed-off-by: snipe <snipe@snipe.net>
2022-02-11 11:46:14 -08:00
snipe
f5ffda8053 Ahem.
Signed-off-by: snipe <snipe@snipe.net>
2022-02-10 22:43:51 -08:00
snipe
5703b95de3 Merge pull request #10657 from snipe/fixes/handle_deleted_auditor
Fixed - Check for valid user before trying to present the auditor name
2022-02-10 20:14:24 -08:00
snipe
d406dc43c2 Check for valid user before trying to present the auditor name
Signed-off-by: snipe <snipe@snipe.net>
2022-02-10 20:13:02 -08:00
snipe
2ce44bd4e6 Line break for easier debugging
Signed-off-by: snipe <snipe@snipe.net>
2022-02-10 20:06:55 -08:00
snipe
ed931ef0cd Merge pull request #10654 from inietov/fixes/trying_to_get_property_checkin_email_of_non-object
Fixes  ErrorException: Trying to get property 'checkin_email' of non-object [sc-17568]
2022-02-10 12:23:50 -08:00
Ivan Nieto Vivanco
bf4ee18123 Validates if model and model->category exist before return the checkin_email property 2022-02-10 11:58:55 -06:00
snipe
70af10ae6c Merge pull request #10640 from JonathonReinhart/10552-add-checkin-api-date
Fix #10552: Add checkin_at parameter to /hardware/:id/checkin API
2022-02-10 09:54:20 -08:00
snipe
9892e5bf60 Merge pull request #10646 from snipe/fixes/check_field_exist_before_detaching
Check that the field exists before trying to detach it from the fieldset
2022-02-09 16:33:02 -08:00
snipe
b9a8d45c07 Better messaging
Signed-off-by: snipe <snipe@snipe.net>
2022-02-09 16:30:42 -08:00
snipe
7794c2f44b Check that the fieldset exists before trying to detach it from the fieldset
Signed-off-by: snipe <snipe@snipe.net>
2022-02-09 16:16:16 -08:00
snipe
eedc14401a Switch to searching on semicolon instead of &
Signed-off-by: snipe <snipe@snipe.net>
2022-02-09 15:55:22 -08:00
snipe
4e14d70427 Added jobtitle to unescaper
Signed-off-by: snipe <snipe@snipe.net>
2022-02-09 15:50:44 -08:00
snipe
2a71690aaf Added license_name to unescaper
Signed-off-by: snipe <snipe@snipe.net>
2022-02-09 15:17:57 -08:00
snipe
e4da00ca82 Catch potential validation errors on unescape tool
Signed-off-by: snipe <snipe@snipe.net>
2022-02-09 15:09:49 -08:00
snipe
4fd14e5859 Added slightly more output because wtf?
Signed-off-by: snipe <snipe@snipe.net>
2022-02-09 15:05:28 -08:00
snipe
441f1fbb64 Remove html_entities_decode restriction
Signed-off-by: snipe <snipe@snipe.net>
2022-02-09 14:56:36 -08:00
snipe
bf194d7794 Regenerate JS assets
Signed-off-by: snipe <snipe@snipe.net>
2022-02-09 14:43:30 -08:00
snipe
d06e3dd892 Merge branch 'master' of https://github.com/snipe/snipe-it 2022-02-09 14:40:33 -08:00
snipe
6b25b53462 Merge pull request #10628 from inietov/fixes/default_values_dont_allow_checkbox_radio
Fixes #10299 Default Values do not allow Checkbox/Radio Buttons
2022-02-09 14:39:46 -08:00
Ivan Nieto Vivanco
6d79c9f3e2 Save the default values for custom fields with same format than Assets do for actual values 2022-02-09 13:41:33 -06:00
Ivan Nieto Vivanco
a36957dd77 Finish the implementation of custom fields default values for checkboxes 2022-02-09 13:12:42 -06:00
Ivan Nieto Vivanco
2f3499e4b9 Show checkboxes a little less assy, actually save the data checked by them 2022-02-09 10:49:10 -06:00
Jonathon Reinhart
3536d08477 Add checkin_at parameter to /hardware/:id/checkin API
Fixes #10552
2022-02-08 20:23:09 -05:00
snipe
ee3166cdc2 Add @savornicesei as a contributor 2022-02-08 15:38:20 -08:00
snipe
7a117a22c8 Merge pull request #10637 from uberbrady/report_invalid_json
Alert when invalid JSON is submitted to something that wants it
2022-02-08 12:17:20 -08:00
Brady Wetherington
9a66f6a254 Remove extraneous backslash 2022-02-08 12:09:40 -08:00
Brady Wetherington
5e94726ec1 Properly alert when invalid JSON is submitted to something that wants JSON 2022-02-08 12:05:05 -08:00
snipe
66c3559e1c Merge pull request #10636 from inietov/fixes/inconsistencies_between_checkout_checkin_dates_master
Fixes #10627 Inconsistencies between checkout/checkin dates on asset history and activity log for master branch
2022-02-08 10:19:16 -08:00
Ivan Nieto Vivanco
413e44be2f Add custom date to checkin actionlogs and show it in the history of the asset tab 2022-02-08 11:58:23 -06:00
snipe
ebc35c4519 Merge pull request #10630 from JonathonReinhart/10629-checkin-API-error-status
Fix /hardware/{id}/checkin API response on error
2022-02-08 08:54:17 -08:00
Jonathon Reinhart
cd963179fd Fix /hardware/{id}/checkin API response on error
Fixes #10629
2022-02-08 01:08:42 -05:00
Ivan Nieto Vivanco
796a0ebdaa Add initial support for default values in checkboxes customfields 2022-02-07 22:17:40 -06:00
snipe
474f24e40e Merge branch 'master' of https://github.com/snipe/snipe-it 2022-02-07 18:27:59 -08:00
snipe
b3a0f86431 Temp fix for weird JSON format in history
Signed-off-by: snipe <snipe@snipe.net>
2022-02-07 18:27:55 -08:00
snipe
1a31231569 Merge pull request #10623 from uberbrady/fix_secure_hosts_in_subdirectory
Fixes #10577 - Fix "secure hostnames" feature for subdirectory-based Snipe-IT installs
2022-02-07 11:33:33 -08:00
Brady Wetherington
f1d4087317 Fix "secure hostnames" feature for subdirectory-based Snipe-IT installs 2022-02-07 11:26:54 -08:00
snipe
f4069e00cd Merge pull request #10611 from uberbrady/master
D'oh! Migration fails on empty settings table :(
2022-02-03 20:07:01 -08:00
Brady Wetherington
8650faf0d8 D'oh! Migration fails on empty settings table :( 2022-02-03 20:04:33 -08:00
snipe
796ef741e8 Merge pull request #10610 from uberbrady/fixes/ldap_active_status
Fixes #10563 - Rework the LDAP sync command to better handle the active flag
2022-02-03 19:45:41 -08:00
Brady Wetherington
36ae6f9430 Yanked debugging code, tightened up comments. 2022-02-03 19:41:16 -08:00
Brady Wetherington
1945b97b72 Just trying to really tighten up on the LDAP Active Flag and how we parse it. 2022-02-03 19:04:56 -08:00
Brady Wetherington
392e61688d Rework the LDAP sync command to better handle the active flag 2022-02-03 15:01:45 -08:00
snipe
db82e06665 Fixed migration with invalid LDAP prepopulation value
Signed-off-by: snipe <snipe@snipe.net>
2022-02-02 18:22:51 -08:00
snipe
ac5c6123bc Fixes #10563 - LDAP active flag - hopefully?
Signed-off-by: snipe <snipe@snipe.net>
2022-02-02 18:07:34 -08:00
snipe
8add47739e Merge pull request #10604 from inietov/fixes/column_activated_cannot_be_null
Fixes: Column activated cannot be null [sc-18528]
2022-02-02 12:21:31 -08:00
Ivan Nieto Vivanco
eac8e0bdba Add a casting to a truthy/falsy that needs to be integer 2022-02-02 13:54:57 -06:00
snipe
2815e0d36e Fixed audit email template (applies #10592 to master)
Signed-off-by: snipe <snipe@snipe.net>
2022-02-01 17:27:32 -08:00
snipe
2e998b110f Add @TenOfTens as a contributor 2022-02-01 13:40:31 -08:00
snipe
f45c963428 Merge pull request #10586 from inietov/fixes/bulkedit_does_not_show_in_history
Fixes Bulk edit doesn't show in Asset's history nor Activity report [sc-16550]
2022-01-31 23:07:02 -08:00
Ivan Nieto Vivanco
2fec40d7df Adds actionlog for bulk edits 2022-02-01 00:00:12 -06:00
snipe
215beb9d8a Merge pull request #10580 from misilot/fix-10176-webui-master
Replace .my.cnf with column-statistics.cnf at the system level for mysqldump (master)
2022-01-29 07:16:24 -08:00
Tom Misilo
b0c61ee044 Replace .my.cnf with column-statistics.cnf at the system level for mysqldump
Fixes #10176

The `column-statistics.cnf` file is copied to `/etc/mysql/conf.d/column-statistics.cnf` for each Dockerfile that exists.

This puts it as a system level mysql client change, so the web ui interface also works.
2022-01-29 07:28:12 -06:00
snipe
16fb2213b5 Updated language strings
Signed-off-by: snipe <snipe@snipe.net>
2022-01-28 12:40:03 -08:00
snipe
a0d0645453 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2022-01-28 12:38:42 -08:00
snipe
1ef336a08b Merge pull request #10576 from snipe/features/add_custom_fields_search
Added #9576 - Lookup Asset by Custom Field via API [sc-18632]
2022-01-28 09:51:28 -08:00
snipe
aa3aa78204 Adds Lookup Asset by Custom Field via API [sc-18632]
Signed-off-by: snipe <snipe@snipe.net>
2022-01-28 09:08:48 -08:00
snipe
db0a078c0b Merge pull request #10573 from uberbrady/fix_force_root_url
Add some guardrails around very-badly formatted APP_URL settings
2022-01-27 11:29:29 -08:00
Brady Wetherington
1cf1278b3b Fix whitespace issues 2022-01-27 11:28:51 -08:00
Brady Wetherington
70648dedd3 Add some guardrails around very-badly formatted APP_URL settings 2022-01-27 11:21:46 -08:00
snipe
9634dde0dd Merge pull request #10567 from inietov/fixes/importing_and_checking_out_licenses_master
Fixes Importing licenses without product key duplicates the license
2022-01-27 10:58:06 -08:00
snipe
077caa29f8 Merge pull request #10570 from inietov/fixes/donked_layout_required_field_error_depreciation
Fixes donked layout required field error depreciation [sc-17111]
2022-01-26 21:23:51 -08:00
Ivan Nieto Vivanco
a87478d3ac Set the actual field we are evaluating as required (months) 2022-01-26 23:02:27 -06:00
Ivan Nieto Vivanco
44349db597 Fixes the appearance of some error messages 2022-01-26 22:58:02 -06:00
snipe
c70ae19c28 Merge pull request #10529 from uberbrady/fix_insecure_host_headers
Force UrlGenerator's Root URL to be the base of APP_URL unless overriden (v5)
2022-01-26 16:59:55 -08:00
Ivan Nieto Vivanco
55fdc86e02 Tweak query in the License Importer to not require a Product Key 2022-01-26 17:51:04 -06:00
snipe
0721ab8bbf Regenerated production assets
Signed-off-by: snipe <snipe@snipe.net>
2022-01-20 11:01:04 -08:00
snipe
00c8a1ee21 Merge pull request #10533 from inietov/feature/add_remaining_address_field_to_user_import
Add Zip field in the User Importer [sc-18556]
2022-01-19 12:07:18 -08:00
Ivan Nieto Vivanco
1fc71a4111 Add Zip field in the User Importer 2022-01-19 13:35:54 -06:00
Brady Wetherington
0c4768fd2a Force UrlGenerator's Root URL to be the base of APP_URL unless overriden
(For v5)
2022-01-18 15:52:59 -08:00
snipe
f9647614ab Merge pull request #10527 from inietov/fixes/pdo_exception_syntax_error_when_sendexpirationalers_is_called
Fixes PDO exeception syntax error when Expiring Alerts Threshold is not set
2022-01-18 12:43:08 -08:00
Ivan Nieto Vivanco
a05795420a Respect the default value of 60 days in expiring licenses 2022-01-18 14:34:14 -06:00
Ivan Nieto Vivanco
42d86bf57b Adds default values if the expiring alerts threshold is null 2022-01-18 14:21:49 -06:00
snipe
201b52baf8 Merge pull request #10523 from inietov/fixes/depreciation_report_shows_assets_that_not_deprecate_master
Fixes bug where the depreciation report shows assets that not deprecate for master
2022-01-18 10:37:21 -08:00
Ivan Nieto Vivanco
f510b9c2a9 Add query to filter non-deprecable assets when the Depreciation Report is called 2022-01-15 14:21:31 -06:00
snipe
75bd365ca1 Merge pull request #10521 from inietov/fixes/sc-14356/importer_creating_duplicate_asset_models_master
Fixes an issue where importer is creating duplicate asset models for Master Branch
2022-01-15 07:46:39 -08:00
Ivan Nieto Vivanco
153c30eda8 Add to Importer the capacity to search Models only with Model Name since Model Number is not required 2022-01-15 04:32:47 -06:00
snipe
be7e6ed847 Merge pull request #10502 from uberbrady/ldap_useraccountcontrol_dont_req_preauth
Add new UserAccountControl to permitted UAC's for AD.
2022-01-13 17:01:47 -08:00
snipe
115109f612 Merge pull request #10510 from misilot/fix-10176-master
Looks great, thanks!
2022-01-13 13:22:22 -08:00
Thomas Misilo
037a912e21 Adding .my.cnf to disable column-statistics backup
Fixes #10176

The ```.my.cnf``` file is copied to ```/root/.my.cnf``` for each
Dockerfile that exists
2022-01-13 15:16:59 -06:00
snipe
984db1ef44 Apply personal API token fix to master
Signed-off-by: snipe <snipe@snipe.net>
2022-01-13 01:39:56 -08:00
Brady Wetherington
c8fe929e09 Add new UserAccountControl to permitted UAC's for AD. 2022-01-12 12:07:51 -08:00
snipe
181dc5127f Add @UniversalSuperBox as a contributor 2022-01-11 15:03:08 -08:00
snipe
303fc39966 Regenerated assets to pikc up #10089 changes
Signed-off-by: snipe <snipe@snipe.net>
2022-01-11 14:38:17 -08:00
snipe
730c2a6821 Merge pull request #10496 from UniversalSuperBox/fix/improve-asset-card-view
Fixed #10089 (partially): Back to master: Added some BS tables style overrides for mobile
2022-01-11 14:10:18 -08:00
snipe
bc10761b49 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2022-01-11 12:44:16 -08:00
snipe
cf14a0222c Merge pull request #10498 from Haxatron/master
Fix access control
2022-01-10 19:24:31 -08:00
snipe
b18b3812df Back to master: Added some BS tables style overrides for mobile
This repeats 06e8e826, which alone improves the mobile view immensely,
on master.
2022-01-10 15:23:43 -06:00
Haxatron
bb095641c2 Update BulkAssetModelsController.php
https://huntr.dev/bounties/efdf2ead-f9d1-4767-9f02-d11f762d15e7
2022-01-06 09:50:11 +08:00
snipe
b78e610ce3 Merge pull request #10480 from snipe/fixes/check_for_valid_custom_field
Fixed format property on invalid custom field object when trying to edit a field that doesn't exist
2022-01-03 19:28:25 -08:00
snipe
884b6b0270 Fixes format property on invalid custom field object
Signed-off-by: snipe <snipe@snipe.net>
2022-01-03 19:14:50 -08:00
snipe
7a1ab1292c Merge pull request #10479 from adagioajanes/fixes/auto_asset_tag_phrasing
Fixed auto asset tag phrasing
2021-12-31 15:17:59 -08:00
Alex Janes
87bb741013 Merge branch 'snipe:master' into fixes/auto_asset_tag_phrasing 2021-12-31 16:34:57 -05:00
Alex Janes
5fe2083688 Adjusted the phrasing around auto-incrementing asset tags. 2021-12-31 16:33:30 -05:00
snipe
2ee84c2675 Added a few more comments
Signed-off-by: snipe <snipe@snipe.net>
2021-12-30 18:33:28 -08:00
snipe
39a5b6b426 Merge pull request #10478 from snipe/fixes/whitelist_modal_views
Added allow list to modal view options
2021-12-30 18:29:30 -08:00
snipe
c6ce928567 Added allow list to modal view options
Signed-off-by: snipe <snipe@snipe.net>
2021-12-30 18:16:49 -08:00
snipe
950a23b0f4 Merge pull request #10476 from snipe/fixes/custom_fieldsets_index
Fixed missing index for fieldsets
2021-12-30 13:18:13 -08:00
snipe
b4fac3e4ae Fixed missing index for fieldsets
Signed-off-by: snipe <snipe@snipe.net>
2021-12-30 13:16:44 -08:00
snipe
548e483ef8 Merge pull request #10475 from snipe/fixes/wrong_default_sort_on_kits
Fixed assets_count doesnt exist as a column on kits
2021-12-30 13:02:12 -08:00
snipe
bad6b862ca assets_count doesnt exist as a column
Signed-off-by: snipe <snipe@snipe.net>
2021-12-30 12:59:16 -08:00
snipe
4e336e11ee Merge pull request #10470 from snipe/increase_address_length_for_supplier
Fixed #10469 - increased size of supplier address field
2021-12-27 12:29:13 -08:00
snipe
8588e9ebf1 Fixed #10469 - increased size of supplier address field
Signed-off-by: snipe <snipe@snipe.net>
2021-12-27 12:28:02 -08:00
snipe
11524d0f7d Merge pull request #10463 from adagioajanes/fixes/pass_total_to_GroupsTransformer
Fixed #10461: Groups management page did not paginate correctly
2021-12-24 10:39:22 -08:00
Alex Janes
d0bfd8dfd2 Fixed the collection of the groups total to GroupsTransformer.php. Groups page should now paginate correctly. 2021-12-23 20:54:34 -05:00
snipe
312200bf44 Removed duplicate "department" entry in importer, pulls #10460 to master
Signed-off-by: snipe <snipe@snipe.net>
2021-12-21 13:37:20 -08:00
snipe
04f4bb83e9 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-12-16 20:37:22 -08:00
snipe
9b2dd6522f Switch GET to POST for asset request
Signed-off-by: snipe <snipe@snipe.net>
2021-12-16 20:36:08 -08:00
snipe
a05fe9c1f7 Add @exula as a contributor 2021-12-15 09:30:36 -08:00
snipe
395401e9db Merge pull request #10439 from exula/exula-fix-slack-settings
Update SettingsController.php to save Slack Settings
2021-12-15 08:36:18 -08:00
Bradley Coudriet
dbdc1c7f3f Update SettingsController.php to save Slack Settings
This goes with #10438 that I just submitted about Slack Settings not saving.

This adds the necessary code to actually save the Slack Settings,
As they are already validated by the SlackSettingsRequest, this seems like an easy and low-impact fix.
2021-12-15 10:38:51 -05:00
snipe
ace4a00e29 Merge pull request #10433 from inietov/features/adding_title_to_custom_report_master
Add title column to custom reports on master branch
2021-12-14 10:28:18 -08:00
Ivan Nieto Vivanco
c80aa2a289 Add title column to custom reports 2021-12-14 12:05:33 -06:00
snipe
25e2e7ecc6 Merge pull request #10418 from inietov/fixes/bulk_edit_count_more_users_than_selected
Fixes bulk edit message counts more users than the actual selected users number
2021-12-13 14:13:14 -08:00
snipe
02be4773de Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-12-13 12:07:34 -08:00
snipe
c988d84271 Merge pull request #10426 from snipe/fixes/added_escape_to_asset_api_assigned_to
Added escape to assigned_to API response
2021-12-13 12:06:08 -08:00
snipe
9d5d1a9f9a Added escape to assigned_to API response
Signed-off-by: snipe <snipe@snipe.net>
2021-12-13 12:03:03 -08:00
snipe
3a7cef15bd Merge pull request #10423 from misilot/automated-image-build-github-actions
Automatic Building of Docker Images and Pushing to DockerHub
2021-12-13 11:32:57 -08:00
snipe
44d3a425cb Merge pull request #10422 from misilot/docker-alpine-build-automatic
Adds an automatic build for Alpine Linux based Image
2021-12-13 11:32:42 -08:00
snipe
1854d7d668 Updated language strings
Signed-off-by: snipe <snipe@snipe.net>
2021-12-13 11:28:01 -08:00
snipe
e5f4048e9e Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-12-13 11:01:02 -08:00
Thomas Misilo
5e58f60845 Adds an automatic build for Alpine Linux based Image
This Fixes #10339, and allows for automatic building of the Alpine Linux
image, and push to docker-hub.

This will push a "latest-alpine" based on the master branch, a
"develop-alpine" based on the develop branch, and a v##.##.##-alpine
image based on any released version.

`DOCKER_USERNAME` and `DOCKER_ACCESS_TOKEN` do both need
to be added to the repository as secrets.
2021-12-13 10:39:55 -06:00
Thomas Misilo
a7760b331b Automatic Building of Docker Images and Pushing to DockerHub
This allows for building and pushing of the Snipe-IT docker images
directly from GitHub to DockerHub.

This will push a "latest" based on the master branch, a
"develop" based on the develop branch, and a v##.##.##
image based on any released version.

`DOCKER_USERNAME` and `DOCKER_ACCESS_TOKEN` do both need
to be added to the repository as secrets.
2021-12-13 10:39:04 -06:00
Ivan Nieto Vivanco
a419a690d4 Add a variable to better control the selected user's ids 2021-12-11 18:01:38 -06:00
snipe
39b0dc136c Added LDAP strings back
Signed-off-by: snipe <snipe@snipe.net>
2021-12-11 10:14:35 -08:00
snipe
d0e7879c89 Merge pull request #10415 from uberbrady/fix_actionlog_memory_exhaustion
Remove 'actionlog' from the ::with() clause in the asset query API
2021-12-10 19:10:40 -08:00
Brady Wetherington
acfb41f129 Remove 'actionlog' from the ::with() clause in the asset query API 2021-12-10 18:42:56 -08:00
snipe
5381aa3fbd Merge branch 'master' of https://github.com/snipe/snipe-it 2021-12-10 15:17:45 -08:00
snipe
e20a10a6a1 Add @Haxatron as a contributor 2021-12-10 15:17:26 -08:00
snipe
949141a8e7 Merge pull request #10414 from snipe/added_model_to_accessory_report
Added model number to accessory report
2021-12-10 15:10:02 -08:00
snipe
e1bf3b50f4 Added model number to accessory report
Signed-off-by: snipe <snipe@snipe.net>
2021-12-10 15:09:29 -08:00
snipe
cf5e3da3a5 Merge pull request #10406 from Haxatron/fix-access-control
security fix
2021-12-09 11:23:35 -08:00
Haxatron
1699c09758 Update AssetModelsController.php 2021-12-09 21:42:18 +08:00
Haxatron
918e7c8dae Fix access control - https://huntr.dev/bounties/19453ef1-4d77-4cff-b7e8-1bc8f3af0862/ 2021-12-09 12:57:04 +08:00
snipe
86afe6c4b1 Cleanup slack validation
Signed-off-by: snipe <snipe@snipe.net>
2021-12-08 18:03:56 -08:00
snipe
ff97b359ad Removed form request on ajax, cleaned up some other things
Signed-off-by: snipe <snipe@snipe.net>
2021-12-08 17:58:46 -08:00
snipe
81b66d0039 Change validation failure to 422 to make it consistent with Laravel's default
Signed-off-by: snipe <snipe@snipe.net>
2021-12-08 17:54:35 -08:00
snipe
8fa690b635 Reverting form request because it doesn't seem to work (????!!)
Signed-off-by: snipe <snipe@snipe.net>
2021-12-08 17:54:15 -08:00
snipe
8c1cd87831 Added slacksettingsrequest as use statement
Signed-off-by: snipe <snipe@snipe.net>
2021-12-08 15:56:22 -08:00
snipe
cde2bad297 Small mods to slack jquery
Signed-off-by: snipe <snipe@snipe.net>
2021-12-08 15:56:05 -08:00
snipe
80d36cd72b Added slack settings request
Signed-off-by: snipe <snipe@snipe.net>
2021-12-08 15:53:05 -08:00
snipe
a579353198 Add @bestlong as a contributor 2021-11-24 20:04:26 -08:00
snipe
7360e15d4e Add @sneak-it as a contributor 2021-11-24 20:04:05 -08:00
snipe
9dc2fa61b8 Add @adamboutcher as a contributor 2021-11-24 20:03:52 -08:00
snipe
80fd49a59e Add @leitwerk-ag as a contributor 2021-11-24 20:03:40 -08:00
snipe
d30fa9199c Merge branch 'master' of https://github.com/snipe/snipe-it 2021-11-24 19:58:52 -08:00
snipe
8028b39b43 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-11-24 19:58:43 -08:00
snipe
ff81e6d536 Merge pull request #10361 from snipe/fixes/xss_in_accessories_checkout_notes
Escape notes in transformCheckedOutAccessory
2021-11-24 19:56:36 -08:00
snipe
00fad35c2a Escape notes in transformCheckedOutAccessory
Signed-off-by: snipe <snipe@snipe.net>
2021-11-24 19:54:45 -08:00
snipe
3b68a6f1be Merge pull request #10345 from leitwerk-ag/master
Fixed #10344 and #9135: don't prepand fields with a whitespace in text based export formats
2021-11-24 19:43:21 -08:00
snipe
bc91aef47d Merge pull request #10352 from adamboutcher/install_rocky
Improved Installer: Added Rocky Linux Support
2021-11-24 19:42:37 -08:00
snipe
3debe78574 Merge pull request #10350 from inietov/fixes/trim_custom_fields_names
Apply trim() function when storing Custom Fields names
2021-11-24 19:42:04 -08:00
snipe
fc1b3b31b5 Merge pull request #10358 from sneak-it/bullseye
Improved Installer: Add Debian 11 (Bullseye) install script support
2021-11-24 19:41:37 -08:00
snipe
4afd598df7 Merge pull request #10356 from bestlong/fix_modal_dialog_html_typo
fix modal-title html tag unpaired.
2021-11-24 19:39:58 -08:00
snipe
d1d3f893ac Merge pull request #10360 from snipe/fixes/escaped_characters_on_asset_create_checkout
Removed escaping on input save for asset checkout on creation
2021-11-24 19:20:54 -08:00
snipe
830d07f84f Removed escaping on input save for asset checkout on creation
Signed-off-by: snipe <snipe@snipe.net>
2021-11-24 19:19:32 -08:00
snipe
0e30b9aef7 Merge pull request #10355 from inietov/fixes/customfields_with_date_format_doesnt_display_default_value_master
Fixes Default Values - Date not applying for master branch
2021-11-24 18:22:02 -08:00
sneaK
b937aedc30 Add Debian 11 (Bullseye) install script support 2021-11-24 10:24:05 -05:00
Shao Yu-Lung
55d05eeae3 fix modal-title html tag unpaired. 2021-11-24 10:28:10 +08:00
Ivan Nieto Vivanco
d95d3dc282 Add the call to defaultValue() function in custom fields with date format 2021-11-23 17:21:46 -06:00
Adam
ab06c26527 Rocky Linux Support
Addition to enable Rocky Linux installation.
2021-11-23 16:13:38 +00:00
Ivan Nieto Vivanco
1ca770895a Apply trim() function when storing Custom Fields names 2021-11-22 18:43:21 -06:00
Klaus J. Mueller
a85fa14f9c fix #10344 and #9135 2021-11-22 17:58:26 +01:00
snipe
b058d84f2c Merge pull request #10322 from snipe/uberbrady-patch-2
Change the `[END]` directive in `.htaccess` to `[L]`
2021-11-17 18:01:52 -08:00
Brady Wetherington
5fb05d8b1c Change the [END] directive in .htaccess to [L]
This allows backwards-compatibility with older Apache versions (which we _used_ to have), and should do the exact same thing.
2021-11-17 15:29:51 -08:00
snipe
78809c0fe7 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-11-16 12:02:45 -08:00
snipe
7ce5993f5a Merge pull request #10315 from snipe/fixes/escape_custom_fields_in_api_response
Escape custom field values in API response
2021-11-15 20:33:51 -08:00
snipe
f7b483358f Escape custom field values in API response
Signed-off-by: snipe <snipe@snipe.net>
2021-11-15 20:32:59 -08:00
snipe
e75a5f13ec Merge pull request #10303 from inietov/fixes/weird_field_showing_up
Added the current_value string to correspondig 'en' language directory
2021-11-15 14:29:34 -08:00
snipe
cf4e13f4df Merge pull request #10312 from andrewshulgin/patch-1
Fixed: #10311: Docker: ldap_client_tls.{key,cert} are located in /var/www/html/storage instead of /var/lib/snipeit/keys
2021-11-15 14:28:59 -08:00
snipe
8e7565cbe9 Merge pull request #10313 from snipe/snyk-fix-d1fb08ebb2899913c99652bb6e188696
[Snyk] Security upgrade bootstrap-table from 1.18.3 to 1.19.1
2021-11-15 14:28:37 -08:00
snyk-bot
4839b0e008 fix: package.json & package-lock.json to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-BOOTSTRAPTABLE-1657597
2021-11-13 05:19:33 +00:00
Andrew Shulgin
d3ddafdff4 Dockerfile: symlink for ldap_client_tls.{cert,key} 2021-11-13 03:00:09 +02:00
Ivan Nieto Vivanco
b07db3b324 Added the current_value string to correspondig 'en' language directory 2021-11-11 14:43:47 -06:00
snipe
9ed1442bd1 Merge pull request #10286 from uberbrady/fix_bulk_audit_xss
Escape asset_tag attribute at controller level for bulk checkout
2021-11-08 20:32:02 -08:00
Brady Wetherington
3ea209a507 Escape asset_tag attribute at controller level for consumption in bulk checkout 2021-11-08 20:27:43 -08:00
snipe
edf98cb795 Merge pull request #10279 from snipe/fixes/turn_get_into_post_for_custom_field_required
Turn custom fields required/optional/remove into POST requests
2021-11-08 14:37:36 -08:00
snipe
16d18bc7eb Merge pull request #10283 from snipe/fixes/remove_get_logout_route 2021-11-08 12:55:19 -08:00
snipe
38c36af6fc Changes logout to POST
Signed-off-by: snipe <snipe@snipe.net>
2021-11-08 12:53:11 -08:00
snipe
b5855e7be5 Removed get route for logout
Signed-off-by: snipe <snipe@snipe.net>
2021-11-08 12:35:15 -08:00
snipe
0d811d067c Turn cusotm fields required/optional/remove into POST requests
Signed-off-by: snipe <snipe@snipe.net>
2021-11-05 10:53:48 -07:00
snipe
fba0e2b712 Revert tableexport
(It broke the npm run prod build)

Signed-off-by: snipe <snipe@snipe.net>
2021-11-03 16:17:19 -07:00
snipe
608c2f91a8 Updated package lock
Signed-off-by: snipe <snipe@snipe.net>
2021-11-03 16:04:48 -07:00
snipe
960028b376 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-11-03 16:04:39 -07:00
snipe
6690a0f1df Merge pull request #10257 from Wouter0100/patch-1
fix(Docker): use correct python binary for exit listener
2021-11-02 14:53:35 -07:00
Wouter van Os
2c49c32e72 Fixed #10231: use correct python binary for exit listener
This fixes #10231, without creating an own Dockerfile.
2021-11-02 13:06:36 +01:00
snipe
76cc46c419 Merge pull request #9814 from 01ste02/importMinAmt
Improved Consumable Import: Import min_amt for consumables
2021-10-28 17:49:44 -07:00
snipe
dc71f6ddc6 Merge pull request #9871 from jethron/patch-1
Fixed: double slashes in branding logo URL path
2021-10-28 17:36:43 -07:00
snipe
7470fdb605 Merge pull request #9912 from snipe/snyk-upgrade-1377cc2d38a76585c814757398543f5f
[Snyk] Upgrade tableexport.jquery.plugin from 1.10.21 to 1.10.26
2021-10-28 17:15:10 -07:00
snipe
930e220cf1 Merge pull request #9915 from snipe/snyk-upgrade-b2b26cf8ec7a697fe0094f699652a345
[Snyk] Upgrade bootstrap-table from 1.18.2 to 1.18.3
2021-10-28 17:12:47 -07:00
snipe
2f9e5f79af Merge pull request #10139 from FliegenKLATSCH/patch-1
API: Do not include deleted items per default on lookup by serial
2021-10-28 17:09:20 -07:00
snipe
927fba179d Merge pull request #10241 from snipe/snyk-fix-a23047e623395f58c0f4d50feb55a3a3
[Snyk] Security upgrade jquery-ui from 1.12.1 to 1.13.0
2021-10-28 16:35:32 -07:00
snyk-bot
dfde50732b fix: package.json & package-lock.json to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-JQUERYUI-1767167
- https://snyk.io/vuln/SNYK-JS-JQUERYUI-1767175
- https://snyk.io/vuln/SNYK-JS-JQUERYUI-1767767
2021-10-28 07:28:38 +00:00
snipe
7455318fcf Merge pull request #10225 from snipe/fixes/default_label_in_status_label_api
Set default_label to 0 instead of null in API
2021-10-25 20:18:37 -07:00
snipe
17bf899a17 Set default_label to 0 instead of null in API
Signed-off-by: snipe <snipe@snipe.net>
2021-10-25 20:14:01 -07:00
snipe
a5230319b8 Merge pull request #10223 from snipe/fixes/fixed_missing_clone_button
Fixed #10222 - fixed permissions array to handle missing clone button
2021-10-25 15:39:28 -07:00
snipe
8b1c60a17a Make gates a little more consistent
Signed-off-by: snipe <snipe@snipe.net>
2021-10-25 15:34:22 -07:00
snipe
033c3253bb Fixed permissions array to handle missing clone button
Signed-off-by: snipe <snipe@snipe.net>
2021-10-25 14:10:17 -07:00
snipe
a88f622ec3 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-10-18 16:45:51 -07:00
snipe
f87ffb84d5 Merge pull request #10201 from snipe/fixes/xss_on_export
Fixes possible XSS on all-file-types export
2021-10-15 09:54:52 -07:00
snipe
bda23bb1e6 Fixes possible XSS on all-file-types export
Signed-off-by: snipe <snipe@snipe.net>
2021-10-15 11:50:52 -05:00
FliegenKLATSCH
24c484303e Do not include deleted assets by default when doing lookup by serial
This commit introduces a new query parameter `deleted`, which can be set to `true` to include deleted assets in the response.
2021-10-09 08:56:31 +02:00
snipe
5d94b99035 Switched to 5 in one minute
Signed-off-by: snipe <snipe@snipe.net>
2021-10-08 15:53:32 -07:00
snipe
c4856c8aed Merge pull request #10180 from snipe/fixes/add_rate_limiting_to_forgotten_password
Throttle password reset requests to 5 every 60 seconds
2021-10-08 15:44:43 -07:00
snipe
0674ef5a3d Fixed number to 1 (for minutes)
Signed-off-by: snipe <snipe@snipe.net>
2021-10-08 15:43:32 -07:00
snipe
702791210e Throttle password reset requests to 5 every 60 seconds
Signed-off-by: snipe <snipe@snipe.net>
2021-10-08 14:26:30 -07:00
snipe
1c77fd0d09 Merge pull request #10178 from inietov/bug/sc-17520/symfony_component_debug_exception_fatalthrowableerror
Fixed typo when setting the headers
2021-10-08 12:04:45 -07:00
Ivan Nieto Vivanco
d184da8611 Fixed typo (thanks @ssddanbrown) 2021-10-08 13:39:49 -05:00
snipe
ac76364140 Merge pull request #10172 from snipe/fixes/S3_upload_preview
Fixed models preview - Use Storage:: facade
2021-10-06 13:14:02 -07:00
snipe
7848a3c3dc Use Storage:: facade for image preview for models
Signed-off-by: snipe <snipe@snipe.net>
2021-10-06 13:12:42 -07:00
snipe
f41ec640fe Added Huntr.dev badge
Signed-off-by: snipe <snipe@snipe.net>
2021-10-06 12:49:30 -07:00
snipe
fc5efd857f Merge pull request #10171 from snipe/fixes/xss_svg_in_file_uploads
Fixed SVG XSS vuln
2021-10-06 12:38:51 -07:00
snipe
ccd430ce07 Switched back down to debug level
Signed-off-by: snipe <snipe@snipe.net>
2021-10-06 12:38:21 -07:00
snipe
f306401e7e Fixed SVG XSS vuln
Signed-off-by: snipe <snipe@snipe.net>
2021-10-06 12:26:45 -07:00
snipe
c06a93ef13 Removed extra brace in assets for components
Signed-off-by: snipe <snipe@snipe.net>
2021-10-06 10:38:13 -07:00
snipe
17d4e25e60 Merge pull request #10167 from inietov/bug/sc-17520/symfony_component_debug_exception_fatalthrowableerror
Set headers in a different manner in the middleware [sc-17520]
2021-10-05 14:06:39 -07:00
Ivan Nieto Vivanco
ef6eea67d8 Set headers in a different manner in the middleware 2021-10-05 14:09:35 -05:00
snipe
84c73aae5d Merge pull request #10165 from snipe/fixes/set_restore_actions_to_POST_requests
Set restore actions to POST requests instead of GET
2021-10-04 20:40:33 -07:00
snipe
dc3af7cc74 Resolved conflicts
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 20:39:24 -07:00
snipe
34eab88b7e Removed debugging
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 20:25:31 -07:00
snipe
903609b5a5 Updated languages
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 19:59:55 -07:00
snipe
e491a93892 Removed restore link
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 19:56:56 -07:00
snipe
b20c841a89 Fixed asset models restore
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 19:29:13 -07:00
snipe
8fe59f8383 Switch users restore over to POST
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 19:22:38 -07:00
snipe
8bf09d9f89 Make form-based restore button on asset view
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 19:01:16 -07:00
snipe
3594ec9905 Handle bulk check and uncheck
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 17:58:16 -07:00
snipe
52caee2a9f Handle checking and unchecking for bulk actions
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 17:18:26 -07:00
snipe
52ea172e5d Fix ID array
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 17:18:07 -07:00
snipe
caad5be957 Updated routes to use POST for restore
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 17:17:36 -07:00
snipe
fa1cf3073b Add @alwism as a contributor 2021-10-04 15:04:58 -07:00
snipe
71badee78a Add @Robert-Azelis as a contributor 2021-10-04 15:04:47 -07:00
snipe
cb0d1add8d Add @01ste02 as a contributor 2021-10-04 15:04:22 -07:00
snipe
1b0d11a572 Add @jethron as a contributor 2021-10-04 15:03:50 -07:00
snipe
9e522b6a4d Add @Computroniks as a contributor 2021-10-04 15:03:35 -07:00
snipe
a773e70936 Add @Toreg87 as a contributor 2021-10-04 15:03:23 -07:00
snipe
92a38f2a23 Add @jerm as a contributor 2021-10-04 15:03:05 -07:00
snipe
542f774c68 Add @FliegenKLATSCH as a contributor 2021-10-04 15:02:56 -07:00
snipe
67e106c7fa Add @AL4AL as a contributor 2021-10-04 15:02:51 -07:00
snipe
536b5717f0 Merge pull request #10164 from snipe/fixes/require_revalidation_on_logout_back_button
Force revalidation headers when user logs out
2021-10-04 12:56:03 -07:00
snipe
9b48732cd2 Force revalidation headers when user logs out
Signed-off-by: snipe <snipe@snipe.net>
2021-10-04 12:52:48 -07:00
snipe
244616b31e Merge pull request #10157 from snipe/jerm/fix-cachedir-ownership
[Docker] Fix ownership of cache directory in startup script
2021-10-01 17:50:36 -07:00
Jeremy Price
22313711d5 Fix ownership of cache directory
Snipe-IT was waiting to load because
/var/www/html/storage/framework/cache/ and its contet were owned by
root:root, but docker needed to be able to write to them

This change recursively chowns that path to docker:root, and now it
loads.
2021-10-01 16:54:17 -07:00
snipe
89e650f842 Fixed typo
Signed-off-by: snipe <snipe@snipe.net>
2021-09-30 16:01:56 -07:00
snipe
daa88f06f7 Added pivot to components JSON
Signed-off-by: snipe <snipe@snipe.net>
2021-09-30 15:51:08 -07:00
snipe
d0acb9fdb4 Applies PR #10150 to master
Signed-off-by: snipe <snipe@snipe.net>
2021-09-30 15:33:00 -07:00
snipe
8e437a66af Merge branch 'master' of https://github.com/snipe/snipe-it 2021-09-28 20:03:35 -07:00
snipe
f232579e2b Added Discord badge
Signed-off-by: snipe <snipe@snipe.net>
2021-09-28 20:02:46 -07:00
snipe
7b7583fde3 Merge pull request #10141 from uberbrady/fix_currency_problems
Fixed #9789 and Fixed #10088 and Fixed [fd23442] - Fix currency problems especially with European currency format
2021-09-28 19:37:25 -07:00
Brady Wetherington
ae466be153 Fix license output, tweak CleanFloat function to handle numbers over 1 million 2021-09-28 19:10:25 -07:00
Brady Wetherington
f3338667c7 Create new ParseCurrency helper and use it in the appropriate controllers 2021-09-28 18:20:39 -07:00
Brady Wetherington
f380da3f19 Try to ensure all currency output is formatted correctly. 2021-09-28 16:45:47 -07:00
snipe
919eaf320c Updated javascript assets
Signed-off-by: snipe <snipe@snipe.net>
2021-09-23 19:00:53 -07:00
snipe
c9337a1947 Merge branch 'master' of https://github.com/snipe/snipe-it 2021-09-23 18:59:25 -07:00
snipe
d069d032fc Updated JS asset
Signed-off-by: snipe <snipe@snipe.net>
2021-09-23 18:59:13 -07:00
snipe
d37dedb654 Merge pull request #10123 from takuy/patch-1
Fixed #9928: update expected field name for response list
2021-09-23 18:57:02 -07:00
snipe
fedf51dda4 Fixed typo
Signed-off-by: snipe <snipe@snipe.net>
2021-09-23 18:29:47 -07:00
snipe
53334f7905 Merge pull request #10124 from snipe/features/added_components_to_assets_API
Added assigned components to assets API
2021-09-23 18:26:57 -07:00
snipe
2f9582ee5c Switched to loadMissing for performance
Signed-off-by: snipe <snipe@snipe.net>
2021-09-23 17:31:19 -07:00
snipe
3b7ce0091c Load components in the assets API if components=true in API request
Signed-off-by: snipe <snipe@snipe.net>
2021-09-23 17:23:53 -07:00
snipe
6e270c0ed2 Include created_at in pivot
Signed-off-by: snipe <snipe@snipe.net>
2021-09-23 17:23:17 -07:00
Sam
d0f284129a Update expected field for response list
The existing code to handle the "enter key" / auto selections broke at some point. It was expecting results to be in an "items" list, not a "results" list. This should close #9928 hopefully. Tested locally.
2021-09-23 20:12:45 -04:00
snipe
6aa7e9cbfa Merge branch 'master' of https://github.com/snipe/snipe-it 2021-09-23 14:32:48 -07:00
snipe
3862b6476b Merge pull request #10122 from inietov/fixes/api_issue_when_component_checkout
Fixes API Issue when checking out a component
2021-09-23 13:21:48 -07:00
Ivan Nieto Vivanco
7dfab3a6e2 Change the condition to 'bigger or equal' instead of just 'bigger than' in ComponentsController checkout api 2021-09-23 15:02:39 -05:00
snipe
0f40ba2b34 Check for admin rights before displaying admin permission options
Signed-off-by: snipe <snipe@snipe.net>
2021-09-22 19:31:49 -07:00
snipe
39a702397a Add user permissions message if the user is not an admin or better
Signed-off-by: snipe <snipe@snipe.net>
2021-09-22 19:05:02 -07:00
snipe
a6b3aa5f04 Don't try to delete the file if there is no log entry
Signed-off-by: snipe <snipe@snipe.net>
2021-09-22 19:04:25 -07:00
snipe
3821c4d372 Merge remote-tracking branch 'origin/develop' 2021-09-21 21:53:40 -07:00
snipe
104d66b4b1 Merge pull request #10115 from snipe/features/added_footer_to_depreciation_report_totals
Added totals to depreciation report footer
2021-09-21 21:53:17 -07:00
snipe
b4a90045e6 Added totals to depreciation report footer
Signed-off-by: snipe <snipe@snipe.net>
2021-09-21 21:52:18 -07:00
snipe
3b9b63a7a8 Merge remote-tracking branch 'origin/develop' 2021-09-21 21:29:11 -07:00
snipe
9b78b25372 Grr. 100 should be 1000
Signed-off-by: snipe <snipe@snipe.net>
2021-09-21 21:28:59 -07:00
snipe
0411f63591 Merge remote-tracking branch 'origin/develop' 2021-09-21 21:25:39 -07:00
snipe
7df4f98e19 Bump number per page up to 1000
Use this shit at your own peril. Very large pages will load slowly, as these are very complex queries.

Signed-off-by: snipe <snipe@snipe.net>
2021-09-21 21:25:22 -07:00
snipe
86a4f2d3ec Merge remote-tracking branch 'origin/develop' 2021-09-21 20:54:37 -07:00
snipe
0763c76a4e Fixed scoping with leftjoin
Signed-off-by: snipe <snipe@snipe.net>
2021-09-21 20:54:24 -07:00
snipe
3af7c66de7 Merge remote-tracking branch 'origin/develop' 2021-09-21 20:11:08 -07:00
snipe
0be4b21721 Merge pull request #10114 from snipe/fixes/sorting_in_non_assets
Fixes sorting on non-asset relations in API
2021-09-21 20:09:43 -07:00
snipe
5d32c17a2e Removed comments
Signed-off-by: snipe <snipe@snipe.net>
2021-09-21 20:01:36 -07:00
snipe
10ca7cffc3 Fixes for query scoping, ordering, and nicer readability
Signed-off-by: snipe <snipe@snipe.net>
2021-09-21 19:59:23 -07:00
snipe
05faffbd28 Merge remote-tracking branch 'origin/develop' 2021-09-21 17:50:35 -07:00
snipe
dacdf788bc Reverted erroneous german text in UK language files 2021-09-21 17:50:13 -07:00
snipe
d54057e495 Merge remote-tracking branch 'origin/develop' 2021-09-21 15:55:04 -07:00
snipe
a22c35140b Merge pull request #10112 from snipe/fixes/strtolower_for_category_type
Improved category_type with strtolower() to make it case insensitive
2021-09-21 15:54:35 -07:00
snipe
61176335d7 Improved category_type with strtolower() to make it case insensitive
Signed-off-by: snipe <snipe@snipe.net>
2021-09-21 15:51:41 -07:00
snipe
11c8b1259e Merge remote-tracking branch 'origin/develop' 2021-09-20 18:49:17 -07:00
snipe
9b52c61d95 Updated banner with better warning
Signed-off-by: snipe <snipe@snipe.net>
2021-09-20 18:49:04 -07:00
snipe
2dfb965885 Merge pull request #10104 from snipe/fixes/revamp_pave_command_to_persist_api_keys
Fixes pave command to persist api keys and first few test users
2021-09-20 18:48:11 -07:00
snipe
36464bc17d Fix confirmation, because apparently you can't pass that along via cli vs interactively
Signed-off-by: snipe <snipe@snipe.net>
2021-09-20 18:22:06 -07:00
snipe
f35208d58d Clean up, find custom fields and drop those columns
Signed-off-by: snipe <snipe@snipe.net>
2021-09-20 18:03:13 -07:00
snipe
4d30edd535 Let's make sure to keep some of the stuff we need on the demo as well
Signed-off-by: snipe <snipe@snipe.net>
2021-09-20 17:29:32 -07:00
snipe
957f33c8cf First stab at a better pave command
Signed-off-by: snipe <snipe@snipe.net>
2021-09-20 17:19:41 -07:00
snipe
7c8c567eaf Merge remote-tracking branch 'origin/develop' 2021-09-20 15:12:53 -07:00
snipe
6772ace94e Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-09-20 15:10:54 -07:00
snipe
ee28f3e853 Merge branch 'snyk-fix-bb1a61f0d07295579c411381da690d4c' of https://github.com/snipe/snipe-it into develop 2021-09-20 15:10:31 -07:00
snipe
81f1f4ce6f Add @vapier as a contributor 2021-09-20 15:07:37 -07:00
snipe
3b79038879 Merge pull request #10082 from vapier/develop
add rewrite rule for Let's Encrypt certificates
2021-09-20 14:57:14 -07:00
snipe
7e611fa699 Merge remote-tracking branch 'origin/develop' 2021-09-15 13:55:12 -07:00
snipe
e8ad5dc273 Merge pull request #10086 from snipe/fixes_depreciation_report
Fixed extraneous asset search in depreciation report
2021-09-15 13:54:32 -07:00
snipe
8a93e1e796 Remove asset call on depreciation report controller method
We ajax this in now, so no need for it

Signed-off-by: snipe <snipe@snipe.net>
2021-09-15 13:49:53 -07:00
snipe
3d7000f759 Merge remote-tracking branch 'origin/develop' 2021-09-15 11:33:30 -07:00
snipe
d96f877aa4 Default show_in_nav to 0
Signed-off-by: snipe <snipe@snipe.net>
2021-09-15 11:33:13 -07:00
Mike Frysinger
7b665ade0a add rewrite rule for Let's Encrypt certificates
The LE tools need access to a stable path to automatically obtain
certificates, so add a rewrite rule to allow it.
2021-09-14 16:21:31 -04:00
snipe
02705d0d1a Fixed S3 upload path
Signed-off-by: snipe <snipe@snipe.net>
2021-09-14 12:49:17 -07:00
snipe
772a06c87a Merge remote-tracking branch 'origin/develop' 2021-09-13 17:13:20 -07:00
snipe
0d633ce618 Fixed issue where created_at date was not showing on uploads
Signed-off-by: snipe <snipe@snipe.net>
2021-09-13 17:13:01 -07:00
snipe
cedf77b5ed Merge remote-tracking branch 'origin/develop' 2021-09-13 15:47:25 -07:00
snipe
c6b26965a0 Check for valid category name
Signed-off-by: snipe <snipe@snipe.net>
2021-09-13 15:47:13 -07:00
snipe
4b303adda7 Merge pull request #10080 from uberbrady/upgrade_docker_php74
Upgrade Docker to PHP 7.4
2021-09-13 15:30:32 -07:00
Brady Wetherington
37fe4e91b1 Upgrade Docker to PHP 7.4 2021-09-13 15:24:30 -07:00
snipe
179f26ca2e Merge pull request #10079 from inietov/fixes/archived_assets_showing_in_locations
Awesome, thanks!
2021-09-13 14:46:44 -07:00
Ivan Nieto Vivanco
1ae665b645 Use the property 'archived' so if the 'name' one changes it doesn't fails 2021-09-13 16:45:05 -05:00
Ivan Nieto Vivanco
1b433920f1 Delete an extra semicolon 2021-09-13 16:24:12 -05:00
Ivan Nieto Vivanco
2b64af0d34 Add a condition in the view 'print all assigned' from locations where it skips the assets in relation of if they're archived and that option is marked in the settings 2021-09-13 16:17:34 -05:00
snipe
7f31befe5d Merge remote-tracking branch 'origin/develop' 2021-09-10 20:46:15 -07:00
snipe
a5409215fc Merge pull request #10070 from snipe/fixes/update_status_label_color_via_api
Fixed #9969 - added color, show_in_nav, and default_label to status l…
2021-09-10 20:45:47 -07:00
snipe
80175cffdc Fixed #9969 - added color, show_in_nav, and default_label to status labels API
Signed-off-by: snipe <snipe@snipe.net>
2021-09-10 20:44:49 -07:00
snipe
f8f969919e Merge remote-tracking branch 'origin/develop' 2021-09-10 20:26:37 -07:00
snipe
fb68c49c44 Merge pull request #10069 from snipe/fixes/add_use_default_eula_to_category_endpoint
Fixed #9973 - add use_default_eula to category endpoint
2021-09-10 20:25:56 -07:00
snipe
514f9aa64a Fixed #9973 - add use_default_eula to categories API endpoint
Signed-off-by: snipe <snipe@snipe.net>
2021-09-10 20:23:49 -07:00
snipe
0d633688a4 Merge pull request #10063 from jasonspriggs/develop
This looks good to me, thanks! I'm not as familiar with Heroku these days (it's been years and years since I've used it), but it seems okay?
2021-09-10 18:22:12 -07:00
Jason Spriggs
949454c6d4 Minor modifications to documentation for app.json 2021-09-09 16:55:26 -04:00
Jason Spriggs
d100a5de72 Add Papertrail logging addon 2021-09-08 21:11:46 -04:00
Jason Spriggs
acefb3d1b9 Add descriptions for some env vars 2021-09-08 20:51:43 -04:00
snipe
38a544ea42 Updated version branch to master
Signed-off-by: snipe <snipe@snipe.net>
2021-09-08 13:50:52 -07:00
snipe
a4e307c4db Updated languages
Signed-off-by: snipe <snipe@snipe.net>
2021-09-08 13:49:33 -07:00
snipe
116bc4ece4 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-09-08 13:42:48 -07:00
snipe
14a8baecaa Merge pull request #10059 from inietov/fixes/CSV_imports_checkout_to_location
Convert value of column 'checkout type' in CSV file to lowercase
2021-09-08 13:31:49 -07:00
Ivan Nieto Vivanco
f1b8b7d11d Convert whatever value we get in column 'checkout type' to all lowercase 2021-09-08 12:49:29 -05:00
snipe
c6b3fc219c Merge pull request #10023 from snipe/snyk-fix-deed9a63fc3bf8e6472c4aabe8c95f02
[Snyk] Security upgrade alpine from 3.13 to 3
2021-09-07 19:56:10 -07:00
snipe
cfaa6679af Merge pull request #10031 from inietov/fixes/checkout_date_not_saved_in_asset_history
Fixed #10026: Checkout date not saved in asset history
2021-09-07 17:37:30 -07:00
snipe
bb5a04491d Merge pull request #10053 from inietov/fixes/accepted_assets_still_showing_unaccepted_report
Fix Accepted Assets still showing on Unaccepted Asset Report
2021-09-07 12:15:17 -07:00
snipe
f9c0eee7c9 Merge pull request #10048 from inietov/fixes/blank_results_for_non_superadmins
Fix to PR #10009.  The asset search now works as intended for normal users
2021-09-07 12:14:29 -07:00
Ivan Nieto Vivanco
27ff0be9a8 Delete checkout acceptances when an asset is checked in without response 2021-09-07 12:01:32 -05:00
Ivan Nieto Vivanco
b5525e6a21 Deleted additional bindings present also in the User model 2021-09-07 00:57:12 -05:00
Ivan Nieto Vivanco
c3eb7a3425 Remove aditional bindings that 'overflows' the generated queries 2021-09-07 00:15:21 -05:00
Jason Spriggs
48374f0854 Add PUBLIC_FILESYSTEM_DISK 2021-09-05 12:21:46 -04:00
Jason Spriggs
bae3c9ce93 Add Deploy to Heroku button to README 2021-09-05 10:34:48 -04:00
Jason Spriggs
b51392e4a5 Add base heroku changes 2021-09-05 10:33:13 -04:00
snipe
6bd18ebefa Merge pull request #10043 from benwa/master
Use the new Issues form
2021-09-02 16:15:45 -07:00
Bennett Blodinger
034eb5fb07 no markdown? 2021-09-02 17:48:38 -05:00
Bennett Blodinger
563edddfc5 add a feature request 2021-09-02 17:47:32 -05:00
Bennett Blodinger
391d4f839a formatting 2021-09-02 17:43:24 -05:00
Bennett Blodinger
51a359496a unique IDs 2021-09-02 17:37:47 -05:00
Bennett Blodinger
43b7c844b0 multiline 2021-09-02 17:32:31 -05:00
Bennett Blodinger
a1674f8d58 Create config.yml 2021-09-02 17:29:36 -05:00
Bennett Blodinger
a8a6950b7e Delete Feature_request.md 2021-09-02 17:28:01 -05:00
Bennett Blodinger
4598fcf666 Delete Bug_report.md 2021-09-02 17:27:46 -05:00
Bennett Blodinger
37eac18c69 Create bug_report.yml
Using the (currently in beta) https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
2021-09-02 17:27:27 -05:00
Bennett Blodinger
ca3296b65a Update issue templates 2021-09-02 16:58:18 -05:00
snipe
a79f49ade3 Merge pull request #10034 from snipe/features/ajaxify_depreciation
Fixed [ch15359] ajaxify the depreciation report
2021-09-01 18:26:10 -07:00
snipe
a26c227dcb Merge pull request #10018 from jjasghar/patch-1
Fixed typo: Update README.md
2021-09-01 17:50:15 -07:00
snipe
94310e18b1 Presenters and Transformers for Depreciation report
Signed-off-by: snipe <snipe@snipe.net>
2021-09-01 17:33:59 -07:00
snipe
2f25eb598b Allow the Assets API controller to handle depreciation reports
Signed-off-by: snipe <snipe@snipe.net>
2021-09-01 17:33:39 -07:00
snipe
387018c44e Updated depreciation report blade to use server-side API
Signed-off-by: snipe <snipe@snipe.net>
2021-09-01 17:05:31 -07:00
snipe
67357e07f1 Added API route for depreciations report
RED FLAG: This will need to be updated for v6!!!!

Signed-off-by: snipe <snipe@snipe.net>
2021-09-01 17:05:00 -07:00
Ivan Nieto Vivanco
e621eaf456 Change date showed in the activity report view, the condition is now on action_date 2021-09-01 13:58:17 -05:00
Ivan Nieto Vivanco
ea1d7a42e2 Add condition to check if action_date have value and if it have assign it to created_at parameter 2021-09-01 13:08:08 -05:00
snipe
d5a7955e1d Fixed #10024 - use string for dashboard in side nav instead of hard coded
Signed-off-by: snipe <snipe@snipe.net>
2021-08-31 22:25:00 -07:00
snyk-bot
e33ab269ae fix: Dockerfile.alpine to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-ALPINE313-APKTOOLS-1533754
- https://snyk.io/vuln/SNYK-ALPINE313-OPENSSL-1569446
- https://snyk.io/vuln/SNYK-ALPINE313-OPENSSL-1569446
- https://snyk.io/vuln/SNYK-ALPINE313-OPENSSL-1569448
- https://snyk.io/vuln/SNYK-ALPINE313-OPENSSL-1569448
2021-09-01 01:06:18 +00:00
snipe
4293674f4a Added a few more fields to the users API
Signed-off-by: snipe <snipe@snipe.net>
2021-08-31 12:36:06 -07:00
snipe
aeae681326 Fixecd copypasta from state to zip
Signed-off-by: snipe <snipe@snipe.net>
2021-08-31 12:28:20 -07:00
snipe
4794f93224 Added additional fields for user search
Signed-off-by: snipe <snipe@snipe.net>
2021-08-31 12:24:53 -07:00
snipe
f58ed6bd1f Merge pull request #9982 from Shankschn/master
Fixes: When using API CheckIn assets, there will be two CheckIn records in the Activity Report log for each asset.
2021-08-31 11:08:52 -07:00
snipe
96c0dba92b Merge pull request #10011 from inietov/fixes/quotations_turn_into_html_entity
Fixes Quotations turn into HTML entity
2021-08-31 11:00:38 -07:00
JJ Asghar
07a2ef2234 Update README.md
Typo.
2021-08-31 11:11:19 -05:00
Ivan Nieto Vivanco
d917ae51b7 Remove e() function from other input fields 2021-08-31 04:01:20 -05:00
Ivan Nieto Vivanco
e7470b5545 Remove e() function from the saved notes when updating an asset maintenance 2021-08-31 03:50:57 -05:00
snipe
7e2def7896 Merge pull request #9880 from inietov/bug/fd18463/cannot_edit_departments
Fixes: Can't update departments if Full Company Support is activated
2021-08-30 19:40:59 -07:00
snipe
a02534b6c8 Merge pull request #10009 from inietov/fixes/blank_results_for_non_superadmins
Fixes #9985. Error 500 when using the asset search - blank results for non super-admins
2021-08-30 13:29:18 -07:00
snipe
5c92ddb2c6 Fixed version back to develop from master downmerge
Signed-off-by: snipe <snipe@snipe.net>
2021-08-30 12:57:06 -07:00
snipe
6d3a82aacf Merge pull request #10008 from uberbrady/fix_unlink_error_ldap
Fixed rb445 and rb446 - the unlink calls for the client-side certs...
2021-08-30 12:47:38 -07:00
Brady Wetherington
da0b375773 Fixed rb445 and rb446 - the unlink calls for the client-side certs
need to be wrapped around a file-existence check
2021-08-30 12:29:16 -07:00
Ivan Nieto Vivanco
d1304cc975 Add sentence to infer the table's name according to the query passed 2021-08-30 13:44:26 -05:00
snipe
085be16966 Merge remote-tracking branch 'origin/develop' 2021-08-25 14:45:41 -07:00
snipe
127a3e41bd Merge pull request #9993 from inietov/fixes/exception_when_checkin_licenses_from_assets
Fixes Exception when Checkin Licenses from Assets
2021-08-25 14:45:14 -07:00
Ivan Nieto Vivanco
4a79c77630 Add a condition to checkin licenses assigned to Assets 2021-08-25 16:38:34 -05:00
snipe
e21b21fbde Merge pull request #9990 from inietov/fixes/cannot_upload_files_to_assets
Fixed #9440 Change condition to return the actual max upload size allowed to files
2021-08-25 13:39:23 -07:00
Ivan Nieto Vivanco
137f55e4ce Change condition to return the actual max upload size allowed to files 2021-08-25 15:27:25 -05:00
snipe
4abb9baa95 Merge remote-tracking branch 'origin/develop' 2021-08-24 15:29:41 -07:00
snipe
36ddc7dea7 Merge pull request #9980 from inietov/fixes/display_custom_field_not_holding_value
Fixes:  Display custom field not holding value
2021-08-24 15:12:15 -07:00
snipe
80b411c94b Merge pull request #9986 from uberbrady/fix_client_side_ldap_cert_settings
Make the LDAP Client-side certificate fields Nullable
2021-08-24 15:10:49 -07:00
Brady Wetherington
ae65e2a0a0 Adding explicit default(null), and removing the nullable() attribute on the down() migration 2021-08-24 14:15:55 -07:00
Brady Wetherington
2d578a9864 Make the LDAP Client-side certificate fields Nullable 2021-08-24 12:52:03 -07:00
Shanks
961e80404a Update AssetsController.php
Fix:When using API CheckIn assets, there will be two CheckIn records in the Activity Report log for each asset.
2021-08-24 16:39:58 +08:00
Ivan Nieto Vivanco
830ba470dd Change the used function to only affect single and double quotes 2021-08-23 22:10:59 -05:00
Ivan Nieto Vivanco
80fb24e861 Fix issue caused for single and double quotes when used as listbox's values 2021-08-23 22:00:01 -05:00
snipe
70f6753f50 Merge pull request #9979 from uberbrady/add_client_side_ldap_certs
Add client side ldap certs
2021-08-23 16:30:46 -07:00
snipe
9285697611 Merge remote-tracking branch 'origin/develop' 2021-08-20 17:30:52 -07:00
snipe
9687bcb41c Fixed issue where consumables model number was not searchable
Signed-off-by: snipe <snipe@snipe.net>
2021-08-20 17:30:35 -07:00
snipe
4ec4e0f44e Merge remote-tracking branch 'origin/develop' 2021-08-19 12:09:48 -07:00
snipe
ff8faab3be Merge pull request #9960 from uberbrady/fix_null_sum_totals
Fix regression for NULL valued numbers in the summary calculation
2021-08-19 12:08:33 -07:00
Brady Wetherington
e28db2d221 Fix regression for NULL valued numbers in the summary calculation 2021-08-19 12:01:47 -07:00
snipe
24af2ab67a Merge remote-tracking branch 'origin/develop' 2021-08-18 14:31:53 -07:00
snipe
7b447a2f16 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-08-18 14:31:38 -07:00
snipe
f5112b47cd Merge pull request #9953 from uberbrady/fix_bootstrap_sum_formatter
Fixed ch17133 - Fixed sum total calculation on Bootstrap Table pages -
2021-08-18 14:31:10 -07:00
Brady Wetherington
4519f6e180 Fixed sum total calculation on Bootstrap Table pages 2021-08-18 14:13:31 -07:00
snipe
6f7718dd0e Merge pull request #9950 from inietov/fixes/ch945/status_colors_are_not_displaying_correctly
Looks great, thanks!
2021-08-18 14:09:26 -07:00
Ivan Nieto Vivanco
f04e23cacb Add a small refactor so we not repeat logic 2021-08-18 15:22:53 -05:00
Brady Wetherington
1b66f7f719 Add new client-side LDAP SSL certs to .gitignore 2021-08-18 13:22:36 -07:00
Ivan Nieto Vivanco
4207858a14 Fix the count in StatuslabelsController@getAssetsCountByStatuslabel() function that allows it to pass the correct index
Also edit the default color for assets with the Pending label, so it match the color in the docs
2021-08-18 14:08:35 -05:00
snipe
b88fde5dae Nicer comment formatting
Signed-off-by: snipe <snipe@snipe.net>
2021-08-18 12:07:09 -07:00
snipe
04fa5f2022 Merge remote-tracking branch 'origin/develop' 2021-08-18 01:05:25 -07:00
snipe
923d2a79ae Fixed weird layout on bulk audit [ch17146]
Signed-off-by: snipe <snipe@snipe.net>
2021-08-18 01:05:09 -07:00
snipe
c970464690 Updated production assets
Signed-off-by: snipe <snipe@snipe.net>
2021-08-18 00:48:05 -07:00
snipe
f99602c039 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
#	public/css/build/app.css
#	public/css/build/overrides.css
#	public/css/dist/all.css
#	public/js/build/app.js
#	public/js/dist/all.js
#	public/mix-manifest.json
2021-08-18 00:47:33 -07:00
snipe
0aa328f908 Updated hash
Signed-off-by: snipe <snipe@snipe.net>
2021-08-18 00:45:35 -07:00
snipe
f8562e5835 Recompiled assets
Signed-off-by: snipe <snipe@snipe.net>
2021-08-18 00:45:02 -07:00
snipe
8a6c7269d3 Fixed border radius for bulk checkout field [ch16936]
Signed-off-by: snipe <snipe@snipe.net>
2021-08-18 00:44:55 -07:00
snipe
37f2c7beac Nicer bulk asset select width
Signed-off-by: snipe <snipe@snipe.net>
2021-08-18 00:44:16 -07:00
snipe
b5bb74b8ca Merge remote-tracking branch 'origin/develop' 2021-08-17 22:01:23 -07:00
snipe
b5e69d6678 Merge pull request #9947 from snipe/fixes/apply_v6_currency_formatter
Fixed #9909  and #9714 - applies v6 currency formatter to v5 [ch16628]
2021-08-17 22:00:39 -07:00
snipe
cce808c784 Fixed #9909 and #9714 - applies v6 currency formatter to v5 [ch16628]
Duplicates d4e46ee41f but on v5

Signed-off-by: snipe <snipe@snipe.net>
2021-08-17 21:59:33 -07:00
Brady Wetherington
4d4badf830 Got the client-side LDAP setup working well enough for sync! 2021-08-17 14:43:36 -07:00
snipe
d70e4e04c0 Merge pull request #9933 from JemCdo/patch-1
Fixed #9934: Typo on creating Depreciation
2021-08-16 07:44:56 -07:00
James Emanuel
98285001ac Fixing Typo on creating Depreciation 2021-08-16 15:33:17 +03:00
snipe
29c584289f Merge remote-tracking branch 'origin/develop' 2021-08-14 14:09:31 -07:00
snipe
dc79ca94a2 Merge pull request #9931 from snipe/features/add_asset_restore_to_api
Features/add asset restore to api
2021-08-14 14:08:36 -07:00
snipe
ef687fdc7b Fixed typo
Signed-off-by: snipe <snipe@snipe.net>
2021-08-14 14:07:04 -07:00
snipe
45caa8a90d Added restore functionalty to asset API
Signed-off-by: snipe <snipe@snipe.net>
2021-08-14 14:06:15 -07:00
snipe
b1e2f86871 Merge pull request #9919 from ItsGageHolland/patch-1
Update README.md
2021-08-11 12:39:17 -07:00
Godfrey M
01037cf9cb initial commit: adds migration, input area and transformer modifications for depreciation minimum value [ch15358] 2021-08-10 18:26:43 -07:00
Gage K. Holland
63a5c70e8e Update README.md 2021-08-10 09:16:51 +01:00
snyk-bot
3fedcc6766 fix: upgrade bootstrap-table from 1.18.2 to 1.18.3
Snyk has created this PR to upgrade bootstrap-table from 1.18.2 to 1.18.3.

See this package in npm:
https://www.npmjs.com/package/bootstrap-table

See this project in Snyk:
https://app.snyk.io/org/snipe/project/3d53e1dd-b8bf-46b5-ba61-18ce26933166?utm_source=github&utm_medium=upgrade-pr
2021-08-07 21:41:02 +00:00
snyk-bot
892ae9cf91 fix: upgrade tableexport.jquery.plugin from 1.10.21 to 1.10.26
Snyk has created this PR to upgrade tableexport.jquery.plugin from 1.10.21 to 1.10.26.

See this package in npm:
https://www.npmjs.com/package/tableexport.jquery.plugin

See this project in Snyk:
https://app.snyk.io/org/snipe/project/3d53e1dd-b8bf-46b5-ba61-18ce26933166?utm_source=github&utm_medium=upgrade-pr
2021-08-07 21:40:51 +00:00
snyk-bot
9ae6591aa3 fix: Dockerfile.alpine to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-ALPINE313-APKTOOLS-1533754
2021-08-07 21:38:53 +00:00
snipe
cdc4940338 Merge pull request #9881 from inietov/fixes/integrity_constraint_violation__emailing_password_reset
Fixes Integrity constraint violation when emailing password reset.
2021-07-30 16:01:53 -07:00
Ivan Nieto Vivanco
27cdfbc579 Edit the log message 2021-07-29 16:14:52 -05:00
Ivan Nieto Vivanco
405545cd88 Add exception handling in the ForgotPasswordController 2021-07-29 16:02:45 -05:00
Ivan Nieto Vivanco
1b8156ac7f Add a hidden field to handle departments inside Full Company Support config 2021-07-29 13:28:57 -05:00
Jethro Nederhof
d8fdd1b408 Fix branding logo URL path
The current method adds an additional slash to the URL which results in the logo request producing a 404 error on for Storage drivers like S3 and GCS that don't automatically collapse additional forward slashes into single slashes.

E.g. with the current code my logo URL renders like `https://storage.googleapis.com/mybucketname/public//setting-logo-Al0aKMhmYz.svg` (note the double slash after "public") when instead it should render like `https://storage.googleapis.com/mybucketname/public/setting-logo-Al0aKMhmYz.svg`

For a local driver this should work fine since webservers handle the additional slashes case, but for key-based storage this 404s.

Thanks for your work on Snipe-It, seems like a good system so far!
2021-07-28 14:55:34 +10:00
snipe
593e1234a5 Merge pull request #9797 from markbrule/fixes/search_parameter_checkedout_api
Fixed #9671: wrap OR queries in sub-condition in checkedout search
2021-07-27 14:39:10 -07:00
snipe
9a5d9eafeb Merge pull request #9709 from morning-bird/master
add CompanyableTrait
2021-07-27 14:38:21 -07:00
snipe
eca15bd49b Merge pull request #9837 from Godmartinz/chore/ch16531/update-demo-photos-of-iphones-to-be-more
Update demo photos of iPhones to be more [ch16531]
2021-07-27 14:34:52 -07:00
snipe
d2fc98b685 Merge pull request #9861 from inietov/fixes/consumables_accessories_not_correctly_displayed_via_locations
Fixes #9853 Consumables/Accessories not correctly displayed via Locations
2021-07-26 14:49:05 -07:00
Ivan Nieto Vivanco
38a2a0c1ee Add the pertinent filters in Accessories and Consumables controllers 2021-07-26 12:59:15 -05:00
snipe
75d4a46fff Merge pull request #9856 from inietov/bug/ch15413/model_number_is_not_on_accessory_import_dropdown
Fixes: Model Number is not on the Accessory import dropdown of mappable fields [ch15413]
2021-07-24 01:05:26 -07:00
Ivan Nieto Vivanco
0f1c48cb6f Add the field model_number to Accessory importer 2021-07-24 02:38:44 -05:00
Godfrey M
9fb911146f Update demo photos of iPhones to be more [ch16531] 2021-07-19 12:26:04 -07:00
snipe
615bdd0499 Bumped hash
Signed-off-by: snipe <snipe@snipe.net>
2021-07-15 13:29:07 -07:00
snipe
33e92c975a Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/dist/skins/skin-blue-dark.css
#	public/css/dist/skins/skin-blue-dark.min.css
#	public/css/dist/skins/skin-green-dark.css
#	public/css/dist/skins/skin-green-dark.min.css
#	public/css/dist/skins/skin-orange-dark.css
#	public/css/dist/skins/skin-orange-dark.min.css
#	public/css/dist/skins/skin-purple-dark.css
#	public/css/dist/skins/skin-purple-dark.min.css
#	public/css/dist/skins/skin-yellow-dark.css
#	public/css/dist/skins/skin-yellow-dark.min.css
#	public/js/build/app.js
#	public/js/dist/all.js
#	public/mix-manifest.json
2021-07-15 13:29:00 -07:00
snipe
5f842d02ef Fixed namespace
Signed-off-by: snipe <snipe@snipe.net>
2021-07-15 13:24:40 -07:00
snipe
f5ba47fcdd Merge pull request #9829 from Godmartinz/bug/ch16602/make-non-linked-striped-text-the-same-for
Make non linked striped text the same for [ch16602]
2021-07-14 14:54:18 -07:00
Godfrey M
44612e5eb7 Make non linked striped text the same for [ch16602] 2021-07-14 14:50:45 -07:00
snipe
6b7d5ed5a4 Merge remote-tracking branch 'origin/develop' 2021-07-14 11:35:47 -07:00
snipe
5e76d50f2d Merge pull request #9825 from PetriAsi/feature/api-image-uploads
Fixed #9767 : Feature/api image uploads legacy image_source property  support
2021-07-14 10:24:40 -07:00
Petri Asikainen
febf1ec20f Support legacy image_source property 2021-07-14 13:09:50 +03:00
Petri Asikainen
fa8b0964ed Merge branch 'develop' of github.com:snipe/snipe-it into feature/api-image-uploads 2021-07-14 13:06:39 +03:00
snipe
a0798a68d9 Merge pull request #9767 from PetriAsi/feature/api-image-uploads
Added #9594 : Feature api image uploads and remove
2021-07-13 09:36:35 -07:00
Petri Asikainen
7b12668af4 Merge branch 'develop' of github.com:snipe/snipe-it into feature/api-image-uploads 2021-07-13 17:23:44 +03:00
Oskar Stenberg
5b5874499d Added import for min_amt for consumables 2021-07-12 11:46:19 +02:00
snipe
4cfdaf89d8 Merge remote-tracking branch 'origin/develop' 2021-07-08 17:47:08 -07:00
snipe
b307d2858c Merge pull request #9809 from uberbrady/fix_saml_custom_settings
The custom settings section of SAML sometimes has bad linefeeds
2021-07-08 17:16:37 -07:00
Brady Wetherington
0ec2884c29 The custom settings section of SAML sometimes has bad linefeeds 2021-07-08 17:00:01 -07:00
snipe
f264cade7d Merge remote-tracking branch 'origin/develop' 2021-07-08 16:05:32 -07:00
snipe
8ea3acc943 Fixed route ordering (FIFO)
Signed-off-by: snipe <snipe@snipe.net>
2021-07-08 16:05:07 -07:00
snipe
f785c3e759 Default to 1 if no qty is passed
Signed-off-by: snipe <snipe@snipe.net>
2021-07-08 16:04:52 -07:00
snipe
0a2a8932d4 Merge pull request #9808 from inietov/bug/ch15453/selected_maintenance_history_columns_not_remembered
Fixes [ch15453] Maintenance/History columns not remembered.
2021-07-08 12:15:53 -07:00
Ivan Nieto Vivanco
d2e94dfc1c Added cookie option to assets Bootstrap Table to save the state of the table. 2021-07-08 14:05:40 -05:00
Petri Asikainen
4379ea61fa Just mention source of idea as code rewriten 2021-07-08 19:50:33 +03:00
Petri Asikainen
41deabf998 hand legacy image_source field 2021-07-07 09:33:48 +03:00
Petri Asikainen
7a424649c8 convert image_source field
This reverts commit b2d3ba7410.
2021-07-07 09:24:24 +03:00
Petri Asikainen
b2d3ba7410 Revert "Handle image_source with ConvertBase64ToFiles"
This reverts commit 168d7f7004.
2021-07-07 09:20:38 +03:00
Petri Asikainen
168d7f7004 Handle image_source with ConvertBase64ToFiles 2021-07-07 09:08:37 +03:00
snipe
60b8320b4b Updated production assets
Signed-off-by: snipe <snipe@snipe.net>
2021-07-06 15:15:28 -07:00
snipe
721b749ae1 Merge remote-tracking branch 'origin/develop' 2021-07-06 15:13:39 -07:00
snipe
11d9b1ba45 Updated assets
Signed-off-by: snipe <snipe@snipe.net>
2021-07-06 15:09:03 -07:00
snipe
2f10d946ec Merge branch 'bug/ch16594/table-striping-on-dark-mode-skins-is-too' of https://github.com/Godmartinz/snipe-it into develop
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/dist/skins/skin-black-dark.css
#	public/css/dist/skins/skin-black-dark.min.css
#	public/css/dist/skins/skin-blue-dark.css
#	public/css/dist/skins/skin-blue-dark.min.css
#	public/css/dist/skins/skin-green-dark.css
#	public/css/dist/skins/skin-green-dark.min.css
#	public/css/dist/skins/skin-orange-dark.css
#	public/css/dist/skins/skin-orange-dark.min.css
#	public/css/dist/skins/skin-purple-dark.css
#	public/css/dist/skins/skin-purple-dark.min.css
#	public/css/dist/skins/skin-red-dark.css
#	public/css/dist/skins/skin-red-dark.min.css
#	public/mix-manifest.json
2021-07-06 15:08:20 -07:00
snipe
6e0355fa34 Merge pull request #9778 from inietov/fixes/users_departments_not_being_imported
Fixes #9730. Remove an else statement that doesn't allow to continue the importer flow.
2021-07-06 14:59:42 -07:00
Ivan Nieto Vivanco
131a285e2f Fixes Vue issue with the import process. 2021-07-06 15:59:45 -05:00
Mark Brule
f706c87cbc wrap OR queries in sub-condition 2021-07-06 20:43:17 +00:00
Petri Asikainen
f53cabee24 Better debug comment 2021-07-06 07:26:16 +03:00
Petri Asikainen
e275c9ee90 Fixed case again 2021-07-06 07:10:03 +03:00
Petri Asikainen
3d8acd1bd8 removed unused Bag-functions 2021-07-06 07:00:12 +03:00
Petri Asikainen
2169c62700 Merge branch 'feature/api-image-uploads-json' into feature/api-image-uploads 2021-07-06 06:55:54 +03:00
Petri Asikainen
c21b291484 keep using request 2021-07-06 06:51:07 +03:00
Petri Asikainen
c1bc2486ad keep using request 2021-07-06 06:49:19 +03:00
Petri Asikainen
e3166c2209 fix debug placement 2021-07-06 06:41:37 +03:00
Petri Asikainen
7a5b5c291d merged from develop 2021-07-06 06:38:32 +03:00
Petri Asikainen
d66ef233bf handle files via standard field 2021-07-06 06:25:37 +03:00
Petri Asikainen
013df747d7 debug trait 2021-07-05 09:59:19 +03:00
Petri Asikainen
02fb7ac03e Try without trait 2021-07-04 13:39:46 +03:00
Petri Asikainen
d48a9d549d Try without trait 2021-07-04 13:37:05 +03:00
Petri Asikainen
f59f3dbde4 case case again.. 2021-07-02 10:43:15 +03:00
Petri Asikainen
f4fa6836cb trait base64 encoded files 2021-07-02 10:29:26 +03:00
Petri Asikainen
e846e6ac76 trait base64 encoded files 2021-07-02 10:18:18 +03:00
Petri Asikainen
e15159b9c3 trait base64 encoded files 2021-07-02 10:17:29 +03:00
Ivan Nieto Vivanco
5545457536 Remove an else statement that doesn't allow to continue the importer flow. 2021-07-01 14:26:03 -05:00
snipe
19994e2097 Merge pull request #9774 from uberbrady/snipeit_restore_php73
Better debugging output, and remove non-PHP-7.3-compatible option
2021-06-30 15:22:48 -07:00
Brady Wetherington
102591b009 Better debugging output, and remove non-PHP-7.3-compatible option 2021-06-30 14:53:08 -07:00
Petri Asikainen
347e742e88 merged current upstream/develop 2021-06-30 12:02:05 +03:00
snipe
b46e2b5990 Merge remote-tracking branch 'origin/develop' 2021-06-30 01:03:05 -07:00
snipe
868419b35b Components checkin/checkout via API
Signed-off-by: snipe <snipe@snipe.net>
2021-06-30 01:02:44 -07:00
snipe
df7e0e5630 Fixed company resource route
Signed-off-by: snipe <snipe@snipe.net>
2021-06-29 23:46:25 -07:00
Petri Asikainen
6048acc95d fixed capitalization 2021-06-30 06:36:12 +03:00
snipe
86b3f8349a Merge pull request #9768 from svpernova09/vagrant-ansible-fix
Fix APP_ENV/APP_DEBUG typo overwriting the APP_ENV in Vagrant Playbook
2021-06-29 07:57:14 -07:00
Joe Ferguson
fbf5c705db Fix APP_ENV/APP_DEBUG typo overwriting the APP_ENV in Vagrant Playbook 2021-06-29 08:12:01 -05:00
Petri Asikainen
b0aa26e6cb Support images and multipart requests 2021-06-29 14:25:20 +03:00
Petri Asikainen
b49733832c Support images and multipart requests 2021-06-29 12:29:17 +03:00
Petri Asikainen
8c0be3aa87 Support images and multipart requests 2021-06-29 12:29:07 +03:00
Petri Asikainen
a936744e2e Support images and multipart requests 2021-06-29 12:28:52 +03:00
Petri Asikainen
f9da83bc46 Support images and multipart requests 2021-06-29 12:28:42 +03:00
Petri Asikainen
fc8498972e Support images and multipart requests 2021-06-29 12:28:32 +03:00
Petri Asikainen
4ba75291e4 Support images and multipart requests 2021-06-29 12:27:18 +03:00
Petri Asikainen
a7b1e31776 Support images and multipart requests 2021-06-29 12:27:08 +03:00
Petri Asikainen
604a0b6df1 Support images and multipart requests 2021-06-29 12:26:59 +03:00
Petri Asikainen
4ed9788a0e Support images and multipart requests 2021-06-29 12:26:45 +03:00
Petri Asikainen
e8a4059db9 Support images and multipart requests 2021-06-29 12:26:24 +03:00
Petri Asikainen
aa402bf896 Support images and multipart requests 2021-06-29 12:26:15 +03:00
Petri Asikainen
8d4219759e Support images and multipart requests 2021-06-29 12:25:47 +03:00
Godfrey M
aba912001d Table striping on dark mode skins is too [ch16594] 2021-06-28 20:41:56 -07:00
snipe
15b82997ca Merge pull request #9764 from uberbrady/develop
Regenerate assets after repairing Vue integration
2021-06-28 16:58:05 -07:00
Brady Wetherington
dce1dd41c8 Regenerate assets after repairing Vue integration 2021-06-28 16:38:05 -07:00
snipe
f504d7ef5f Merge remote-tracking branch 'origin/develop' 2021-06-28 13:12:10 -07:00
snipe
9ba7e7a0f3 Merge pull request #9761 from snipe/features/9745_add_notes_to_statuslabels
Added #9745 - adds searchable, sortable notes to statuslabels index
2021-06-28 13:09:24 -07:00
snipe
30297e479e Hide notes field by default
Signed-off-by: snipe <snipe@snipe.net>
2021-06-28 13:08:32 -07:00
snipe
19413a63da Make notes field searchable on status labels
Signed-off-by: snipe <snipe@snipe.net>
2021-06-28 11:53:17 -07:00
snipe
a4fd0c9c6d Fixed #9745 - added searchable, sortable notes field to status labels
Signed-off-by: snipe <snipe@snipe.net>
2021-06-28 11:52:57 -07:00
snipe
5b5b70e639 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
#	public/js/build/app.js
#	public/js/dist/all.js
#	public/mix-manifest.json
2021-06-28 11:01:45 -07:00
snipe
6521f16b80 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-06-28 11:00:34 -07:00
snipe
9b2cb19f22 Fixed #9743 - Vue screens not loading
Signed-off-by: snipe <snipe@snipe.net>
2021-06-28 10:59:34 -07:00
Petri Asikainen
e0c5205e9b save images 2021-06-28 08:11:33 +03:00
Petri Asikainen
695bf1e15f save images 2021-06-28 07:58:08 +03:00
Petri Asikainen
0e2efb6573 Merge branch 'develop' of github.com:snipe/snipe-it into feature/api-image-uploads 2021-06-27 14:38:55 +03:00
snipe
3ca3de9e4f Merge remote-tracking branch 'origin/develop' 2021-06-23 20:05:38 -07:00
snipe
174d53aff9 Fixed #9729 - order number maxlength updated to 200
Signed-off-by: snipe <snipe@snipe.net>
2021-06-23 20:05:22 -07:00
snipe
22152f0a8c Updated assets
Signed-off-by: snipe <snipe@snipe.net>
2021-06-23 17:55:38 -07:00
snipe
b5a75206fe Merge remote-tracking branch 'origin/develop' 2021-06-23 17:19:48 -07:00
snipe
3f39cff225 Merge pull request #9738 from Godmartinz/bug/ch16594/table-striping-on-dark-mode-skins-is-too
corrected a link color in the dark mode yellow skin
2021-06-23 16:39:02 -07:00
Godfrey M
a37edd5c5b darkened back-sub-alt more 2021-06-23 16:34:41 -07:00
snipe
6f3e156be6 Merge remote-tracking branch 'origin/develop' 2021-06-23 16:34:34 -07:00
snipe
7d1c2199ed Attempted to re-bound to lowest php version possible
Signed-off-by: snipe <snipe@snipe.net>
2021-06-23 16:29:43 -07:00
Godfrey M
f199098a59 undid the color change for links, darkened the back-sub-alt 2021-06-23 16:29:21 -07:00
snipe
335f4e50a5 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2021-06-23 16:07:01 -07:00
snipe
1808986bf5 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-06-23 16:06:30 -07:00
snipe
bc0c887812 Merge remote-tracking branch 'origin/develop' 2021-06-23 16:05:19 -07:00
snipe
d8191f738c Updated flysystem to 1.1.4 for critical security update
Signed-off-by: snipe <snipe@snipe.net>
2021-06-23 16:04:42 -07:00
snipe
7b51bf4f51 Merge remote-tracking branch 'origin/develop' 2021-06-23 14:41:27 -07:00
snipe
450183c55c Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-06-23 14:41:10 -07:00
snipe
e44a25126d Merge pull request #9676 from inietov/fixes/asset_checkin_api_doesnt_send_notification
Fixes #9666 Asset checkin via api doesn't send notification.
2021-06-23 14:35:07 -07:00
snipe
c801305c9b Merge pull request #9681 from tulsaschoolsdata/9680-fix-statuslabels-asset-count
Fixed #9680: Use Eloquent’s `withCount` method to count Statuslabel assets
2021-06-23 14:34:34 -07:00
snipe
4db5a8f62b Merge pull request #9695 from Joly0/master
Update print.blade.php
2021-06-23 14:33:25 -07:00
snipe
7b4cc5044b Add @derdeagle as a contributor 2021-06-23 14:31:48 -07:00
snipe
1c1ebdf44d Merge pull request #9706 from derdeagle/develop
Fixes #9705: Prevent syntax error in startup.sh
2021-06-23 14:31:32 -07:00
snipe
c684e5f481 Add @PetriAsi as a contributor 2021-06-23 14:31:16 -07:00
snipe
7b5a6a0085 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	resources/views/partials/forms/edit/company-select.blade.php
2021-06-23 14:30:31 -07:00
snipe
1bc4d1b997 Merge pull request #9717 from PetriAsi/fix/accessories-bulk-set-min-amt
Added #9716: Allow to bulk update accessories min_amt
2021-06-23 14:28:59 -07:00
snipe
ac52ea3463 Porting PR #9720 to develop
Signed-off-by: snipe <snipe@snipe.net>
2021-06-23 14:27:15 -07:00
snipe
a521ef706f Merge pull request #9720 from bmkalle/patch-1
Update company-select.blade.php
2021-06-23 14:26:29 -07:00
Godfrey M
154adeb9b2 corrected a link color in the dark mode yellow skin 2021-06-23 14:06:36 -07:00
Petri Asikainen
491a788cd0 testing image upload via api 2021-06-23 11:22:41 +03:00
snipe
a67ce965ec Update version.php 2021-06-22 20:13:03 -07:00
snipe
3e102bf57b Be more specific in accessory query
Signed-off-by: snipe <snipe@snipe.net>
2021-06-19 16:49:13 -07:00
snipe
cdcb153b1e Merge remote-tracking branch 'origin/develop' 2021-06-19 16:20:35 -07:00
snipe
0153c6ae96 Do not try to add the notes column if it already exists on accessories_users
Signed-off-by: snipe <snipe@snipe.net>
2021-06-19 16:20:22 -07:00
bmkalle
a330dca7d4 Update company-select.blade.php
select should be disabled if full multiple companies is activated and the user isn't a superuser. otherwise the user get the ability to choose all companies.
2021-06-17 10:51:00 +02:00
Petri Asikainen
ae2c77f97f Allow to bulk update min_amt 2021-06-17 00:36:04 +03:00
GMS ICT 2
ea7f18d0e6 add CompanyableTrait 2021-06-15 15:32:44 +07:00
Joly0
9a429952ff update print.blade.php 2021-06-15 08:52:01 +02:00
Johannes Münch
8f4b88a877 Fixes #9705 Prevent syntax error in startup.sh
If SESSION_DRIVER is not defined it leads to a syntax error.
2021-06-12 20:21:43 +02:00
Joly0
72f27ccc5b Update print.blade.php 2021-06-11 11:05:39 +02:00
snipe
8cd78b2790 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2021-06-10 17:44:17 -07:00
snipe
aae6a8fc6c Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-06-10 17:42:29 -07:00
snipe
ace7abc1ad Merge remote-tracking branch 'origin/develop' 2021-06-10 15:18:24 -07:00
snipe
c567ad0617 Add @travismiller as a contributor 2021-06-10 15:18:02 -07:00
snipe
4c007ae085 Merge remote-tracking branch 'origin/develop' 2021-06-10 15:17:19 -07:00
snipe
54cb6c050a Merge pull request #9679 from tulsaschoolsdata/serial-number-indexes
Fixed #8486: Add index for asset serial number
2021-06-09 17:36:06 -07:00
snipe
851e5ca96e Merge pull request #9683 from tulsaschoolsdata/9682-company-id-indexes
Thanks!
2021-06-09 17:35:37 -07:00
Travis Miller
103c4325ce Fixed #9682: Add indexes for company_id 2021-06-09 14:29:00 -05:00
Travis Miller
ebe7c2da87 Fixed #8486: Add index for asset serial number 2021-06-09 14:12:35 -05:00
Travis Miller
4f6b1bb12d Fixed #9680: Use Eloquent’s withCount method to count Statuslabel assets 2021-06-09 11:52:04 -05:00
Ivan Nieto Vivanco
bb227cafb2 Added event to trigger the notification. 2021-06-08 13:16:13 -05:00
snipe
6c1dd81e0a Merge pull request #9640 from inietov/fixes/errorexception_invalid_argument_supplied
Fixes an issue when tried to upload a file to an user without actually selecting a file. [ch16471]
2021-05-27 14:03:25 -07:00
Ivan Nieto Vivanco
9f944ad497 Added the 'required' attribute to the input file n the upload file form modal. Added a validation for the UserFilesController if the user doesn't select any file to upload [ch16471]. 2021-05-27 15:48:13 -05:00
snipe
01e3296ff3 Updated hash
Signed-off-by: snipe <snipe@snipe.net>
2021-05-26 15:58:24 -07:00
snipe
7d5a9180e6 Updated hash
Signed-off-by: snipe <snipe@snipe.net>
2021-05-26 15:57:56 -07:00
snipe
9f2b4c721d Allow password reset from user profile
Signed-off-by: snipe <snipe@snipe.net>
2021-05-26 15:32:23 -07:00
snipe
3d008079c9 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-05-26 14:32:33 -07:00
snipe
b8d413a6b8 Merge pull request #9632 from inietov/fixes/api_allow_duplicate_asset_tags
Fixes an issue that allows duplicate asset tags when the Asset is created via API.
2021-05-26 13:34:59 -07:00
snipe
30a193502f Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-05-26 13:27:20 -07:00
snipe
11f1b29db9 Add @kcoyo as a contributor 2021-05-26 13:04:51 -07:00
snipe
200d0804ec Merge pull request #9630 from kcoyo/develop
Fixed #9607: Sessions expire for SAML/RemoteUser/LDAP
2021-05-26 13:04:13 -07:00
Ivan Nieto Vivanco
d9f5f1182a Delete a couple lines that rewrites validation rules for asset tags in the model Asset.php:save() method. 2021-05-25 23:09:27 -05:00
snipe
3f09d17389 Fixed typo “synchronization”
Signed-off-by: snipe <snipe@snipe.net>
2021-05-25 18:45:06 -07:00
kcoyo
55555ee233 Merge pull request #1 from kcoyo/Fixed-#9607---Sessions-expire-for-SAML/RemoteUser/LDAP
Fixed #9607 - Sessions expire for SAML/RemoteUser/LDAP
2021-05-25 16:44:08 -07:00
kcoyo
cee6f0d579 Update LoginController.php
Fixed #9607 - Sessions expire for SAML/RemoteUser/LDAP
2021-05-25 16:37:34 -07:00
snipe
5b4550a6a8 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-05-21 16:56:15 -07:00
snipe
1a7edb3411 Accept webp in uploads (not just image files)
Signed-off-by: snipe <snipe@snipe.net>
2021-05-21 16:56:11 -07:00
snipe
796c7c8431 Merge pull request #9619 from uberbrady/migrator_misses_logos
Several improvements to the snipeit:restore Artisan command
2021-05-21 16:02:55 -07:00
Brady Wetherington
94c1d36e08 The legacy 'logo.png' might not be a PNG, so switched to wildcard. 2021-05-21 15:55:37 -07:00
Brady Wetherington
e71bba441e Several improvements to the snipeit:restore Artisan command
The output now focuses on files that were skipped. Wildcard support
was added for individual files. A progress bar fills as the files
are transferred from the ZIPball to the filesystem. A new command-line
switch can be used to disable the progress bar. Barcode restores are
now skipped (we'd probably prefer to regenerate them). A few missed
directories have been added in. Some logic to skip macOS resource-fork
files has been put in. Some bugs with array operations were fixed.
There's now a concept of 'valid' and 'invalid' files for wildcard
operations.
2021-05-21 15:23:23 -07:00
Sabir Manandhar
c3d75d3be3 feat[docker]: create session table migration if session driver is set to database (#9587) 2021-05-20 14:31:22 -07:00
snipe
9eea46adef Fixed parse error in user print view
Signed-off-by: snipe <snipe@snipe.net>
2021-05-20 13:53:43 -07:00
sabir-dzangolab
19766a0a72 Fix/startup-sh (#9586)
* fix: update docker/startup.sh broken after merging hotfixs/2fa_qr

* fix: Typo in Dockerfile.alpine
2021-05-17 15:39:05 -07:00
Marc Leuser
4030789786 fix LicenseSeatsController method documentation (#9584)
in an attempt to get the automatic API reference generation to work
2021-05-14 16:14:32 -07:00
Jonathon Reinhart
fd082addff Fix incorrect case of ldap sync status string (#9563)
Fixes #9562
2021-05-12 19:15:39 -07:00
snipe
d636566012 Merge remote-tracking branch 'origin/master' into develop 2021-05-12 17:45:06 -07:00
Brady Wetherington
6066005aeb [WIP] Initial rough stabs at the Backup Migrator. It kinda-sorta works? (#9457)
* Initial rough stabs at the Backup Migrator. It kinda-sorta works?

* Fix hardcoded mysql path var
2021-05-12 17:44:39 -07:00
snipe
76897f3a3a Make label printing from asset page more consistent with normal UI
Signed-off-by: snipe <snipe@snipe.net>
2021-05-12 17:08:53 -07:00
snipe
c1babdc9b0 Merge remote-tracking branch 'origin/develop' 2021-05-12 16:51:57 -07:00
snipe
1a95337db1 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-05-12 16:51:39 -07:00
Ivan Nieto Vivanco
6ed5dff1a5 Fix the target path to copy the demo logos in the database\seeds\SettingsSeeder.php. Also added the code that copies the demo logos to app\Console\Commands\ResetDemoSettings.php (#9571) 2021-05-12 16:41:49 -07:00
snipe
3f559c4a50 Add @tbrconnect as a contributor 2021-05-12 13:38:56 -07:00
tbrconnect
a29ef73346 Feature #3088 Print labels from asset detail page (#9559)
This PR adds a "Generate Label" button to the detail asset page as
described in #3088.

Fixes #3088

Co-authored-by: tilmann.bitterberg <tilmann@tbrglobal.com>
2021-05-12 13:38:26 -07:00
snipe
015ca1fcdc Merge remote-tracking branch 'origin/develop' 2021-05-07 18:13:22 -07:00
snipe
ded61614d1 Attempt to fix transient LDAP bug
Signed-off-by: snipe <snipe@snipe.net>
2021-05-07 18:13:04 -07:00
Brady Wetherington
62199f6255 Manually re-add support for Label Logos in Labels (#9552) 2021-05-07 17:01:32 -07:00
snipe
75b89b5a97 Merge remote-tracking branch 'origin/develop' 2021-05-07 16:42:41 -07:00
snipe
a704614397 Bumped max for country on model
Signed-off-by: snipe <snipe@snipe.net>
2021-05-07 16:42:26 -07:00
snipe
2dcb50d28e Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-05-07 16:36:12 -07:00
snipe
9aac3ae628 Fixed HTML causing two backup headers to appear
Signed-off-by: snipe <snipe@snipe.net>
2021-05-07 16:36:07 -07:00
Tom Misilo
397e2df3ea Upgrade the Alpine docker img to v3.13 for PHP 7.4 (#9550)
v3.13 of the alpine image has php7.4 instead of php7.3
2021-05-07 13:50:36 -07:00
Tom Misilo
4e408cbc42 Fix CSP Always being Enabled unless in debug mode. (#9543) 2021-05-05 10:51:47 -07:00
snipe
570a31a1c4 Merge remote-tracking branch 'origin/develop' 2021-05-05 10:29:10 -07:00
snipe
ece627b3a3 Small fixes for location printing when relationships are missing/invalid, per #9521
Signed-off-by: snipe <snipe@snipe.net>
2021-05-05 10:23:46 -07:00
snipe
d8d3fa2293 Only show department if it’s valid
Signed-off-by: snipe <snipe@snipe.net>
2021-05-05 10:13:19 -07:00
snipe
ab694347b0 Added favicon to demo dir
Signed-off-by: snipe <snipe@snipe.net>
2021-05-05 01:18:49 -07:00
snipe
aa98e4ea7a Bumped hash
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2021-05-05 00:04:17 -07:00
snipe
6935d94184 Bumped hash
Signed-off-by: snipe <snipe@snipe.net>
2021-05-05 00:03:33 -07:00
snipe
d9d5b4d730 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	.all-contributorsrc
#	README.md
2021-05-05 00:01:09 -07:00
Ivan Nieto Vivanco
36a43642d8 Changed the orderBy clause inside the custom reports function that forms the CSV to be 'id' so making it a unique value and don't causes repeated items. [ch14587] (#9535) 2021-05-04 23:50:02 -07:00
snipe
ed98683496 Add @mikecmpbll as a contributor 2021-05-04 22:40:04 -07:00
snipe
c2dc7ac182 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-05-04 22:39:24 -07:00
Dampfklon
37f7768e7a Fix Dockerfile.alpine build error and snipeit runtime permission error (#9520) 2021-05-04 22:29:24 -07:00
snipe
c1a8b609ea Add @markbrule as a contributor 2021-05-04 22:27:35 -07:00
markbrule
6c1553167d issue #9422 - pivot ID was being used as a user_id (#9512) 2021-05-04 22:27:01 -07:00
snipe
c572c98361 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-05-04 22:21:35 -07:00
snipe
6c0af3c6e1 Add @JohnnyPicnic as a contributor 2021-05-04 22:21:18 -07:00
snipe
715b1a0fb2 Fixed #9157 Update .env to API_TOKEN_EXPIRATION_YEARS=15 (reapplies #9524)
Signed-off-by: snipe <snipe@snipe.net>
2021-05-04 22:20:54 -07:00
Tom Misilo
a6bbe1fec3 Delete file from assets folder, not just the ref. (#9525) 2021-05-04 22:18:22 -07:00
snipe
67ac3631df Production assets
Signed-off-by: snipe <snipe@snipe.net>
2021-05-04 22:05:26 -07:00
snipe
5760b76c4e Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/dist/skins/skin-black-dark.css
#	public/css/dist/skins/skin-black-dark.min.css
#	public/css/dist/skins/skin-black.css
#	public/css/dist/skins/skin-black.min.css
#	public/css/dist/skins/skin-blue-dark.css
#	public/css/dist/skins/skin-blue-dark.min.css
#	public/css/dist/skins/skin-blue.css
#	public/css/dist/skins/skin-blue.min.css
#	public/css/dist/skins/skin-contrast.css
#	public/css/dist/skins/skin-contrast.min.css
#	public/css/dist/skins/skin-green-dark.css
#	public/css/dist/skins/skin-green-dark.min.css
#	public/css/dist/skins/skin-green.css
#	public/css/dist/skins/skin-green.min.css
#	public/css/dist/skins/skin-orange-dark.css
#	public/css/dist/skins/skin-orange-dark.min.css
#	public/css/dist/skins/skin-orange.css
#	public/css/dist/skins/skin-orange.min.css
#	public/css/dist/skins/skin-purple-dark.css
#	public/css/dist/skins/skin-purple-dark.min.css
#	public/css/dist/skins/skin-purple.css
#	public/css/dist/skins/skin-purple.min.css
#	public/css/dist/skins/skin-red-dark.css
#	public/css/dist/skins/skin-red-dark.min.css
#	public/css/dist/skins/skin-red.css
#	public/css/dist/skins/skin-red.min.css
#	public/css/dist/skins/skin-yellow-dark.css
#	public/css/dist/skins/skin-yellow-dark.min.css
#	public/css/dist/skins/skin-yellow.css
#	public/css/dist/skins/skin-yellow.min.css
#	public/mix-manifest.json
2021-05-04 22:03:56 -07:00
snipe
57b9b571dc Fixed #9531 - highlight search box when filled, add clear button (#9534) 2021-05-04 22:00:34 -07:00
snipe
62f091e769 Merge remote-tracking branch 'origin/develop' 2021-04-30 15:38:02 -07:00
snipe
cee5eea121 Use 24-hour date format for audit
Signed-off-by: snipe <snipe@snipe.net>
2021-04-30 15:37:39 -07:00
snipe
c6726015f7 Added missing use statement
Signed-off-by: snipe <snipe@snipe.net>
2021-04-30 14:52:08 -07:00
snipe
961268172b Merge remote-tracking branch 'origin/develop' 2021-04-26 18:12:10 -07:00
snipe
b01baec7a8 Updated languages
Signed-off-by: snipe <snipe@snipe.net>
2021-04-26 18:11:48 -07:00
snipe
a1bc984d17 Generate production assets, bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-04-26 17:34:02 -07:00
snipe
31944cd4d4 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-04-26 17:28:38 -07:00
snipe
d5894a4d64 Generated dev assets
Signed-off-by: snipe <snipe@snipe.net>
2021-04-26 17:27:28 -07:00
snipe
32f043c5df Set the body skin style if one was overridden by the user profile
Signed-off-by: snipe <snipe@snipe.net>
2021-04-26 17:25:39 -07:00
snipe
23376c317e Use correct URL for css for subdirs
Signed-off-by: snipe <snipe@snipe.net>
2021-04-26 17:22:02 -07:00
snipe
b3b02933a5 Removed duplicate code
Signed-off-by: snipe <snipe@snipe.net>
2021-04-26 17:21:48 -07:00
snipe
882732b2de WTF kind of gendered language was this mess?
Signed-off-by: snipe <snipe@snipe.net>
2021-04-26 17:18:17 -07:00
snipe
b8c3564434 Removed min from personal CSS
Signed-off-by: snipe <snipe@snipe.net>
2021-04-26 14:05:18 -07:00
snipe
138ddfec1c Merge remote-tracking branch 'origin/develop' 2021-04-23 14:27:12 -07:00
snipe
315bcb6b38 Added use statement
Signed-off-by: snipe <snipe@snipe.net>
2021-04-23 14:26:57 -07:00
snipe
8016807268 Add @Nevets82 as a contributor 2021-04-23 12:09:34 -07:00
Steven
82f73eb9e2 Added user locale to REST API GET /api/users response; (#9486)
* Clearer reporting on import

Signed-off-by: snipe <snipe@snipe.net>

* Try adding  text/x-Algol68 to import

Signed-off-by: snipe <snipe@snipe.net>

* Added user locale to REST API GET /api/users response;

Co-authored-by: snipe <snipe@snipe.net>
2021-04-23 12:09:00 -07:00
snipe
b865a8aeea Merge remote-tracking branch 'origin/develop' 2021-04-21 20:19:17 -07:00
snipe
1d43eda21f Features: improved UI for importer (#9467)
* Small UI improvements for importer

Signed-off-by: snipe <snipe@snipe.net>

* And UI backup improvements

Signed-off-by: snipe <snipe@snipe.net>
2021-04-21 20:16:17 -07:00
snipe
ea0d0df1af Try adding text/x-Algol68 to import
Signed-off-by: snipe <snipe@snipe.net>
2021-04-21 13:48:51 -07:00
snipe
54ef469d98 Clearer reporting on import
Signed-off-by: snipe <snipe@snipe.net>
2021-04-21 13:27:23 -07:00
snipe
cef689a679 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-04-21 12:29:06 -07:00
snipe
36c2edb278 Add @nepella as a contributor 2021-04-21 11:40:38 -07:00
Renee Margaret McConahy
e6c3d7fe57 Restore LOG_CHANNEL environment variable. (#9464)
This allows selecting the Monolog channel with the LOG_CHANNEL variable.
2021-04-21 11:40:23 -07:00
snipe
3855b74161 Merge remote-tracking branch 'origin/develop' 2021-04-21 10:24:04 -07:00
snipe
90f79eaf83 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-04-21 10:23:46 -07:00
Brady Wetherington
72a813f23d This fixes the controller signature error people are getting with LDAP logins (#9466) 2021-04-21 10:23:32 -07:00
snipe
d90abdf86f Snipe codeacy workflow (#9460)
* Removed printerClass="NunoMaduro\Collision\Adapters\Phpunit\Printer"

Signed-off-by: snipe <snipe@snipe.net>

* fix ldap ad authentication filter query mechanism (#7441)

* Create SECURITY.md

* Create codacy-analysis.yml

Co-authored-by: Istvan Basa <basipottom@gmail.com>
2021-04-20 22:17:37 -07:00
snipe
1886841ec5 Create SECURITY.md 2021-04-20 22:15:41 -07:00
Istvan Basa
b037d0efdd fix ldap ad authentication filter query mechanism (#7441) 2021-04-20 21:25:45 -07:00
aranar-pro
5127727730 Fixed #9424: import history adds asset model to assigned user and respects checkin date (#9350)
* Fixed #9294: Assets import history. Behaviour based on Checkin Date added, including assigning checked out items to users.

* Fixed #9294: Fixed asset import history to respect checkin and update user with checked out items.

* Fixed #9294: whitespace and comment cleanup for merge

* Fixed #9294: Fixed asset import history to respect checkin and update user with checked out items.
2021-04-20 21:25:17 -07:00
Ross Crawford-d'Heureuse
2a058c3ce1 Added a docker-compose with helper services (#9105)
* Updates

* BAse

* pdated instructions round app_key

Co-authored-by: Ross Crawford-d'Heureuse <ross.crawford@mindcurv.com>
2021-04-20 21:17:34 -07:00
Mateus Villar
fdcb63f251 Added #9313: Add new fpm-alpine docker image and docker secrets support (#9331)
* Add docker secret support

* Add docker secret support to selected environment variables below:

- APP_KEY_FILE        -> APP_KEY;

- DB_HOST_FILE        -> DB_HOST;
- DB_PORT_FILE        -> DB_PORT;
- DB_DATABASE_FILE    -> DB_DATABASE;
- DB_USERNAME_FILE    -> DB_USERNAME;
- DB_PASSWORD_FILE    -> DB_PASSWORD;

- REDIS_HOST_FILE     -> REDIS_HOST;
- REDIS_PASSWORD_FILE -> REDIS_PASSWORD;
- REDIS_PORT_FILE     -> REDIS_PORT;

- MAIL_HOST_FILE      -> MAIL_HOST;
- MAIL_PORT_FILE      -> MAIL_PORT;
- MAIL_USERNAME_FILE  -> MAIL_USERNAME;
- MAIL_PASSWORD_FILE  -> MAIL_PASSWORD;

* Add env file for docker secrets

* Added #9313: add new fpm-image using docker secrets

* Fix broken symlinks

* Add docker secrets support using shell script

* Remove old docker config php files
2021-04-20 21:14:47 -07:00
dependabot[bot]
da79a16284 Bump ssri from 6.0.1 to 6.0.2 (#9459)
* Removed printerClass="NunoMaduro\Collision\Adapters\Phpunit\Printer"

Signed-off-by: snipe <snipe@snipe.net>

* Bump ssri from 6.0.1 to 6.0.2

Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: snipe <snipe@snipe.net>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-20 21:13:34 -07:00
snipe
d10d090d33 Moved status label help text to headline
Signed-off-by: snipe <snipe@snipe.net>
2021-04-20 15:31:07 -07:00
snipe
aa6b1456b2 Added help text to custom fields headline
Signed-off-by: snipe <snipe@snipe.net>
2021-04-20 15:29:43 -07:00
snipe
b2de0d4ade Changed “Asset Categories” to “Categories” since there are more than asset categories now
Signed-off-by: snipe <snipe@snipe.net>
2021-04-20 15:29:22 -07:00
snipe
c17eaaad69 Check that the field is valid before checking to see count()
This mostly affects the demo, since the seeder updates info often

Signed-off-by: snipe <snipe@snipe.net>
2021-04-20 15:10:28 -07:00
snipe
e286ff0be3 Added show() redirect for CustomFields::show()
Signed-off-by: snipe <snipe@snipe.net>
2021-04-20 15:09:23 -07:00
snipe
83200d3cbd Merge remote-tracking branch 'origin/develop' 2021-04-20 14:55:48 -07:00
snipe
d40fe1b683 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-04-20 14:54:29 -07:00
Brady Wetherington
2a28f5e66c (Maybe?) Fixes the problem where we always need LDAP enabled (#9321)
* I *think* this fixes the problem where we need LDAP even if we aren't using it?

* Pull the LdapAd dependency out of the AuthController constructor
2021-04-20 14:53:47 -07:00
snipe
dd1a5681da Add @psarossy as a contributor 2021-04-20 14:53:10 -07:00
Peter Sarossy
cacb707a7f Added #9355: include Accessories and Consumables on the location reports (#9356) 2021-04-20 14:53:04 -07:00
snipe
e92f69dcda Add @zybersup as a contributor 2021-04-20 14:52:29 -07:00
Supapong Areeprasertkul
b28b245acc Update labels.blade.php (#8441)
- Make the qr_size bigger when no barcode printed.
- BUG: Missing unit of font size for .qr-text class.
- Reduce padding-right to remove the additional space above text when print from Google Chrome. (I do not know the cause. I tried "box-sizing: border-box" without success.)
2021-04-20 14:52:17 -07:00
Michael Pietsch
15e729f4b8 fix css when not runnin in webroot directory (#9445)
Co-authored-by: Michael Pietsch <skywalker-11@mi-pietsch.de>
2021-04-20 14:49:57 -07:00
snipe
3138f45e8c Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-04-20 14:49:38 -07:00
snipe
3e471a6587 Add @sh1hab as a contributor 2021-04-20 14:49:31 -07:00
Masudul Haque Shihab
f3831fe010 Fixed #9447 change route parameter name in locations view (#9456) 2021-04-20 14:49:05 -07:00
Ivan Nieto Vivanco
36bc47c61c Handle regex format when assigned from API (#9443) 2021-04-20 14:44:47 -07:00
snipe
e4acf8d795 Merge remote-tracking branch 'origin/master' into develop 2021-04-20 14:44:01 -07:00
snipe
b562f38729 Removed printerClass="NunoMaduro\Collision\Adapters\Phpunit\Printer"
Signed-off-by: snipe <snipe@snipe.net>
2021-04-19 10:51:29 -07:00
snipe
e8adf8d44c One more category fix
Signed-off-by: snipe <snipe@snipe.net>
2021-04-14 16:57:55 -07:00
snipe
b693e5202b Check for category name
Signed-off-by: snipe <snipe@snipe.net>
2021-04-14 16:54:36 -07:00
snipe
415ae5854f Add @Skywalker-11 as a contributor 2021-04-14 15:15:57 -07:00
snipe
e1c6d4ced7 Merge branch 'develop' of https://github.com/Skywalker-11/snipe-it into Skywalker-11-develop
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	app/Http/Requests/SettingsSamlRequest.php
2021-04-14 15:15:07 -07:00
snipe
252b2ee1b4 Add @Jelle-S as a contributor 2021-04-14 15:07:40 -07:00
snipe
39b0f464d2 Adds ID columns to tables that don’t have them - reproduces #9363
This reproduces #9363 without the PK in custom fields

Signed-off-by: snipe <snipe@snipe.net>
2021-04-14 15:07:11 -07:00
snipe
2c0438bdcb Add @andreaci as a contributor 2021-04-14 11:18:13 -07:00
snipe
2986765a68 Implements #9373
Signed-off-by: snipe <snipe@snipe.net>
2021-04-14 11:17:59 -07:00
snipe
f19595f525 Add @deivishome as a contributor 2021-04-14 10:27:08 -07:00
snipe
465ec054d3 Add @limeless as a contributor 2021-04-14 10:22:58 -07:00
theburger
785b1ad5a6 Update snipeit.sh php version from 7.1 to 7.4 (#9407)
Snipe-it 5.2.x is required PHP 7.4 or above,
update script to install PHP 7.4 instead of 7.1

## Changed
- PHP to install in script is changed to 7.4 from 7.1
- Add `''`at DB_PASSWORD when configuring `.env` file
2021-04-14 10:22:31 -07:00
snipe
ab8f7e7b84 Add @Joly0 as a contributor 2021-04-14 10:21:18 -07:00
Joly0
31b2287a57 Update print.blade.php (#9426)
Fixes #9418
2021-04-14 10:20:36 -07:00
Godfrey Martinez
5fab1d6f0d FIxes Sum of purchase cost of components not taking quantity into account in Asset View > Components tab (#9424)
* git commit -m

* added text
2021-04-14 10:19:40 -07:00
Godfrey Martinez
246cc0eaa8 Feature/ch16172/adding other fields to ldap sync settings (#9416)
* new branch, added manager as an additional field. Currently having DB issues

* WIP DB Issue with eloquent

* added department to LDAP sync

* removed unused variables
2021-04-14 10:17:57 -07:00
snipe
ce1d3284b0 Buld assets
Signed-off-by: snipe <snipe@snipe.net>
2021-04-14 10:12:14 -07:00
Brady Wetherington
bf344fd707 Merge branch 'develop'
mix-manifest I just picked one.
version.php will get bumped by hand
bootstrap table seems to just be another copy? Added it back.
2021-04-14 09:58:21 -07:00
Ivan Nieto Vivanco
9cf5fbd675 Logic added to handle when a cloned user is imported via LDAP. (#9429) 2021-04-14 09:19:25 -07:00
Ivan Nieto Vivanco
3824a50e8b Fixes an issue with CSS when the 'skin' value in settings table is empty. (#9423) 2021-04-12 20:37:02 -07:00
snipe
b6006769c3 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2021-04-06 21:02:05 -07:00
snipe
bf2479c5d9 Fixed url to user-ridden style
Signed-off-by: snipe <snipe@snipe.net>
2021-04-06 20:36:13 -07:00
snipe
7ddcc97e79 Generated dev assets
Signed-off-by: snipe <snipe@snipe.net>
2021-04-06 20:35:58 -07:00
snipe
ba92d751a3 Removed depreciated Input:: facade
Signed-off-by: snipe <snipe@snipe.net>
2021-04-06 20:28:05 -07:00
Brady Wetherington
6b86e2a58f Rebuilt all assets after all commits had landed 2021-04-06 20:16:59 -07:00
Brady Wetherington
792a31cc7f Merge branch 'develop' 2021-04-06 20:10:22 -07:00
snipe
e47e2e3754 Fixed #9404 - include note in accessory API
Signed-off-by: snipe <snipe@snipe.net>
2021-04-06 10:57:30 -07:00
snipe
105f57e059 Possible fix for Docker failing on master
Signed-off-by: snipe <snipe@snipe.net>
2021-04-06 06:09:04 -07:00
snipe
390403ddb7 Fixed #9370 - listbox custom fields not decryoted on edit
Signed-off-by: snipe <snipe@snipe.net>
2021-04-06 05:59:31 -07:00
snipe
7da32443ff Move develop fixes to master
Signed-off-by: snipe <snipe@snipe.net>
2021-04-06 05:05:16 -07:00
Brady Wetherington
72806cf8db Fix up docker build on develop branch (#9401) 2021-04-05 22:13:31 -07:00
Serkan
0e34e43abb The return early pattern applied to improve readability. (#8894) 2021-04-05 22:03:15 -07:00
snipe
981b503653 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-04-05 22:01:35 -07:00
Joel Pittet
af8509c4d0 Allow NPM packages to build for production (#9171)
* add back changes before compiling assets

* new css location and mix manifest

* update papaparse, most vunerabilities attached to it

* update axios and papaparse for security releases

* removing security fixes that still allow npm run production to work

* Update lodash
2021-04-05 22:01:11 -07:00
snipe
abddda2ab8 Add @kajes as a contributor 2021-04-05 21:56:45 -07:00
Lars Kajes
49532e1cd6 Add option to force TLS connection (#9327)
Co-authored-by: Lars Kajes <lars.kajes@iusinnovation.se>
2021-04-05 21:56:25 -07:00
snipe
09887bdabd Removed stray opening tag
Signed-off-by: snipe <snipe@snipe.net>
2021-04-05 21:54:31 -07:00
snipe
ff0e526021 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-04-05 21:53:47 -07:00
Godfrey Martinez
f9f8ce6df6 Auditing feature improvement Better mobile [ch14328] (#9181) 2021-04-05 21:53:19 -07:00
snipe
55692bfe98 Add @Tetrachloromethane250 as a contributor 2021-04-05 21:52:14 -07:00
snipe
5c5fe2bd87 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-04-05 21:52:01 -07:00
Tetrachloromethane250
157d9e4ebb Added #5977: Add permission to view files attached to licenses (#9264)
* Add permission to view and modify files for licenses

* Actually use the permission
2021-04-05 21:51:47 -07:00
snipe
20a3028386 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-04-05 21:48:01 -07:00
snipe
3ffa3534a0 Use environmental variables in memory limits
Signed-off-by: snipe <snipe@snipe.net>
2021-04-05 21:47:57 -07:00
Jan Kiesewetter
d61d189328 Change owner while copy (#7552)
* Change owner while copy

Copy all files and chown them in a 2nd layer leads to a larger image.
See layer 22 and 26 of https://hub.docker.com/layers/snipe/snipe-it/v4.7.8/images/sha256-67c865d91df1b90cef1112f12bbc9c64402dfeafde0bdb160c4f07e785ee0bcc

* Copy docker.env as user docker
2021-04-05 21:15:54 -07:00
Earl Ramirez
6a8d5282ef Add support for Debian 10 (#7414) 2021-04-05 21:06:53 -07:00
snipe
f147c43dd4 Add @t3easy as a contributor 2021-04-05 21:04:39 -07:00
snipe
c9ec15101c Add @ajsy as a contributor 2021-04-05 20:56:39 -07:00
snipe
b9bab05ac3 Merge branch 'master' of https://github.com/ajsy/snipe-it into ajsy-master
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	resources/views/users/print.blade.php
2021-04-05 20:55:49 -07:00
snipe
298bfa73c8 Add @ocelotsloth as a contributor 2021-04-05 20:35:28 -07:00
Mark Stenglein
dd1b9ab926 VAGRANT: Fix Ubuntu Development VMs (#6909)
* GITIGNORE: Add vagrant log and ansible retry files

This patch adds the following to the project's .gitignore file:
  - Vagrant's log file
  - Ansible's retry files

Signed-off-by: Mark Stenglein <mark@stengle.in>

* ANSIBLE: Add Ubuntu Ansible playbook for dev env

This patch adds an Ansible playbook to provision an Ubuntu based
development environment. This playbook is fully idempotent and
can be run multiple times without negative consequences.

Signed-off-by: Mark Stenglein <mark@stengle.in>

* VAGRANTFILE: Clean Vagrantfile

There was a lot of extra VMs being provisioned by the existing
Vagrantfile. Some of this may need to come back but I am removing
it with this commit to demonstrate that this is all that is
needed.

Signed-off-by: Mark Stenglein <mark@stengle.in>

* ANSIBLE: UBUNTU: PLAYBOOK: Add .env configuration

I missed the configuration of the .env file in the initial commit.
This patch adds these configuration steps as well as the needed
Cron job for the Artisan scheduler.

Signed-off-by: Mark Stenglein <mark@stengle.in>

* Revert "VAGRANTFILE: Clean Vagrantfile"

This reverts commit a608a30d6b.

* VAGRANTFILE: Fix Ubuntu Vagrant Development Boxes

This patch addresses problems with the existing Vagrant deployment
configurations for the Ubuntu VMs.
  - The vagrant file is configuring the VMs for an incorrect bridge
    interface. Fixed by changing the config to use the default
    networking as well as a port-forward.
  - Moves provisioning over to the Ansible-Local playbook I wrote.

Signed-off-by: Mark Stenglein <mark@stengle.in>
2021-04-05 20:35:04 -07:00
Sxderp
f01c93e162 Extend #6229 to include superuser permission check (#6772) 2021-04-05 20:26:06 -07:00
snipe
26b97d2b0b Add @JuustoMestari as a contributor 2021-04-05 20:16:35 -07:00
snipe
df72f92bc0 Brings PR #6744 up to parity with previous changes - Set custom field's default value when creating a new asset using the API
Signed-off-by: snipe <snipe@snipe.net>
2021-04-05 20:16:06 -07:00
AlexanderWPapyrus
a1f9642a18 Increases DPI of barcode for small lables (#9344)
solves issue #9293
2021-04-05 19:33:10 -07:00
Ivan Nieto Vivanco
90a24539b0 Fixes/cli importer issue (#9199)
* Added logic to handle the CLI importer.

* Fix bug introduced with the commit previous to the regression.

* Adds a validation for  variable when is null, add comments to clarify where the  class variable came from.

* Add support for when  variable is an instance of User class.
2021-04-05 19:28:31 -07:00
Godfrey Martinez
5ea759f615 Fixed #7211, #9197, #7864, [ch15504] - Added additional LDAP fields to sync (#9318)
* LDAP and Active Directory has plenty of other [ch15504]

* removed department id from ldap sync

* removed department id from ldap sync

* Update 2021_03_18_184102_adds_several_ldap_fields.php
2021-04-05 19:26:04 -07:00
Ivan Nieto Vivanco
eb0ae74ef8 Fixes typo that doesn't accepts 'textarea' as custom field type element. (#9387) 2021-04-01 18:23:05 -07:00
snipe
6f4215cfac Fixed label name for field_values
Signed-off-by: snipe <snipe@snipe.net>
2021-03-31 14:07:30 -07:00
snipe
a199c75f5c Added textarea and checkbox to validation rules
Signed-off-by: snipe <snipe@snipe.net>
2021-03-31 14:04:01 -07:00
snipe
b5f7cb534e Fixed element name
Signed-off-by: snipe <snipe@snipe.net>
2021-03-31 14:02:25 -07:00
snipe
618e4439e2 Fixed validation to include textarea
Signed-off-by: snipe <snipe@snipe.net>
2021-03-31 14:02:10 -07:00
snipe
6a8e761c5e Added created_at and updated_at to presenter
Signed-off-by: snipe <snipe@snipe.net>
2021-03-30 08:57:20 -07:00
snipe
70a7a8f20b WTF. This shit is haunted.
Signed-off-by: snipe <snipe@snipe.net>
2021-03-30 08:00:27 -07:00
snipe
a5b67965f2 Fixed CSS path
(Fixes RB #14746)

Signed-off-by: snipe <snipe@snipe.net>
2021-03-30 07:49:30 -07:00
snipe
2354e37504 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-03-30 07:40:14 -07:00
Nikolay Didenko
06e641b782 Do not override per table data-id-cookie-table attribute by current route name globally (#7835) 2021-03-29 20:05:24 -07:00
Shaun McPeck
c88813bbb8 set docker user as owner of key symbolic links (#7924)
Co-authored-by: Shaun McPeck <shaun@shaunmcpeck.com>
2021-03-29 19:44:42 -07:00
Marc Leuser
90b7d34c69 Added #6695: add API endpoint for license seats (#8058)
* remove miselading comment line

* added dedicated API endpoint for license seats

* don't display a seat name via API
it makes no sense and we don't have any particular sorting order
so the numbering would be inconsistent anyway

* reduce amount of IFs

* add sanity checks to show()

* fix goofed logging logic

* add tests for action log entries
2021-03-29 19:41:26 -07:00
R. Christian McDonald
cb1a95a530 Apache site configurations shouldn't be written to sites-enabled (#6982)
It is better (best) practice to write configurations to sites-available and then let Apache copy the configuration to sites-enabled via 'a2ensite' command
2021-03-29 19:21:30 -07:00
NMC
3e934a1b96 Add a way for a user to override the site skin setting + fix mislabeled comment. (#6891)
* Add a way for a user to override the skin setting.

* Add site setting to allow user to change the skin.

* Fix skin list.

Co-authored-by: NMC <info@nmc-lab.com>
2021-03-29 19:09:23 -07:00
Nuno Maduro
8b6b95a05b Makes nunomaduro/collision versioning consistent with other dependencies (#9316) 2021-03-29 18:15:20 -07:00
snipe
53651ba3df Add @misilot as a contributor 2021-03-24 14:09:02 -07:00
snipe
d527f23ec8 Add @raelldottin as a contributor 2021-03-24 14:08:56 -07:00
Raell Dottin
78cc47a859 Added sanity check to determine if a bind user account is set. (#9340) 2021-03-24 14:08:37 -07:00
snipe
b00413e8aa Added missing .env vars to example from #8389
Signed-off-by: snipe <snipe@snipe.net>
2021-03-24 11:46:07 -07:00
Tom Misilo
7557879d4a Add support for overriding the Time and Memory Limits (#8389)
This is similar to what exists for the LDAP Import, and adds support for
setting th  Import and Report max execution time and memory limits

Co-authored-by: snipe <snipe@snipe.net>
2021-03-24 11:40:43 -07:00
snipe
0b41f9182a Merge remote-tracking branch 'origin/develop' 2021-03-24 11:35:39 -07:00
Jo Drexl
0114373468 Fixing #9224 (#9328) 2021-03-22 12:57:26 -07:00
snipe
86fef3f40a Set SAML errors to warning instead of error
Signed-off-by: snipe <snipe@snipe.net>
2021-03-17 22:30:26 -07:00
snipe
c90604b5ae Merge remote-tracking branch 'origin/develop' 2021-03-17 22:19:24 -07:00
snipe
069e9e52fe Try/catch barcodes so they don’t shit up the logs
Signed-off-by: snipe <snipe@snipe.net>
2021-03-17 22:19:10 -07:00
Peter Dave Hello
ca8b152549 Remove unnecessary apt-get clean in Dockerfile (#9201)
This image is built from the official Debian image as upstream, so there
is no need to do apt-get clean manually.

Ref:
- docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get

> Official Debian and Ubuntu images automatically run apt-get clean, so
> explicit invocation is not required.
2021-03-17 20:33:54 -07:00
snipe
b2a3a80f96 Bumped hash
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	composer.lock
#	config/version.php
2021-03-17 20:04:43 -07:00
snipe
c8e172ec6b Downgrade packages
Signed-off-by: snipe <snipe@snipe.net>
2021-03-17 20:03:09 -07:00
snipe
afb7fcfa3e Bumped hash
Signed-off-by: snipe <snipe@snipe.net>
2021-03-17 20:02:54 -07:00
snipe
9f3a8a43cc Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	composer.lock
2021-03-17 19:41:02 -07:00
snipe
8fd8e716ac Changed debug level on bad LDAP connection (#9314)
* Changed debug level on bad LDAP connection

TODO:

Unfuck all of this. It’s a mess and it really doesn’t work the way we think it does. AdLdap library strikes again. :(

Signed-off-by: snipe <snipe@snipe.net>

* Improved phrasing

Signed-off-by: snipe <snipe@snipe.net>
2021-03-17 19:24:28 -07:00
snipe
72f7baf5ee Removed unused class references 2021-03-17 16:56:32 -07:00
snipe
1b890ffcc5 Added collision 2021-03-17 15:45:00 -07:00
snipe
ca882e2b3d Add @elyscape as a contributor 2021-03-15 16:42:52 -07:00
Eli Young
97fa9663b1 Fixed #9299: Use correct SVG MIME type for uploads (#9300)
The correct MIME type of SVG is image/svg+xml. Out of an abundance of
caution, I am leaving in image/svg to avoid potentially causing issues
on very old browsers, but this can likely be removed without issue.
2021-03-15 16:42:11 -07:00
snipe
ab092fd209 Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	app/Providers/AppServiceProvider.php
#	config/logging.php
#	config/services.php
2021-03-15 12:29:29 -07:00
Brady Wetherington
c7626f8387 Add new StorageHelper and use it where it makes sense (#9276) 2021-03-15 12:26:39 -07:00
snipe
3fc24b4e61 Set spatie encryption to null 2021-03-09 21:07:41 -08:00
snipe
f164f0ea60 Fixed #9266 - set a colors_array variable even if other conditions are not met 2021-03-09 21:04:32 -08:00
snipe
0dd38c4a9b One more try for logo copying
Again, this might not work, but I cannot find snipe-logo-lg.png anywhere in the repo
2021-03-09 20:41:47 -08:00
snipe
6e8aaddb40 One more changes for settings seeder (this may not work) 2021-03-09 17:40:22 -08:00
snipe
104912cdf3 Added default logos to setting seeder 2021-03-09 17:39:10 -08:00
snipe
b103f724b5 Added discard changes in composer (for those weird cases where it says something changed in a vendor directory) 2021-03-09 17:38:06 -08:00
snipe
0fa07a4bca Bumped point version 2021-03-09 16:19:21 -08:00
snipe
c3871c98df Updated rollbar package 2021-03-09 16:16:57 -08:00
snipe
cf4e97f103 Log namespacing 2021-03-09 13:39:53 -08:00
snipe
f05a8d782c Added spatie encryption line 2021-03-09 13:38:53 -08:00
snipe
89ab4bb86f Revert "Added PHP8 compatibility [experimental]"
This reverts commit 3873f14971.

# Conflicts:
#	composer.lock
2021-03-09 13:38:38 -08:00
snipe
707a68fc54 Rollback :( 2021-03-09 13:15:00 -08:00
snipe
4bd9706693 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-03-09 12:56:17 -08:00
snipe
0d91ebfed8 One more try at Spatie 2021-03-09 12:56:13 -08:00
snipe
2d6dcb6b3b Applying fix for Undefined class constant 'EM_AES_256' in spatie
https://github.com/spatie/laravel-backup/discussions/1247
2021-03-09 12:52:26 -08:00
snipe
e9ee9ea2e9 Fixed rollbar integration 2021-03-09 12:40:00 -08:00
snipe
3873f14971 Added PHP8 compatibility [experimental] 2021-03-09 12:39:49 -08:00
snipe
7e56fc5e0d Updated mix manifest 2021-03-02 12:33:39 -08:00
snipe
3f01b02fd9 Updated BS tables 2021-03-02 12:33:29 -08:00
snipe
77ec64aded Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	public/css/dist/skins/skin-black-dark.css
#	public/css/dist/skins/skin-black-dark.min.css
#	public/css/dist/skins/skin-blue-dark.css
#	public/css/dist/skins/skin-blue-dark.min.css
#	public/css/dist/skins/skin-green-dark.css
#	public/css/dist/skins/skin-green-dark.min.css
#	public/css/dist/skins/skin-orange-dark.css
#	public/css/dist/skins/skin-orange-dark.min.css
#	public/css/dist/skins/skin-purple-dark.css
#	public/css/dist/skins/skin-purple-dark.min.css
#	public/css/dist/skins/skin-red-dark.css
#	public/css/dist/skins/skin-red-dark.min.css
#	public/css/dist/skins/skin-yellow-dark.css
#	public/css/dist/skins/skin-yellow-dark.min.css
#	public/mix-manifest.json
2021-03-02 12:33:18 -08:00
Ivan Nieto Vivanco
9ed226a0af Fixes links in Models Actions, and to view the fieldset assigned to that Model. (#9232) 2021-03-01 13:08:29 -08:00
Ivan Nieto Vivanco
d64b35c348 Added a condition to ensure that only assets checked out to an user that is being deleted are updating their status (#9233) 2021-03-01 13:07:23 -08:00
snipe
5aa960603a Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-02-26 15:59:53 -08:00
Joel Pittet
c979779249 Fixes a couple blade templates for relative URLs (#9170)
* Switched branch name to master

* Production assets for better contrast in dark mode skins

* Fixed #9115: Duplicate column name 'provider' (#9137)

* Sigh. Real assets

* fix blade templates with missing url() function wrapper for relative URLs

* Develop to master (#9195)

* Added saml custom setting retrieveParametersFromServer to enable fixing SLO issues with Azure AD (#9187)

* [FIX] Lite test email won't use the mail component (#9092)

* [FIX] Lite test email won't use the mail component

* Revert "[FIX] Lite test email won't use the mail component"

This reverts commit 6dab9aa1a8.

* Fix check for snipeSettings

* Remove random text from message template

* Revert "Fix check for snipeSettings"

This reverts commit 887dcc7bbc.

* Fix test notification with setupCompleted

Co-authored-by: johnson-yi <63399474+johnson-yi@users.noreply.github.com>
Co-authored-by: Oliver Walerys <owalerys@users.noreply.github.com>

* Changed branch from develop to master

* fix blade templates with missing url() function wrapper for relative URLs

* Re-apply patch against develop

* Rebase against develop

Co-authored-by: snipe <snipe@snipe.net>
Co-authored-by: Kevin Köllmann <mail@kevinkoellmann.de>
Co-authored-by: johnson-yi <63399474+johnson-yi@users.noreply.github.com>
Co-authored-by: Oliver Walerys <owalerys@users.noreply.github.com>
2021-02-26 15:59:36 -08:00
snipe
52bf050c4f Add @joelpittet as a contributor 2021-02-26 15:59:17 -08:00
Ivan Nieto Vivanco
ab7dd90602 Fixes ternary that sets the offset in 0 when the offset passed to the API for the user is greater than total locations. (#9210) 2021-02-26 12:56:04 -08:00
snipe
2e298893b6 Updated mix manifest 2021-02-25 19:43:58 -08:00
Godfrey Martinez
b0078ff64d Audit dark mode theme skins and check for [ch15847] (#9102)
Co-authored-by: snipe <snipe@snipe.net>
2021-02-25 19:41:31 -08:00
snipe
fcd805638e Changed branch from develop to master 2021-02-25 16:54:23 -08:00
snipe
63629abb93 Merge remote-tracking branch 'origin/develop' 2021-02-25 16:53:50 -08:00
snipe
6373ef3283 Bumped version 2021-02-25 16:53:37 -08:00
snipe
00a7c1e9e2 Merge remote-tracking branch 'origin/develop' 2021-02-25 16:44:55 -08:00
snipe
f37d5d3d03 Fixed #9085 - asset models not showing proper pagination
Huge thanks to @inietov for catching this one
2021-02-25 16:43:38 -08:00
snipe
57e52f0ba4 Fixed extraneous closing </i> 2021-02-25 13:35:05 -08:00
snipe
dc8e06fc65 Merge remote-tracking branch 'origin/develop' 2021-02-24 09:12:27 -08:00
snipe
db3f80bb9b Fixed #9198 - added stdout as a log driver 2021-02-24 09:10:03 -08:00
snipe
f5dda06c55 Develop to master (#9195)
* Added saml custom setting retrieveParametersFromServer to enable fixing SLO issues with Azure AD (#9187)

* [FIX] Lite test email won't use the mail component (#9092)

* [FIX] Lite test email won't use the mail component

* Revert "[FIX] Lite test email won't use the mail component"

This reverts commit 6dab9aa1a8.

* Fix check for snipeSettings

* Remove random text from message template

* Revert "Fix check for snipeSettings"

This reverts commit 887dcc7bbc.

* Fix test notification with setupCompleted

Co-authored-by: johnson-yi <63399474+johnson-yi@users.noreply.github.com>
Co-authored-by: Oliver Walerys <owalerys@users.noreply.github.com>
2021-02-23 14:53:55 -08:00
Oliver Walerys
c3166d491a [FIX] Lite test email won't use the mail component (#9092)
* [FIX] Lite test email won't use the mail component

* Revert "[FIX] Lite test email won't use the mail component"

This reverts commit 6dab9aa1a8.

* Fix check for snipeSettings

* Remove random text from message template

* Revert "Fix check for snipeSettings"

This reverts commit 887dcc7bbc.

* Fix test notification with setupCompleted
2021-02-23 14:49:40 -08:00
johnson-yi
763e17f491 Added saml custom setting retrieveParametersFromServer to enable fixing SLO issues with Azure AD (#9187) 2021-02-23 11:05:22 -08:00
snipe
47b2fe571e Merge remote-tracking branch 'origin/develop' 2021-02-19 10:52:33 -08:00
snipe
c8f6318aba Fixed funky layout in asset model modal window (broken HTML) 2021-02-19 10:51:56 -08:00
snipe
adbb3a8f31 Merge remote-tracking branch 'origin/develop' 2021-02-19 10:20:07 -08:00
snipe
1f142fde8a Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-02-19 10:19:37 -08:00
Brady Wetherington
44eee019d9 Add variable declaration for $result (#9168) 2021-02-19 10:19:24 -08:00
snipe
f636aac2dd Add @sw-mreyes as a contributor 2021-02-19 10:11:52 -08:00
snipe
54fd1b993b Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	config/version.php
2021-02-19 10:11:23 -08:00
snipe
a5731a3088 Updated hash 2021-02-19 10:09:22 -08:00
snipe
6449d0aaf9 Sigh. Real assets 2021-02-19 10:06:06 -08:00
snipe
931e2df3bd Updated production assets
# Conflicts:
#	public/js/build/app.js
#	public/js/dist/all.js
2021-02-19 10:05:29 -08:00
snipe
7f8eddede6 Updated compiled assets 2021-02-19 10:02:30 -08:00
snipe
4ddab03792 Merge branch 'develop' of https://github.com/sw-mreyes/snipe-it into sw-mreyes-develop
# Conflicts:
#	public/mix-manifest.json
2021-02-19 10:00:35 -08:00
snipe
ff341caf34 Merge remote-tracking branch 'origin/develop' 2021-02-18 14:21:34 -08:00
snipe
5754f0aa3f Revert "Added logic to handle the CLI importer. (#9088)"
This reverts commit 2e2d087639.
2021-02-18 14:21:19 -08:00
snipe
785bc40d9d Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	public/css/dist/skins/skin-black.css
#	public/css/dist/skins/skin-blue.css
#	public/css/dist/skins/skin-green.css
#	public/css/dist/skins/skin-orange.css
#	public/css/dist/skins/skin-purple.css
#	public/css/dist/skins/skin-red.css
#	public/css/dist/skins/skin-yellow.css
#	public/mix-manifest.json
2021-02-17 13:50:14 -08:00
snipe
9d50e0e8d0 Fixed weird table formatting in expected checkin report 2021-02-17 13:44:35 -08:00
snipe
9deb4204c8 Fixed #9116 - incorrect parameter name sent to hardware.show in expected assets report 2021-02-17 13:41:08 -08:00
snipe
1ab349a63d Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-02-17 13:34:59 -08:00
Ivan Nieto
2e2d087639 Added logic to handle the CLI importer. (#9088) 2021-02-17 13:13:17 -08:00
snipe
bfadb2cea6 Add @koelle25 as a contributor 2021-02-17 12:58:57 -08:00
Kevin Köllmann
44eb67440a Fixed #9115: Duplicate column name 'provider' (#9137) 2021-02-17 12:57:08 -08:00
Godfrey Martinez
8fb97da314 Color of asset selection in bulk checkout [ch15525] (#9145) 2021-02-17 12:56:26 -08:00
Ivan Nieto
12ff465cdb Added feature: Checkbox Custom Fields as list of values. (#9112)
* Added functionality for checkboxes in custom fields. Similar to how radio buttons work.

* Added the same functionality when the custom fieldset is encrypted.

* Added missing bits, so the edit custom assets view shows what values have been already stored in database
2021-02-16 17:20:29 -08:00
Ivan Nieto
f89d789832 Fixes #8918 The validation rules on Manufacturer Model 'name' attribute are malformed. (#9133)
* Fixes the validation rules on Manufacturer Model

* Fixes a little issue; if the manufacturer is active soft-deletes it, if is already deleted permanently deletes it
2021-02-16 12:52:55 -08:00
Marcelo Reyes
4c3b46ea88 Fixed #9129: add missing function formatDatalistSafe to snipeit_modals.js 2021-02-16 13:50:00 +01:00
snipe
834e0a9dd5 Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	config/version.php
2021-02-05 14:29:13 -08:00
snipe
681c41bd18 Bumped version 2021-02-05 14:28:31 -08:00
snipe
74488ddceb Added provider column to oauth_clients table for passport upgrade 2021-02-05 14:27:56 -08:00
snipe
19820f1b42 Merge remote-tracking branch 'origin/develop' 2021-02-03 16:08:36 -08:00
snipe
2a88781cd5 Add @Kurokat as a contributor 2021-02-03 16:07:25 -08:00
snipe
f96c867bd3 Update @ghost as a contributor 2021-02-03 16:07:06 -08:00
snipe
06f8e8620a Add @EDVLeer as a contributor 2021-02-03 16:06:28 -08:00
snipe
95d907c9e9 Add @sean-borg as a contributor 2021-02-03 16:06:14 -08:00
snipe
d990152856 Add @andres-baller as a contributor 2021-02-03 16:05:45 -08:00
snipe
05609230b2 Add @ncareau as a contributor 2021-02-03 16:05:21 -08:00
snipe
220c254093 Add @benwa as a contributor 2021-02-03 16:05:06 -08:00
snipe
02313ce361 Add @fashberg as a contributor 2021-02-03 16:04:47 -08:00
snipe
e70f7c610a Add @winstan as a contributor 2021-02-03 16:03:20 -08:00
snipe
32f77c3285 Add @alek13 as a contributor 2021-02-03 16:02:49 -08:00
snipe
0a639f4fcc Add @ThoBur as a contributor 2021-02-03 16:02:38 -08:00
snipe
f2b55fb641 Add @PauloLuna as a contributor 2021-02-03 16:02:27 -08:00
snipe
0e443356f0 Add @iansltx as a contributor 2021-02-03 16:02:00 -08:00
snipe
76f7f01398 Add @derlucas as a contributor 2021-02-03 16:01:42 -08:00
snipe
992de0156b Add @phenixdotnet as a contributor 2021-02-03 16:01:27 -08:00
snipe
c96b5f5a85 Add @sigmoidal as a contributor 2021-02-03 16:01:12 -08:00
snipe
8d2685f0f0 Add @PeterDaveHello as a contributor 2021-02-03 16:01:00 -08:00
snipe
eb14cc7f43 Add @giannello as a contributor 2021-02-03 15:59:48 -08:00
snipe
3dc67cdba6 Updated dark skins with compiled assets for prod 2021-02-03 15:20:26 -08:00
snipe
0bbe0c85d7 Small improvement to topnav dropdown text colors in dark skins 2021-02-03 15:17:31 -08:00
snipe
49415806e1 Nicer formatting of the page if custom logout [ch15660] 2021-02-03 14:56:26 -08:00
Giuseppe Iannello
5edbb4b229 Support Google Cloud IAP (#8768)
Following up on 7c2da81700,
this extends the logic, adding support for Google Cloud IAP.
2021-02-03 11:59:55 -08:00
ThoBur
c40b8334fc Update edit.blade.php (#8876)
Fix issue #8518
2021-02-03 11:59:05 -08:00
snipe
0a37c9564a Merge remote-tracking branch 'origin/develop' 2021-02-03 01:30:11 -08:00
snipe
985193ffff Fixed #9082 - allow deployable status type on checkout 2021-02-03 01:29:54 -08:00
snipe
721add5bc1 Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	public/css/dist/skins/skin-blue-dark.css
#	public/css/dist/skins/skin-blue-dark.min.css
#	public/css/dist/skins/skin-green-dark.css
#	public/css/dist/skins/skin-green-dark.min.css
#	public/css/dist/skins/skin-orange-dark.css
#	public/css/dist/skins/skin-orange-dark.min.css
#	public/css/dist/skins/skin-purple-dark.css
#	public/css/dist/skins/skin-purple-dark.min.css
#	public/css/dist/skins/skin-red-dark.css
#	public/css/dist/skins/skin-red-dark.min.css
#	public/css/dist/skins/skin-yellow-dark.css
#	public/css/dist/skins/skin-yellow-dark.min.css
#	public/mix-manifest.json
2021-02-03 00:57:58 -08:00
snipe
ff8fa6ec77 Production assets for better contrast in dark mode skins 2021-02-03 00:52:23 -08:00
snipe
e0a6f22489 Small fixes to dark mode skins 2021-02-03 00:49:09 -08:00
snipe
030fdd60ff Switched branch name to master 2021-02-02 21:49:21 -08:00
snipe
fdde844ce5 Bumped version to 5.1.0 2021-02-02 21:48:42 -08:00
snipe
d263990401 Updated min requirements in composer.json 2021-02-02 21:29:09 -08:00
snipe
bf7a856fa6 Update minimum PHP requirements to 7.2.5 2021-02-02 21:05:37 -08:00
snipe
1e062d4fc8 Re-applying laravel update with PHP min 7.2.5 2021-02-02 20:58:15 -08:00
snipe
ca37de5e45 Ugh. Rolling back composer.lock
Everything sucks
2021-02-02 20:44:07 -08:00
snipe
9ba2fd93c1 Reverted Laravel upgrade :( 2021-02-02 20:34:23 -08:00
snipe
a2e177e754 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2021-02-02 20:30:36 -08:00
snipe
5e6db0b219 Removed platform req 2021-02-02 20:30:33 -08:00
Brady Wetherington
b09ded2a3b Upgrade laravel (#9081)
* Hotfix to develop to yank extraneous e()

* Upgrade Laravel release only to a later 6.18.x version

* Upgrade Laravel to 6.x and Passport 9.x, the recommended versions
2021-02-02 20:22:36 -08:00
snipe
124343911f Merge remote-tracking branch 'origin/develop' 2021-02-02 16:57:18 -08:00
Brady Wetherington
462f8c791f Hotfix to develop to yank extraneous e() (#9080) 2021-02-02 16:44:54 -08:00
Brady Wetherington
9a224a07ba Modified how we do Select2 dynamic drop-down menus to be more secure (#9079)
* Modified how we do Select2 dynamic drop-down menus to be more secure

As noted by the author of select2, the more-secure way of creating
rich Select-dropdowns is to use jquery to create HTML snippets and
carefully modify text attributes within there. This prevents any
XSS from being brought to the page. As a side-effect, the extra
escaping that we had to do in all of the internal selectlist calls
is now no longer necessary, and has been removed. Rebased and
squashed from the original.

* Rebuilt all assets, but this still feels like it's too much stuff in here.

* Whoops, need to run that in dev, not prod
2021-02-02 15:55:21 -08:00
Ivan Nieto
df4686bc96 Added a clause that lets the function that updates the department to fail gracefully if no dept. name is provided in the CSV passed to the Importer. (#9078) 2021-02-02 12:23:36 -08:00
snipe
b6c432a596 One more line of logging for purges 2021-02-02 02:20:30 -08:00
snipe
de9f487664 Merge remote-tracking branch 'origin/develop' 2021-02-02 01:59:13 -08:00
snipe
ef668317a9 Log user initiating a purge 2021-02-02 01:58:50 -08:00
Godfrey Martinez
cf368a4577 fixed an issue with links colors (#9073)
* fixed an issue with links colors

* corrected btn-default's color
2021-02-01 13:50:37 -08:00
snipe
2e71968c04 Merge remote-tracking branch 'origin/develop' 2021-01-27 17:44:36 -08:00
snipe
fdb5b3baf1 Depreciation detail view fixes [ch15776] (#9059)
* Allow sorting by months for depreciation list view

* Added dataTableLayout to standardize the list display table

* Implement the dataTableLayout() on the list view blade

* Split the view into tabs so we can combine asset depreciations and license depreciations

* Updated depreciation view to use tabbed interface for assets and licenses

* Added asset models to depreciation details page

* Make asset model category sortable

* Added cateory as allowed to be sorted on

* Added category sort scope

* Removed offset variable

* Small fixes to asset modes display in depreciation to bulk edit models
2021-01-27 17:44:05 -08:00
snipe
c745fa095b Merge remote-tracking branch 'origin/develop' 2021-01-27 15:38:15 -08:00
Brady Wetherington
70e6a6ced6 Fix issue where users with edit permission cannot invoke LDAP sync (#9058)
* Fix issue where users with edit permission cannot invoke LDAP sync

* Make User::class consistent with usage elsewhere in the same directory
2021-01-27 15:36:43 -08:00
Ivan Nieto
6772835efc Added support for radio buttons in Custom Fields. (#9053) 2021-01-27 14:41:58 -08:00
snipe
fb482b0dd6 Fixed translation string in Depreciation view [ch15776] 2021-01-27 14:09:01 -08:00
snipe
9f43d3345f Merge remote-tracking branch 'origin/develop' 2021-01-27 12:49:33 -08:00
Ivan Nieto
6e83679528 Instead of return a JSON response, redirect back to the previous screen (#9055) 2021-01-27 12:01:42 -08:00
snipe
a050aba72f Merge remote-tracking branch 'origin/develop' 2021-01-27 01:34:57 -08:00
snipe
0031fab0fe Added termination date, depreciation in license column selection [ch14505] (#9052) 2021-01-27 01:34:32 -08:00
snipe
585bdff364 Added other logo for demo 2021-01-27 00:35:32 -08:00
snipe
1d9741a49e Merge remote-tracking branch 'origin/develop' 2021-01-26 22:12:39 -08:00
snipe
9f7f1460e9 Simplified availableForCheckout() on asset 2021-01-26 22:12:24 -08:00
snipe
f871759753 Bumped version to 5.0.13-pre 2021-01-26 20:08:44 -08:00
snipe
8e17818f1e Bumped version to 5.0.13-pre 2021-01-26 20:08:08 -08:00
snipe
d19c6ab8e7 Use fadeIn/fadeOut for password reset page for nicer look 2021-01-26 20:05:01 -08:00
snipe
d14b1e3825 Added better visual cues for login (#9051)
* Added better visual cues for login

* Changed box header class to box-header with-border to match other screens

* Since we have all.js now, added class=“minimal” to use icheck
2021-01-26 19:57:39 -08:00
snipe
ba12ee9954 Specifically call out username in forgotten password 2021-01-26 18:00:50 -08:00
Evgeny
d8bb69533c To eliminate 12/24hours ambiguity fix. This fix prevents loss of time accuracy. (#8887)
Its a tiny fix to eliminate 12/24hours ambiguity. Fix prevents time accuracy loss in field "last_audit_date" for assets.
2021-01-26 12:22:59 -08:00
snipe
01d3606c42 Merge remote-tracking branch 'origin/develop' 2021-01-26 12:20:57 -08:00
sigmoidal
208f1db3b2 Update .htaccess (#9001)
.htaccess will work on both apache v2.2 and v2.4 (without this change, on upgrade, an internal error on the server occurs)
2021-01-26 12:20:03 -08:00
Peter Dave Hello
e5b02da54b Fix apk add usage in Dockerfile.alpine (#9032)
There is no need to use `--update` when `--no-cache` is already
specified. Use `--no-cache` only will make `apk` leave no local cache
and make the image smaller.
2021-01-26 12:12:00 -08:00
Vincent Lainé
d6ead5ae17 Added #8931: add health controller without session (#8978)
* Added health controller

* Trying to move session middleware to web and api group to have health controller without session

* Fix health route store the session

Co-authored-by: Vincent Lainé <v.laine@dental-monitoring.com>
2021-01-26 12:10:54 -08:00
Ian Littman
1d7d31b9ae Optimize target type + ID index for more realistic use cases (#8923)
Per https://youtu.be/EOXgHH4-WX4?t=1378 or thereabouts
2021-01-26 12:08:25 -08:00
Brady Wetherington
2a817c2123 Add migration for ldap_server URL's to ensure they at least start with ldap:// or ldaps:// (#8936) 2021-01-26 12:07:32 -08:00
Lucas Pleß
f3a7467235 Added today as default Date for checkout Form. (#8938) 2021-01-26 12:06:58 -08:00
Ivan Nieto
2da6f9136f Add 'Last Audit Date/Next Audit Date' filter to custom report (#8989)
* Add 'Last Audit Date/Next Audit Date' filter to custom report

* Added a constraint: cannot require a report with a Last Audit Date in the future.
2021-01-26 12:05:31 -08:00
Ivan Nieto
79549dbfb9 Use the correct env variables in config/auth.php file. (#9048) 2021-01-26 12:04:41 -08:00
snipe
a48d09f37e Fixed non-superadmin gate permissions for kits (#9029) 2021-01-26 11:56:42 -08:00
Godfrey Martinez
0dc78fdea6 fixed color schema on dark mode skins for links (#9034) 2021-01-21 14:41:42 -08:00
snipe
75a8639a20 Fixed weird checkbox display
TODO: fix the 500 on the save
2021-01-12 18:16:42 -08:00
snipe
380c6171b7 Check if the asset is deployed before prompting for an expected checkin date 2021-01-12 18:02:10 -08:00
snipe
d36d6b8e07 Added expected_checkout as editable field in asset edit 2021-01-12 16:48:49 -08:00
snipe
c00a1fa21b Added new generic datepicker partial 2021-01-12 16:48:32 -08:00
snipe
bbcd215ea4 Suppress OAuth token errors 2021-01-12 08:58:40 -08:00
Godfrey Martinez
444f9a81da Bug/ch15603/read only text field in saml screen dark (#8993)
* fixed dark mode skins read only color schema

* fixed dark mode skins read only color schema
2021-01-11 14:07:55 -08:00
snipe
b4eee5a9b7 Merge remote-tracking branch 'origin/develop' 2021-01-05 19:40:25 -08:00
Ivan Nieto
72f9fe444d Fix for default parameters in JS functions IE (#8973)
* Small fix for IE which doesn't support default parameters in the function definition

* Stylistic changes for better comprehension
2021-01-05 19:25:30 -08:00
snipe
eb423c252a Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	config/version.php
2021-01-04 09:09:39 -08:00
snipe
382fb31670 Updated translations (Finnish, Polish, Japanese, Turkish, Spanish) 2020-12-30 12:51:09 -08:00
snipe
e6ba4a423d Fixed #8721 - duplicate asset tags in select list when asset has name 2020-12-21 13:43:54 -08:00
snipe
13ed6cde67 Migration to confirm password min complies with newer Laravel min 2020-12-21 12:39:19 -08:00
snipe
cac78cdbf3 Use snipe-logo.png as default in settings seeder 2020-12-21 11:36:43 -08:00
snipe
8b67326e95 Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2020-12-21 11:35:21 -08:00
snipe
f65bc5caee Updated logos 2020-12-21 11:35:17 -08:00
Brady Wetherington
0329028e2c Fixed #8926, #8252 - introduce circular reference check for location parent_id - rebased from #8253 (#8927)
* Fixed #8252 - circular references in location parents

* Remove non-translated translation changes

* Fix typo

* Add loop limit to avoid unforseen infinite loops

* Remove check against parent_id in location controllers

* Remove the Location->id=null piece (no longer needed)

* Fix some formatting and whitespace

* Re-introduce accidentally merged-out language file

Co-authored-by: Travis Miller <milletr@tulsaschools.org>
2020-12-18 17:18:04 -08:00
snipe
d3d96c8285 Reverted composer until we can figure out wtf happened 2020-12-15 17:25:17 -08:00
snipe
5909860c5a Updated exception handler 2020-12-15 17:25:05 -08:00
snipe
1023fa3edd Re-added updated slack library 2020-12-15 14:10:57 -08:00
snipe
65e6d56f1f Display the extension error at the bottom of the extension list to make it more noticable 2020-12-15 14:09:42 -08:00
snipe
bf34385c3e Temp revert to old slack library
Getting a weird error, need to troubleshoot remotely
2020-12-15 13:43:18 -08:00
Godfrey Martinez
55a526a6b3 corrected background color for bulk checkout listable items in all da… (#8916)
* corrected background color for bulk checkout listable items in all dark schemas

* resubmitting
2020-12-15 12:37:22 -08:00
Evgeny
bbf7fbcff4 Localization digit separator feature. (#8915)
Provides an ability to localize the purchase_cost field in front-end hardware index table.
Has two digit separator formats in admin settings with comma and dot.
2020-12-15 11:49:13 -08:00
snipe
4a5cb94d94 Switch version file back to develop 2020-12-14 17:47:02 -08:00
snipe
cb184a9687 Updated composer.lock with newer packages 2020-12-14 17:46:39 -08:00
Alexander Chibrikin
fb37dbed92 use supported package for slack (#8867)
* Updated version.php to master

* use supported package for slack

Co-authored-by: snipe <snipe@snipe.net>
2020-12-14 17:45:00 -08:00
João Paulo
e410696a36 Fixed #8884: Fixed alpine image build (#8885)
* Fixed #8884: update alpine image dependencies, fix permission error in vendor folder and laravel.log file

* Fixed #8884: Removes unnecessary changes to fix alpine image build

* Fixed #8884: Removes unnecessary changes to fix alpine image build

* Fixed #8884: Fix typo
2020-12-14 17:42:43 -08:00
snipe
45bfec5cd3 Match setup admin on Quickstart password with min reqs for Settings model 2020-12-11 13:52:48 -08:00
snipe
055522510b Fixed logo in seeder 2020-12-09 08:48:47 -08:00
snipe
f1d0d1bfe7 Merge remote-tracking branch 'origin/develop' 2020-12-09 08:19:18 -08:00
snipe
c0aa6c153e Better callout for warning on api token page 2020-12-09 08:19:04 -08:00
snipe
da3451bf0d Merge remote-tracking branch 'origin/develop' 2020-12-09 08:15:04 -08:00
snipe
5f76e03616 Clarified API url info in account > api 2020-12-09 08:14:44 -08:00
snipe
84710eac98 Merge remote-tracking branch 'origin/develop' 2020-12-08 21:10:05 -08:00
snipe
81bf41a091 Added an explanation for folks trying to access the API base endpoint with no real endpoint 2020-12-08 21:05:01 -08:00
snipe
134acf3b87 Merge remote-tracking branch 'origin/develop' 2020-12-08 20:04:19 -08:00
snipe
82d8b2ab82 Fixed weird parsing in newer markdown 2020-12-08 20:04:01 -08:00
snipe
adc0d3a6ac Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	config/version.php
2020-12-08 16:53:43 -08:00
snipe
8b15841c4b Bumped version 2020-12-07 19:16:42 -08:00
snipe
fd4ee60276 Merge remote-tracking branch 'origin/develop' 2020-12-07 19:14:00 -08:00
Brady Wetherington
93358b5872 Merge pull request #8863 from johnson-yi/fixes/saml_debug
Fixes #8853 - allow saml to be more easily debugged
2020-12-07 14:50:23 -08:00
Johnson Yi
1c4e20c712 Allow saml to be more easily debugged 2020-12-04 21:54:04 +11:00
snipe
0e1f6a3fd1 Merge remote-tracking branch 'origin/develop' 2020-12-02 12:38:16 -08:00
snipe
71d0e6369e Merge branch 'develop' of https://github.com/snipe/snipe-it into develop 2020-12-02 11:01:10 -08:00
snipe
b27aeb1952 Added LDAP flag in users API for #8741 2020-12-02 11:01:05 -08:00
snipe
bec2b170ec Only overwrite notes if the LDAP user is new 2020-12-02 11:00:18 -08:00
snipe
269d3fe509 Make assigned_to_id nullable 2020-12-02 10:48:34 -08:00
Brady Wetherington
34d5473553 Fixes 8472 (again) - LDAP sync was assigning a bad default location (#8846) 2020-12-01 21:26:52 -08:00
snipe
4ac15daee7 Fixed #8147 - allow webp image format for public file uploads 2020-12-01 19:06:53 -08:00
snipe
5f3a1f6287 Merge remote-tracking branch 'origin/develop' 2020-11-30 20:47:03 -08:00
snipe
bfc60864dd Fixed typo on route for licenses 2020-11-30 20:46:45 -08:00
snipe
ffa2701f89 Fixed typo in demo logo 2020-11-30 18:59:44 -08:00
snipe
60d269afb5 Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	config/version.php
2020-11-30 17:28:46 -08:00
snipe
e2cb7a0242 Bumped version 2020-11-30 17:28:03 -08:00
snipe
f9b1fdc36b Merge remote-tracking branch 'origin/develop' 2020-11-30 17:26:31 -08:00
Brady Wetherington
93cf8d4e0a Forward-port of the old LDAP sync system (#8801)
* Forward-port of the old LDAP sync system

* Need to rename the class to avoid classname conflicts

* Make 'classic' LDAP sync not add surrounding parens to filters that already have them

* Re-work Test LDAP button to return 10 sample users

* Remove useless debugging code
2020-11-30 17:11:44 -08:00
snipe
e83bc03d97 Switch backup files array order to show latest first [ch15486]' 2020-11-30 14:46:10 -08:00
snipe
b0d493ee51 Merge remote-tracking branch 'origin/develop' 2020-11-30 12:54:30 -08:00
snipe
4882b01787 Added purchase order and order number to user > licenses view 2020-11-30 12:54:15 -08:00
snipe
f9dcf0783a Added phantomjs to package.json 2020-11-28 16:58:02 -08:00
snipe
985f3658be Added wider logo 2020-11-27 18:17:09 -08:00
snipe
705dd34f3e Removed older SAML fields 2020-11-27 18:14:32 -08:00
snipe
6cf5426540 Removed unused validation rule 2020-11-25 11:00:28 -08:00
snipe
2105a1ec1d Merge remote-tracking branch 'origin/develop' 2020-11-25 08:55:14 -08:00
snipe
f475bdbb2d Fixed #8797 - use html_entity_decode in fullName presenter for User 2020-11-25 08:54:23 -08:00
snipe
96eb623229 Merge remote-tracking branch 'origin/develop' 2020-11-25 01:53:21 -08:00
snipe
820a39cc90 Fixed #8814 - added App\Models\Recipients\AlertRecipient 2020-11-25 01:52:56 -08:00
snipe
615051cf66 Skip posix_getpwuid in upgrader if posix isn’t installed
We don’t need it for anything else, so no need to require it. Posix not being installed usually means it’s a windows machine.
2020-11-25 01:19:32 -08:00
snipe
bef42eb43c Merge remote-tracking branch 'origin/develop' 2020-11-25 00:47:15 -08:00
snipe
6f99ce2b07 Branding page UI improvements (image previews inline) 2020-11-25 00:45:46 -08:00
snipe
76ee5a679b Fixed #8810 - email logo was not being used in emails 2020-11-25 00:05:02 -08:00
snipe
26e4354433 Merge remote-tracking branch 'origin/develop' 2020-11-24 19:49:59 -08:00
snipe
72fc03aa50 Adds location to searchableRelations for asset model 2020-11-24 19:49:46 -08:00
snipe
bf1f8659cb Merge remote-tracking branch 'origin/develop' 2020-11-24 16:06:01 -08:00
snipe
c0d7564658 Fixed #8794 - Switched to firstOrCreate to create parents on import 2020-11-24 16:05:24 -08:00
snipe
74b26a349c Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	config/version.php
2020-11-24 13:54:02 -08:00
snipe
e9bfb157bb Bumped version. Again. 2020-11-24 13:53:28 -08:00
snipe
ef957399aa Merge remote-tracking branch 'origin/develop' 2020-11-24 13:51:19 -08:00
snipe
973eacf6c3 Small fixes for SAML
The SAML routes are in a service provide (sigh), so they did not have the `web` middleware group assigned to it.

I also added some additional checks so that the setup blade won’t fail (the migrations wouldn’t have been run yet, so outside of a try/catch, it would return an error since those tables don’t exist.)
2020-11-24 13:51:02 -08:00
Michael Pietsch
4f5374b2e8 enable use custom file based saml certificate/private key 2020-08-14 12:25:00 +02:00
ajsy
a714cd357f Update web.php 2019-05-03 15:22:05 +03:00
ajsy
0cdc7af611 Update print.blade.php 2019-05-03 15:22:01 +03:00
ajsy
9b3a8c046c Update LocationsController.php 2019-05-03 15:21:57 +03:00
ajsy
878cfee5a2 Revert "Delete print.blade.php"
This reverts commit a0721412fa.
2019-04-20 09:28:48 +03:00
ajsy
a0721412fa Delete print.blade.php 2019-04-19 15:50:05 +03:00
ajsy
52add03e56 Update print.blade.php
replace string in serial number with x except last five character
2019-04-19 15:43:40 +03:00
ajsy
c974968821 Update view.blade.php 2019-04-19 14:03:09 +03:00
ajsy
5dcf9fbb50 Update web.php 2019-04-19 13:20:44 +03:00
ajsy
f2242fa32e Update view.blade.php 2019-04-19 13:20:41 +03:00
ajsy
38e8028300 Update LocationsController.php 2019-04-19 13:20:37 +03:00
ajsy
7a68187466 Update table.php 2019-04-19 13:20:31 +03:00
ajsy
57c0f69286 Update LocationsController.php 2019-03-09 13:45:19 +03:00
ajsy
03c5b8e4ab Create print.blade.php 2019-03-09 11:36:42 +03:00
ajsy
311dd18443 Update LocationsController.php 2019-03-09 11:34:47 +03:00
ajsy
a958d56590 Update view.blade.php 2019-03-09 11:29:06 +03:00
ajsy
c11e93b72f Update web.php 2019-03-09 11:14:24 +03:00
2467 changed files with 72563 additions and 22320 deletions

View File

@@ -135,7 +135,8 @@
"avatar_url": "https://avatars0.githubusercontent.com/u/10137?v=3",
"profile": "https://github.com/ghost",
"contributions": [
"translation"
"translation",
"code"
]
},
{
@@ -1956,6 +1957,598 @@
"contributions": [
"code"
]
},
{
"login": "giannello",
"name": "Giuseppe Iannello",
"avatar_url": "https://avatars.githubusercontent.com/u/551789?v=4",
"profile": "https://github.com/giannello",
"contributions": [
"code"
]
},
{
"login": "PeterDaveHello",
"name": "Peter Dave Hello",
"avatar_url": "https://avatars.githubusercontent.com/u/3691490?v=4",
"profile": "https://www.peterdavehello.org/",
"contributions": [
"code"
]
},
{
"login": "sigmoidal",
"name": "sigmoidal",
"avatar_url": "https://avatars.githubusercontent.com/u/6106332?v=4",
"profile": "https://github.com/sigmoidal",
"contributions": [
"code"
]
},
{
"login": "phenixdotnet",
"name": "Vincent Lainé",
"avatar_url": "https://avatars.githubusercontent.com/u/2082554?v=4",
"profile": "https://github.com/phenixdotnet",
"contributions": [
"code"
]
},
{
"login": "derlucas",
"name": "Lucas Pleß",
"avatar_url": "https://avatars.githubusercontent.com/u/1943040?v=4",
"profile": "http://www.lucas-pless.com",
"contributions": [
"code"
]
},
{
"login": "iansltx",
"name": "Ian Littman",
"avatar_url": "https://avatars.githubusercontent.com/u/472804?v=4",
"profile": "http://twitter.com/iansltx",
"contributions": [
"code"
]
},
{
"login": "PauloLuna",
"name": "João Paulo",
"avatar_url": "https://avatars.githubusercontent.com/u/3519029?v=4",
"profile": "https://github.com/PauloLuna",
"contributions": [
"code"
]
},
{
"login": "ThoBur",
"name": "ThoBur",
"avatar_url": "https://avatars.githubusercontent.com/u/70443365?v=4",
"profile": "https://github.com/ThoBur",
"contributions": [
"code"
]
},
{
"login": "alek13",
"name": "Alexander Chibrikin",
"avatar_url": "https://avatars.githubusercontent.com/u/1972329?v=4",
"profile": "http://phpprofi.ru/",
"contributions": [
"code"
]
},
{
"login": "winstan",
"name": "Anthony Winstanley",
"avatar_url": "https://avatars.githubusercontent.com/u/438332?v=4",
"profile": "https://github.com/winstan",
"contributions": [
"code"
]
},
{
"login": "fashberg",
"name": "Folke",
"avatar_url": "https://avatars.githubusercontent.com/u/3075214?v=4",
"profile": "https://github.com/fashberg",
"contributions": [
"code"
]
},
{
"login": "benwa",
"name": "Bennett Blodinger",
"avatar_url": "https://avatars.githubusercontent.com/u/1351571?v=4",
"profile": "https://github.com/benwa",
"contributions": [
"code"
]
},
{
"login": "ncareau",
"name": "NMC",
"avatar_url": "https://avatars.githubusercontent.com/u/2974631?v=4",
"profile": "https://nmc.dev",
"contributions": [
"code"
]
},
{
"login": "andres-baller",
"name": "andres-baller",
"avatar_url": "https://avatars.githubusercontent.com/u/52182449?v=4",
"profile": "https://github.com/andres-baller",
"contributions": [
"code"
]
},
{
"login": "sean-borg",
"name": "sean-borg",
"avatar_url": "https://avatars.githubusercontent.com/u/67109348?v=4",
"profile": "https://github.com/sean-borg",
"contributions": [
"code"
]
},
{
"login": "EDVLeer",
"name": "EDVLeer",
"avatar_url": "https://avatars.githubusercontent.com/u/32170051?v=4",
"profile": "https://github.com/EDVLeer",
"contributions": [
"code"
]
},
{
"login": "Kurokat",
"name": "Kurokat",
"avatar_url": "https://avatars.githubusercontent.com/u/23075196?v=4",
"profile": "https://github.com/Kurokat",
"contributions": [
"code"
]
},
{
"login": "koelle25",
"name": "Kevin Köllmann",
"avatar_url": "https://avatars.githubusercontent.com/u/915514?v=4",
"profile": "https://www.kevinkoellmann.de",
"contributions": [
"code"
]
},
{
"login": "sw-mreyes",
"name": "sw-mreyes",
"avatar_url": "https://avatars.githubusercontent.com/u/49025941?v=4",
"profile": "https://github.com/sw-mreyes",
"contributions": [
"code"
]
},
{
"login": "joelpittet",
"name": "Joel Pittet",
"avatar_url": "https://avatars.githubusercontent.com/u/70129?v=4",
"profile": "https://pittet.ca",
"contributions": [
"code"
]
},
{
"login": "elyscape",
"name": "Eli Young",
"avatar_url": "https://avatars.githubusercontent.com/u/792695?v=4",
"profile": "https://elyscape.com",
"contributions": [
"code"
]
},
{
"login": "raelldottin",
"name": "Raell Dottin",
"avatar_url": "https://avatars.githubusercontent.com/u/317015?v=4",
"profile": "https://github.com/raelldottin",
"contributions": [
"code"
]
},
{
"login": "misilot",
"name": "Tom Misilo",
"avatar_url": "https://avatars.githubusercontent.com/u/1446856?v=4",
"profile": "https://github.com/misilot",
"contributions": [
"code"
]
},
{
"login": "JuustoMestari",
"name": "David Davenne",
"avatar_url": "https://avatars.githubusercontent.com/u/4496300?v=4",
"profile": "http://david.davenne.be",
"contributions": [
"code"
]
},
{
"login": "ocelotsloth",
"name": "Mark Stenglein",
"avatar_url": "https://avatars.githubusercontent.com/u/9255772?v=4",
"profile": "https://markstenglein.com",
"contributions": [
"code"
]
},
{
"login": "ajsy",
"name": "ajsy",
"avatar_url": "https://avatars.githubusercontent.com/u/35658596?v=4",
"profile": "https://github.com/ajsy",
"contributions": [
"code"
]
},
{
"login": "t3easy",
"name": "Jan Kiesewetter",
"avatar_url": "https://avatars.githubusercontent.com/u/3628035?v=4",
"profile": "https://github.com/t3easy",
"contributions": [
"code"
]
},
{
"login": "Tetrachloromethane250",
"name": "Tetrachloromethane250",
"avatar_url": "https://avatars.githubusercontent.com/u/79449630?v=4",
"profile": "https://github.com/Tetrachloromethane250",
"contributions": [
"code"
]
},
{
"login": "kajes",
"name": "Lars Kajes",
"avatar_url": "https://avatars.githubusercontent.com/u/22004482?v=4",
"profile": "https://www.kajes.se/",
"contributions": [
"code"
]
},
{
"login": "Joly0",
"name": "Joly0",
"avatar_url": "https://avatars.githubusercontent.com/u/13993216?v=4",
"profile": "https://github.com/Joly0",
"contributions": [
"code"
]
},
{
"login": "limeless",
"name": "theburger",
"avatar_url": "https://avatars.githubusercontent.com/u/1501022?v=4",
"profile": "https://github.com/limeless",
"contributions": [
"code"
]
},
{
"login": "deivishome",
"name": "David Valin Alonso",
"avatar_url": "https://avatars.githubusercontent.com/u/36065681?v=4",
"profile": "https://github.com/deivishome",
"contributions": [
"code"
]
},
{
"login": "andreaci",
"name": "andreaci",
"avatar_url": "https://avatars.githubusercontent.com/u/8290389?v=4",
"profile": "https://github.com/andreaci",
"contributions": [
"code"
]
},
{
"login": "Jelle-S",
"name": "Jelle Sebreghts",
"avatar_url": "https://avatars.githubusercontent.com/u/1828542?v=4",
"profile": "http://www.jellesebreghts.be",
"contributions": [
"code"
]
},
{
"login": "Skywalker-11",
"name": "Michael Pietsch",
"avatar_url": "https://avatars.githubusercontent.com/u/11180862?v=4",
"profile": "https://github.com/Skywalker-11",
"contributions": []
},
{
"login": "sh1hab",
"name": "Masudul Haque Shihab",
"avatar_url": "https://avatars.githubusercontent.com/u/22068886?v=4",
"profile": "https://github.com/sh1hab",
"contributions": [
"code"
]
},
{
"login": "zybersup",
"name": "Supapong Areeprasertkul",
"avatar_url": "https://avatars.githubusercontent.com/u/16099942?v=4",
"profile": "http://www.freedomdive.com/",
"contributions": [
"code"
]
},
{
"login": "psarossy",
"name": "Peter Sarossy",
"avatar_url": "https://avatars.githubusercontent.com/u/207358?v=4",
"profile": "https://github.com/psarossy",
"contributions": [
"code"
]
},
{
"login": "nepella",
"name": "Renee Margaret McConahy",
"avatar_url": "https://avatars.githubusercontent.com/u/11823649?v=4",
"profile": "https://github.com/nepella",
"contributions": [
"code"
]
},
{
"login": "JohnnyPicnic",
"name": "JohnnyPicnic",
"avatar_url": "https://avatars.githubusercontent.com/u/5553884?v=4",
"profile": "https://github.com/JohnnyPicnic",
"contributions": [
"code"
]
},
{
"login": "markbrule",
"name": "markbrule",
"avatar_url": "https://avatars.githubusercontent.com/u/8799594?v=4",
"profile": "https://github.com/markbrule",
"contributions": [
"code"
]
},
{
"login": "mikecmpbll",
"name": "Mike Campbell",
"avatar_url": "https://avatars.githubusercontent.com/u/1962801?v=4",
"profile": "https://github.com/mikecmpbll",
"contributions": [
"code"
]
},
{
"login": "tbrconnect",
"name": "tbrconnect",
"avatar_url": "https://avatars.githubusercontent.com/u/11973217?v=4",
"profile": "https://github.com/tbrconnect",
"contributions": [
"code"
]
},
{
"login": "kcoyo",
"name": "kcoyo",
"avatar_url": "https://avatars.githubusercontent.com/u/12447225?v=4",
"profile": "https://github.com/kcoyo",
"contributions": [
"code"
]
},
{
"login": "travismiller",
"name": "Travis Miller",
"avatar_url": "https://avatars.githubusercontent.com/u/494017?v=4",
"profile": "https://travismiller.com/",
"contributions": [
"code"
]
},
{
"login": "PetriAsi",
"name": "Petri Asikainen",
"avatar_url": "https://avatars.githubusercontent.com/u/8735148?v=4",
"profile": "https://github.com/PetriAsi",
"contributions": [
"code"
]
},
{
"login": "derdeagle",
"name": "derdeagle",
"avatar_url": "https://avatars.githubusercontent.com/u/11424540?v=4",
"profile": "https://github.com/derdeagle",
"contributions": [
"code"
]
},
{
"login": "vapier",
"name": "Mike Frysinger",
"avatar_url": "https://avatars.githubusercontent.com/u/176950?v=4",
"profile": "https://wh0rd.org/",
"contributions": [
"code"
]
},
{
"login": "AL4AL",
"name": "ALPHA",
"avatar_url": "https://avatars.githubusercontent.com/u/22044358?v=4",
"profile": "https://github.com/AL4AL",
"contributions": [
"code"
]
},
{
"login": "FliegenKLATSCH",
"name": "FliegenKLATSCH",
"avatar_url": "https://avatars.githubusercontent.com/u/1042587?v=4",
"profile": "https://www.ifern.de",
"contributions": [
"code"
]
},
{
"login": "jerm",
"name": "Jeremy Price",
"avatar_url": "https://avatars.githubusercontent.com/u/442138?v=4",
"profile": "https://github.com/jerm",
"contributions": [
"code"
]
},
{
"login": "Toreg87",
"name": "Toreg87",
"avatar_url": "https://avatars.githubusercontent.com/u/84392209?v=4",
"profile": "https://github.com/Toreg87",
"contributions": [
"code"
]
},
{
"login": "Computroniks",
"name": "Matthew Nickson",
"avatar_url": "https://avatars.githubusercontent.com/u/67638596?v=4",
"profile": "https://github.com/Computroniks",
"contributions": [
"code"
]
},
{
"login": "jethron",
"name": "Jethro Nederhof",
"avatar_url": "https://avatars.githubusercontent.com/u/1646397?v=4",
"profile": "https://jethron.id.au",
"contributions": [
"code"
]
},
{
"login": "01ste02",
"name": "Oskar Stenberg",
"avatar_url": "https://avatars.githubusercontent.com/u/23289826?v=4",
"profile": "https://github.com/01ste02",
"contributions": [
"code"
]
},
{
"login": "Robert-Azelis",
"name": "Robert-Azelis",
"avatar_url": "https://avatars.githubusercontent.com/u/82208283?v=4",
"profile": "https://github.com/Robert-Azelis",
"contributions": [
"code"
]
},
{
"login": "alwism",
"name": "Alexander William Smith",
"avatar_url": "https://avatars.githubusercontent.com/u/60648387?v=4",
"profile": "https://github.com/alwism",
"contributions": [
"code"
]
},
{
"login": "leitwerk-ag",
"name": "LEITWERK AG",
"avatar_url": "https://avatars.githubusercontent.com/u/24418301?v=4",
"profile": "https://www.leitwerk.de/",
"contributions": [
"code"
]
},
{
"login": "adamboutcher",
"name": "Adam",
"avatar_url": "https://avatars.githubusercontent.com/u/1911435?v=4",
"profile": "http://www.aboutcher.co.uk",
"contributions": [
"code"
]
},
{
"login": "sneak-it",
"name": "Ian",
"avatar_url": "https://avatars.githubusercontent.com/u/16104273?v=4",
"profile": "https://snksrv.com",
"contributions": [
"code"
]
},
{
"login": "bestlong",
"name": "Shao Yu-Lung (Allen)",
"avatar_url": "https://avatars.githubusercontent.com/u/4023909?v=4",
"profile": "http://blog.bestlong.idv.tw/",
"contributions": [
"code"
]
},
{
"login": "Haxatron",
"name": "Haxatron",
"avatar_url": "https://avatars.githubusercontent.com/u/76475453?v=4",
"profile": "https://github.com/Haxatron",
"contributions": [
"code"
]
},
{
"login": "exula",
"name": "Bradley Coudriet",
"avatar_url": "https://avatars.githubusercontent.com/u/3842948?v=4",
"profile": "http://bjcpgd.cias.rit.edu",
"contributions": [
"code"
]
},
{
"login": "UniversalSuperBox",
"name": "Dalton Durst",
"avatar_url": "https://avatars.githubusercontent.com/u/21966173?v=4",
"profile": "https://daltondur.st",
"contributions": [
"code"
]
},
{
"login": "TenOfTens",
"name": "TenOfTens",
"avatar_url": "https://avatars.githubusercontent.com/u/48162670?v=4",
"profile": "https://github.com/TenOfTens",
"contributions": [
"code"
]
},
{
"login": "savornicesei",
"name": "Simona Avornicesei",
"avatar_url": "https://avatars.githubusercontent.com/u/917232?v=4",
"profile": "http://www.avornicesei.com",
"contributions": [
"test"
]
}
]
}

157
.env.docker Normal file
View File

@@ -0,0 +1,157 @@
# --------------------------------------------
# REQUIRED: DB SETUP
# --------------------------------------------
MYSQL_DATABASE=snipeit
MYSQL_USER=snipeit
MYSQL_PASSWORD=changeme1234
MYSQL_ROOT_PASSWORD=changeme1234
# --------------------------------------------
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------
APP_ENV=develop
APP_DEBUG=false
# please regenerate the APP_KEY value by calling `docker-compose run --rm snipeit bash` and then `php artisan key:generate --show` and then copy paste the value here
APP_KEY=base64:3ilviXqB9u6DX1NRcyWGJ+sjySF+H18CPDGb3+IVwMQ=
APP_URL=http://localhost:8000
APP_TIMEZONE='UTC'
APP_LOCALE=en
MAX_RESULTS=500
# --------------------------------------------
# REQUIRED: UPLOADED FILE STORAGE SETTINGS
# --------------------------------------------
PRIVATE_FILESYSTEM_DISK=local
PUBLIC_FILESYSTEM_DISK=local_public
# --------------------------------------------
# REQUIRED: DATABASE SETTINGS
# --------------------------------------------
DB_CONNECTION=mysql
DB_HOST=mariadb
DB_DATABASE=snipeit
DB_USERNAME=snipeit
DB_PASSWORD=changeme1234
DB_PREFIX=null
DB_DUMP_PATH='/usr/bin'
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci
# --------------------------------------------
# OPTIONAL: SSL DATABASE SETTINGS
# --------------------------------------------
DB_SSL=false
DB_SSL_IS_PAAS=false
DB_SSL_KEY_PATH=null
DB_SSL_CERT_PATH=null
DB_SSL_CA_PATH=null
DB_SSL_CIPHER=null
# --------------------------------------------
# REQUIRED: OUTGOING MAIL SERVER SETTINGS
# --------------------------------------------
MAIL_DRIVER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDR=you@example.com
MAIL_FROM_NAME='Snipe-IT'
MAIL_REPLYTO_ADDR=you@example.com
MAIL_REPLYTO_NAME='Snipe-IT'
MAIL_AUTO_EMBED_METHOD='attachment'
# --------------------------------------------
# REQUIRED: IMAGE LIBRARY
# This should be gd or imagick
# --------------------------------------------
IMAGE_LIB=gd
# --------------------------------------------
# OPTIONAL: BACKUP SETTINGS
# --------------------------------------------
MAIL_BACKUP_NOTIFICATION_DRIVER=null
MAIL_BACKUP_NOTIFICATION_ADDRESS=null
BACKUP_ENV=true
# --------------------------------------------
# OPTIONAL: SESSION SETTINGS
# --------------------------------------------
SESSION_LIFETIME=12000
EXPIRE_ON_CLOSE=false
ENCRYPT=false
COOKIE_NAME=snipeit_session
COOKIE_DOMAIN=null
SECURE_COOKIES=false
API_TOKEN_EXPIRATION_YEARS=40
# --------------------------------------------
# OPTIONAL: SECURITY HEADER SETTINGS
# --------------------------------------------
APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1
ALLOW_IFRAMING=false
REFERRER_POLICY=same-origin
ENABLE_CSP=false
CORS_ALLOWED_ORIGINS=null
ENABLE_HSTS=false
# --------------------------------------------
# OPTIONAL: CACHE SETTINGS
# --------------------------------------------
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
CACHE_PREFIX=snipeit
# --------------------------------------------
# OPTIONAL: REDIS SETTINGS
# --------------------------------------------
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
# --------------------------------------------
# OPTIONAL: MEMCACHED SETTINGS
# --------------------------------------------
MEMCACHED_HOST=null
MEMCACHED_PORT=null
# --------------------------------------------
# OPTIONAL: PUBLIC S3 Settings
# --------------------------------------------
PUBLIC_AWS_SECRET_ACCESS_KEY=null
PUBLIC_AWS_ACCESS_KEY_ID=null
PUBLIC_AWS_DEFAULT_REGION=null
PUBLIC_AWS_BUCKET=null
PUBLIC_AWS_URL=null
PUBLIC_AWS_BUCKET_ROOT=null
# --------------------------------------------
# OPTIONAL: PRIVATE S3 Settings
# --------------------------------------------
PRIVATE_AWS_ACCESS_KEY_ID=null
PRIVATE_AWS_SECRET_ACCESS_KEY=null
PRIVATE_AWS_DEFAULT_REGION=null
PRIVATE_AWS_BUCKET=null
PRIVATE_AWS_URL=null
PRIVATE_AWS_BUCKET_ROOT=null
# --------------------------------------------
# OPTIONAL: LOGIN THROTTLING
# --------------------------------------------
LOGIN_MAX_ATTEMPTS=5
LOGIN_LOCKOUT_DURATION=60
RESET_PASSWORD_LINK_EXPIRES=900
# --------------------------------------------
# OPTIONAL: MISC
# --------------------------------------------
APP_LOG=stderr
APP_LOG_MAX_FILES=10
APP_LOCKED=false
APP_CIPHER=AES-256-CBC
GOOGLE_MAPS_API=
LDAP_MEM_LIM=500M
LDAP_TIME_LIM=600

View File

@@ -77,7 +77,7 @@ ENCRYPT=false
COOKIE_NAME=snipeit_session
COOKIE_DOMAIN=null
SECURE_COOKIES=false
API_TOKEN_EXPIRATION_YEARS=40
API_TOKEN_EXPIRATION_YEARS=15
# --------------------------------------------
# OPTIONAL: SECURITY HEADER SETTINGS
@@ -144,6 +144,12 @@ APP_LOG=single
APP_LOG_MAX_FILES=10
APP_LOCKED=false
APP_CIPHER=AES-256-CBC
APP_FORCE_TLS=false
APP_ALLOW_INSECURE_HOSTS=false
GOOGLE_MAPS_API=
LDAP_MEM_LIM=500M
LDAP_TIME_LIM=600
IMPORT_TIME_LIMIT=600
IMPORT_MEMORY_LIMIT=500M
REPORT_TIME_LIMIT=12000

View File

@@ -1,62 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
---
#### Please confirm you have done the following before posting your bug report:
- [ ] I have enabled debug mode
- [ ] I have read [checked the Common Issues page](https://snipe-it.readme.io/docs/common-issues)
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Server (please complete the following information):**
- Snipe-IT Version
- OS: [e.g. Ubuntu, CentOS]
- Web Server: [e.g. Apache, IIS]
- PHP Version
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Error Messages**
- WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
- If a stacktrace is provided in the error, include that too.
- Any errors that appear in your browser's error console.
- Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo.
- Include any additional information you can find in `storage/logs` and your webserver's logs.
- Include the output from `php -m` (this should display what modules you have enabled.)
**Additional context**
- Is this a fresh install or an upgrade?
- What OS and web server you're running Snipe-IT on
- What method you used to install Snipe-IT (install.sh, manual installation, docker, etc)
- Include what you've done so far in the installation, and if you got any error messages along the way.
- Indicate whether or not you've manually edited any data directly in the database
Add any other context about the problem here.
Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.

View File

@@ -1,23 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Server (please complete the following information):**
- Snipe-IT Version
- OS: [e.g. Ubuntu, CentOS]
- Web Server: [e.g. Apache, IIS]
- PHP Version
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

129
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,129 @@
name: Bug Report
description: Create a report to help us improve
body:
- type: checkboxes
attributes:
label: Debug mode
description: Please confirm you have done the following before posting your bug report
options:
- label: I have enabled debug mode
required: true
- label: I have read [checked the Common Issues page](https://snipe-it.readme.io/docs/common-issues)
required: true
- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: Reproduction steps
description: Steps to reproduce the behavior.
value: |
1.
2.
3.
...
validations:
required: true
- type: textarea
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Screenshots
description: 'If applicable, add screenshots to help explain your problem.'
- type: markdown
attributes:
value: "### Server"
- type: input
attributes:
label: Snipe-IT Version
validations:
required: true
- type: input
id: server_operatingSystem
attributes:
label: Operating System
description: 'e.g. Ubuntu, Windows'
validations:
required: true
- type: input
attributes:
label: Web Server
description: 'e.g. Apache, IIS'
validations:
required: true
- type: input
attributes:
label: PHP Version
validations:
required: true
- type: markdown
attributes:
value: "### Desktop"
- type: input
id: desktop_operatingSystem
attributes:
label: Operating System
description: 'e.g. Ubuntu, Windows'
- type: input
id: desktop_browser
attributes:
label: Browser
description: 'e.g. Google Chrome, Safari'
- type: input
id: desktop_version
attributes:
label: Version
description: 'e.g. 93'
- type: markdown
attributes:
value: "### Mobile"
- type: input
attributes:
label: Device
description: 'e.g. iPhone 6, Pixel 4a'
- type: input
id: mobile_operatingSystem
attributes:
label: Operating System
description: 'e.g. iOS 8.1, Android 9'
- type: input
id: mobile_browser
attributes:
label: Browser
description: 'e.g. Google Chrome, Safari'
- type: input
id: mobile_version
attributes:
label: Version
description: 'e.g. 93'
- type: textarea
attributes:
label: Error messages
description: |
WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
If a stacktrace is provided in the error, include that too.
Any errors that appear in your browser's error console.
Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo.
Include any additional information you can find in `storage/logs` and your webserver's logs.
Include the output from `php -m` (this should display what modules you have enabled.)
render: shell
- type: textarea
attributes:
label: Additional context
description: |
Is this a fresh install or an upgrade?
What OS and web server you're running Snipe-IT on
What method you used to install Snipe-IT (install.sh, manual installation, docker, etc)
Include what you've done so far in the installation, and if you got any error messages along the way.
Indicate whether or not you've manually edited any data directly in the database
Add any other context about the problem here.
- type: markdown
attributes:
value: Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1 @@
blank_issues_enabled: false

View File

@@ -0,0 +1,42 @@
name: Feature Request
description: Suggest an idea for this project
body:
- type: input
attributes:
label: Snipe-IT Version
validations:
required: true
- type: input
id: server_operatingSystem
attributes:
label: Operating System
description: 'e.g. Ubuntu, Windows'
validations:
required: true
- type: input
attributes:
label: Web Server
description: 'e.g. Apache, IIS'
validations:
required: true
- type: input
attributes:
label: PHP Version
validations:
required: true
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
- type: textarea
attributes:
label: Additional context Add any other context or screenshots about the feature request here.

49
.github/workflows/codacy-analysis.yml vendored Normal file
View File

@@ -0,0 +1,49 @@
# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.
name: Codacy Security Scan
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '36 23 * * 3'
jobs:
codacy-security-scan:
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v2
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@1.1.0
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: results.sarif

82
.github/workflows/docker-alpine.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
# Snipe-IT (Alpine) Docker image build for hub.docker.com
name: Docker images (Alpine)
# Run this Build for all pushes to 'master' or develop branch, or tagged releases.
# Also run for PRs to ensure PR doesn't break Docker build process
on:
push:
branches:
- master
- develop
tags:
- 'v**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
pull_request:
jobs:
docker:
# Ensure this job never runs on forked repos. It's only executed for 'snipe/snipe-it'
if: github.repository == 'snipe/snipe-it'
runs-on: ubuntu-latest
env:
# Define tags to use for Docker images based on Git tags/branches (for docker/metadata-action)
# For a new commit on default branch (master), use the literal tag 'latest' on Docker image.
# For a new commit on other branches, use the branch name as the tag for Docker image.
# For a new tag, copy that tag name as the tag for Docker image.
IMAGE_TAGS: |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }},suffix=-alpine
type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }},suffix=-alpine
type=ref,event=tag,suffix=-alpine
# Define default tag "flavor" for docker/metadata-action per
# https://github.com/docker/metadata-action#flavor-input
# We turn off 'latest' tag by default.
TAGS_FLAVOR: |
latest=false
steps:
# https://github.com/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v2
# https://github.com/docker/setup-buildx-action
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
# https://github.com/docker/login-action
- name: Login to DockerHub
# Only login if not a PR, as PRs only trigger a Docker build and not a push
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
###############################################
# Build/Push the 'snipe/snipe-it' image
###############################################
# https://github.com/docker/metadata-action
# Get Metadata for docker_build step below
- name: Sync metadata (tags, labels) from GitHub to Docker for 'snipe-it' image
id: meta_build
uses: docker/metadata-action@v3
with:
images: snipe/snipe-it
tags: ${{ env.IMAGE_TAGS }}
flavor: ${{ env.TAGS_FLAVOR }}
# https://github.com/docker/build-push-action
- name: Build and push 'snipe-it' image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile.alpine
platforms: linux/amd64
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
# but we ONLY do an image push to DockerHub if it's NOT a PR
push: ${{ github.event_name != 'pull_request' }}
# Use tags / labels provided by 'docker/metadata-action' above
tags: ${{ steps.meta_build.outputs.tags }}
labels: ${{ steps.meta_build.outputs.labels }}

82
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
# Snipe-IT Docker image build for hub.docker.com
name: Docker images
# Run this Build for all pushes to 'master' or develop branch, or tagged releases.
# Also run for PRs to ensure PR doesn't break Docker build process
on:
push:
branches:
- master
- develop
tags:
- 'v**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
pull_request:
jobs:
docker:
# Ensure this job never runs on forked repos. It's only executed for 'snipe/snipe-it'
if: github.repository == 'snipe/snipe-it'
runs-on: ubuntu-latest
env:
# Define tags to use for Docker images based on Git tags/branches (for docker/metadata-action)
# For a new commit on default branch (master), use the literal tag 'latest' on Docker image.
# For a new commit on other branches, use the branch name as the tag for Docker image.
# For a new tag, copy that tag name as the tag for Docker image.
IMAGE_TAGS: |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }}
type=ref,event=tag
# Define default tag "flavor" for docker/metadata-action per
# https://github.com/docker/metadata-action#flavor-input
# We turn off 'latest' tag by default.
TAGS_FLAVOR: |
latest=false
steps:
# https://github.com/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v2
# https://github.com/docker/setup-buildx-action
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
# https://github.com/docker/login-action
- name: Login to DockerHub
# Only login if not a PR, as PRs only trigger a Docker build and not a push
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
###############################################
# Build/Push the 'snipe/snipe-it' image
###############################################
# https://github.com/docker/metadata-action
# Get Metadata for docker_build step below
- name: Sync metadata (tags, labels) from GitHub to Docker for 'snipe-it' image
id: meta_build
uses: docker/metadata-action@v3
with:
images: snipe/snipe-it
tags: ${{ env.IMAGE_TAGS }}
flavor: ${{ env.TAGS_FLAVOR }}
# https://github.com/docker/build-push-action
- name: Build and push 'snipe-it' image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
# but we ONLY do an image push to DockerHub if it's NOT a PR
push: ${{ github.event_name != 'pull_request' }}
# Use tags / labels provided by 'docker/metadata-action' above
tags: ${{ steps.meta_build.outputs.tags }}
labels: ${{ steps.meta_build.outputs.labels }}

6
.gitignore vendored
View File

@@ -48,10 +48,12 @@ tests/_support/_generated/*
/npm-debug.log
/storage/oauth-private.key
/storage/oauth-public.key
logs/*
*.cache
.vagrant
*.log
*.retry
\.php_cs\.dist
@@ -61,3 +63,5 @@ _ide_helper.php
.phpstorm.meta.php
_ide_helper_models.php
/.phplint-cache
storage/ldap_client_tls.cert
storage/ldap_client_tls.key

View File

@@ -5,7 +5,15 @@
# Make sure .env files not not browseable if in a sub-directory.
<FilesMatch "\.env$">
Deny from all
# Apache 2.2
<IfModule !authz_core_module>
Deny from all
</IfModule>
# Apache 2.4+
<IfModule authz_core_module>
Require all denied
</IfModule>
</FilesMatch>
</IfModule>

View File

@@ -1,5 +1,9 @@
FROM ubuntu:bionic
LABEL maintainer Brady Wetherington <uberbrady@gmail.com>
FROM ubuntu:focal
LABEL maintainer Brady Wetherington <bwetherington@grokability.com>
# No need to add `apt-get clean` here, reference:
# - https://github.com/snipe/snipe-it/pull/9201
# - https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get
RUN export DEBIAN_FRONTEND=noninteractive; \
export DEBCONF_NONINTERACTIVE_SEEN=true; \
@@ -10,15 +14,15 @@ RUN export DEBIAN_FRONTEND=noninteractive; \
apt-utils \
apache2 \
apache2-bin \
libapache2-mod-php7.2 \
php7.2-curl \
php7.2-ldap \
php7.2-mysql \
php7.2-gd \
php7.2-xml \
php7.2-mbstring \
php7.2-zip \
php7.2-bcmath \
libapache2-mod-php7.4 \
php7.4-curl \
php7.4-ldap \
php7.4-mysql \
php7.4-gd \
php7.4-xml \
php7.4-mbstring \
php7.4-zip \
php7.4-bcmath \
patch \
curl \
wget \
@@ -34,26 +38,25 @@ autoconf \
libc-dev \
pkg-config \
libmcrypt-dev \
php7.2-dev \
php7.4-dev \
ca-certificates \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN curl -L -O https://github.com/pear/pearweb_phars/raw/master/go-pear.phar
RUN php go-pear.phar
RUN pecl install mcrypt-1.0.2
RUN pecl install mcrypt-1.0.3
RUN bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/mods-available/mcrypt.ini"
RUN bash -c "echo extension=/usr/lib/php/20190902/mcrypt.so > /etc/php/7.4/mods-available/mcrypt.ini"
RUN phpenmod mcrypt
RUN phpenmod gd
RUN phpenmod bcmath
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.2/apache2/php.ini
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.2/cli/php.ini
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.4/apache2/php.ini
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/7.4/cli/php.ini
RUN useradd -m --uid 1000 --gid 50 docker
@@ -74,6 +77,8 @@ COPY . /var/www/html
RUN a2enmod rewrite
COPY docker/column-statistics.cnf /etc/mysql/conf.d/column-statistics.cnf
############ INITIAL APPLICATION SETUP #####################
WORKDIR /var/www/html
@@ -93,7 +98,10 @@ RUN \
&& rm -r "/var/www/html/storage/app/backups" && ln -fs "/var/lib/snipeit/dumps" "/var/www/html/storage/app/backups" \
&& mkdir -p "/var/lib/snipeit/keys" && ln -fs "/var/lib/snipeit/keys/oauth-private.key" "/var/www/html/storage/oauth-private.key" \
&& ln -fs "/var/lib/snipeit/keys/oauth-public.key" "/var/www/html/storage/oauth-public.key" \
&& ln -fs "/var/lib/snipeit/keys/ldap_client_tls.cert" "/var/www/html/storage/ldap_client_tls.cert" \
&& ln -fs "/var/lib/snipeit/keys/ldap_client_tls.key" "/var/www/html/storage/ldap_client_tls.key" \
&& chown docker "/var/lib/snipeit/keys/" \
&& chown -h docker "/var/www/html/storage/" \
&& chmod +x /var/www/html/artisan \
&& echo "Finished setting up application in /var/www/html"

View File

@@ -1,6 +1,6 @@
FROM alpine:3.8
FROM alpine:3
# Apache + PHP
RUN apk add --update --no-cache \
RUN apk add --no-cache \
apache2 \
php7 \
php7-common \
@@ -23,6 +23,8 @@ RUN apk add --update --no-cache \
php7-fileinfo \
php7-simplexml \
php7-session \
php7-dom \
php7-xmlwriter \
curl \
wget \
vim \
@@ -30,6 +32,8 @@ RUN apk add --update --no-cache \
mysql-client \
tini
COPY docker/column-statistics.cnf /etc/mysql/conf.d/column-statistics.cnf
# Where apache's PID lives
RUN mkdir -p /run/apache2 && chown apache:apache /run/apache2
@@ -55,6 +59,7 @@ RUN \
&& mkdir -p "/var/lib/snipeit/dumps" && rm -r "/var/www/html/storage/app/backups" && ln -fs "/var/lib/snipeit/dumps" "/var/www/html/storage/app/backups" \
&& mkdir -p "/var/lib/snipeit/keys" && ln -fs "/var/lib/snipeit/keys/oauth-private.key" "/var/www/html/storage/oauth-private.key" \
&& ln -fs "/var/lib/snipeit/keys/oauth-public.key" "/var/www/html/storage/oauth-public.key" \
&& chown -hR apache "/var/www/html/storage/" \
&& chown -R apache "/var/lib/snipeit"
# Install composer

103
Dockerfile.fpm-alpine Normal file
View File

@@ -0,0 +1,103 @@
ARG ENVIRONMENT=production
ARG SNIPEIT_RELEASE=5.1.3
ARG PHP_VERSION=7.4.16
ARG PHP_ALPINE_VERSION=3.13
ARG COMPOSER_VERSION=2.0.11
# Cannot use arguments with 'COPY --from' workaround
# https://github.com/moby/moby/issues/34482#issuecomment-454716952
FROM composer:${COMPOSER_VERSION} AS composer
# Final stage
FROM php:${PHP_VERSION}-fpm-alpine${PHP_ALPINE_VERSION} AS source
LABEL maintainer="Mateus Villar <mromeravillar@gmail.com>"
ARG PACKAGES="\
mysql-client \
"
ARG DEV_PACKAGES="\
git \
"
ARG ENVIRONMENT
ENV ENVIRONMENT ${ENVIRONMENT}
ARG SNIPEIT_RELEASE
ENV SNIPEIT_RELEASE ${SNIPEIT_RELEASE}
# Cribbed from wordpress-fpm-alpine image
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN set -eux; \
docker-php-ext-enable opcache; \
{ \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging
RUN { \
# https://www.php.net/manual/en/errorfunc.constants.php
# https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'log_errors = On'; \
echo 'error_log = /dev/stderr'; \
echo 'log_errors_max_len = 1024'; \
echo 'ignore_repeated_errors = On'; \
echo 'ignore_repeated_source = Off'; \
echo 'html_errors = Off'; \
} > /usr/local/etc/php/conf.d/error-logging.ini
# Install php extensions inside docker containers easily
# https://github.com/mlocati/docker-php-extension-installer
COPY --from=mlocati/php-extension-installer:1.2.19 /usr/bin/install-php-extensions /usr/local/bin/
RUN set -eux; \
install-php-extensions \
bcmath \
gd \
ldap \
mysqli \
pdo_mysql \
zip; \
rm -f /usr/local/bin/install-php-extensions; \
# Install prerequisites packages
apk add --no-cache \
${PACKAGES};
COPY --from=composer /usr/bin/composer /usr/local/bin
ARG COMPOSER_ALLOW_SUPERUSER=1
RUN set -eux; \
# Download and extract snipeit tarball
curl -o snipeit.tar.gz -fL "https://github.com/snipe/snipe-it/archive/v$SNIPEIT_RELEASE.tar.gz"; \
tar -xzf snipeit.tar.gz --strip-components=1 -C /var/www/html/; \
rm snipeit.tar.gz; \
# Install composer php dependencies
if [ "$ENVIRONMENT" = "production" ]; then \
echo "production enviroment detected!"; \
composer update \
--no-cache \
--no-dev \
--optimize-autoloader \
--working-dir=/var/www/html; \
else \
echo "development enviroment detected!"; \
apk add --no-cache \
${DEV_PACKAGES}; \
composer update \
--no-cache \
--prefer-source \
--optimize-autoloader \
--working-dir=/var/www/html; \
fi; \
rm -f /usr/local/bin/composer; \
chown -R www-data:www-data /var/www/html;
VOLUME [ "/var/lib/snipeit" ]
COPY --chown=www-data:www-data docker/docker-secrets.env /var/www/html/.env
COPY --chmod=655 docker/docker-entrypoint.sh /usr/local/bin/docker-snipeit-entrypoint
COPY docker/column-statistics.cnf /etc/mysql/conf.d/column-statistics.cnf
ENTRYPOINT [ "/usr/local/bin/docker-snipeit-entrypoint" ]
CMD [ "/usr/local/bin/docker-php-entrypoint", "php-fpm" ]

1
Procfile Normal file
View File

@@ -0,0 +1 @@
web: php heroku/startup.php && heroku-php-apache2 public/

View File

@@ -1,5 +1,5 @@
![Build Status](https://app.chipperci.com/projects/0e5f8979-31eb-4ee6-9abf-050b76ab0383/status/master) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Twitter Follow](https://img.shields.io/twitter/follow/snipeitapp.svg?style=social)](https://twitter.com/snipeitapp) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=snipe/snipe-it&amp;utm_campaign=Badge_Grade)
[![All Contributors](https://img.shields.io/badge/all_contributors-214-orange.svg?style=flat-square)](#contributors)
![Build Status](https://app.chipperci.com/projects/0e5f8979-31eb-4ee6-9abf-050b76ab0383/status/master) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Twitter Follow](https://img.shields.io/twitter/follow/snipeitapp.svg?style=social)](https://twitter.com/snipeitapp) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=snipe/snipe-it&amp;utm_campaign=Badge_Grade)
[![All Contributors](https://img.shields.io/badge/all_contributors-280-orange.svg?style=flat-square)](#contributors) [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/yZFtShAcKk) [![huntr](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev)
## Snipe-IT - Open Source Asset Management System
@@ -19,6 +19,8 @@ For instructions on installing and configuring Snipe-IT on your server, check ou
If you're having trouble with the installation, please check the [Common Issues](https://snipe-it.readme.io/docs/common-issues) and [Getting Help](https://snipe-it.readme.io/docs/getting-help) documentation, and search this repository's open *and* closed issues for help.
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
-----
### User's Manual
For help using Snipe-IT, check out the [user's manual](https://snipe-it.readme.io/docs/overview).
@@ -55,11 +57,11 @@ Since the release of the JSON REST API, several third-party developers have been
- [Python Module](https://github.com/jbloomer/SnipeIT-PythonAPI) by [@jbloomer](https://github.com/jbloomer)
- [SnipeSharp - .NET module in C#](https://github.com/barrycarey/SnipeSharp) by [@barrycarey](https://github.com/barrycarey)
- [InQRy](https://github.com/Microsoft/InQRy) by [@Microsoft](https://github.com/Microsoft)
- [InQRy -unmaintained-](https://github.com/Microsoft/InQRy) by [@Microsoft](https://github.com/Microsoft)
- [SnipeitPS](https://github.com/snazy2000/SnipeitPS) by [@snazy2000](https://github.com/snazy2000) - Powershell API Wrapper for Snipe-it
- [jamf2snipe](https://github.com/ParadoxGuitarist/jamf2snipe) by [@ParadoxGuitarist](https://github.com/ParadoxGuitarist) - Python script to sync assets between a JAMFPro instance and a Snipe-IT instance
- [Marksman](https://github.com/Scope-IT/marksman) - A Windows agent for Snipe-IT
- [Snipe-IT plugin for Jira Service Desk (beta)](https://marketplace.atlassian.com/apps/1220379/snipe-it-for-jira-service-desk-beta?hosting=cloud&tab=overview) - for the upcoming Snipe-IT v5 only
- [Snipe-IT plugin for Jira Service Desk](https://marketplace.atlassian.com/apps/1220964/snipe-it-for-jira)
- [Python 3 CSV importer](https://github.com/gastamper/snipeit-csvimporter) - allows importing assets into Snipe-IT based on Item Name rather than Asset Tag.
- [Snipe-IT Kubernetes Helm Chart](https://github.com/t3n/helm-charts/tree/master/snipeit) - For more information, [click here](https://hub.helm.sh/charts/t3n/snipeit).
- [Snipe-IT Bulk Edit](https://github.com/bricelabelle/snipe-it-bulkedit) - Google Script files to use Google Sheets as a bulk checkout/checkin/edit tool for Snipe-it.
@@ -90,7 +92,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
| [<img src="https://avatars3.githubusercontent.com/u/197404?v=3" width="110px;"/><br /><sub>snipe</sub>](http://www.snipe.net)<br />[💻](https://github.com/snipe/snipe-it/commits?author=snipe "Code") [🚇](#infra-snipe "Infrastructure (Hosting, Build-Tools, etc)") [📖](https://github.com/snipe/snipe-it/commits?author=snipe "Documentation") [⚠️](https://github.com/snipe/snipe-it/commits?author=snipe "Tests") [🐛](https://github.com/snipe/snipe-it/issues?q=author%3Asnipe "Bug reports") [🎨](#design-snipe "Design") [👀](#review-snipe "Reviewed Pull Requests") | [<img src="https://avatars0.githubusercontent.com/u/36335?v=3" width="110px;"/><br /><sub>Brady Wetherington</sub>](http://www.uberbrady.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=uberbrady "Code") [📖](https://github.com/snipe/snipe-it/commits?author=uberbrady "Documentation") [🚇](#infra-uberbrady "Infrastructure (Hosting, Build-Tools, etc)") [👀](#review-uberbrady "Reviewed Pull Requests") | [<img src="https://avatars0.githubusercontent.com/u/3803132?v=3" width="110px;"/><br /><sub>Daniel Meltzer</sub>](https://github.com/dmeltzer)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dmeltzer "Code") [⚠️](https://github.com/snipe/snipe-it/commits?author=dmeltzer "Tests") [📖](https://github.com/snipe/snipe-it/commits?author=dmeltzer "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/1609106?v=3" width="110px;"/><br /><sub>Michael T</sub>](http://www.tuckertechonline.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=mtucker6784 "Code") | [<img src="https://avatars2.githubusercontent.com/u/3274937?v=3" width="110px;"/><br /><sub>madd15</sub>](https://github.com/madd15)<br />[📖](https://github.com/snipe/snipe-it/commits?author=madd15 "Documentation") [💬](#question-madd15 "Answering Questions") | [<img src="https://avatars2.githubusercontent.com/u/894126?v=3" width="110px;"/><br /><sub>Vincent Sposato</sub>](https://github.com/vsposato)<br />[💻](https://github.com/snipe/snipe-it/commits?author=vsposato "Code") | [<img src="https://avatars0.githubusercontent.com/u/1639757?v=3" width="110px;"/><br /><sub>Andrea Bergamasco</sub>](https://github.com/vjandrea)<br />[💻](https://github.com/snipe/snipe-it/commits?author=vjandrea "Code") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [<img src="https://avatars0.githubusercontent.com/u/10640152?v=3" width="110px;"/><br /><sub>Karol</sub>](https://github.com/kpawelski)<br />[🌍](#translation-kpawelski "Translation") [💻](https://github.com/snipe/snipe-it/commits?author=kpawelski "Code") | [<img src="https://avatars3.githubusercontent.com/u/600106?v=3" width="110px;"/><br /><sub>morph027</sub>](http://blog.morph027.de/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=morph027 "Code") | [<img src="https://avatars3.githubusercontent.com/u/22935755?v=3" width="110px;"/><br /><sub>fvleminckx</sub>](https://github.com/fvleminckx)<br />[🚇](#infra-fvleminckx "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars2.githubusercontent.com/u/15633547?v=3" width="110px;"/><br /><sub>itsupportcmsukorg</sub>](https://github.com/itsupportcmsukorg)<br />[💻](https://github.com/snipe/snipe-it/commits?author=itsupportcmsukorg "Code") [🐛](https://github.com/snipe/snipe-it/issues?q=author%3Aitsupportcmsukorg "Bug reports") | [<img src="https://avatars3.githubusercontent.com/u/12373799?v=3" width="110px;"/><br /><sub>Frank</sub>](https://override.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=base-zero "Code") | [<img src="https://avatars0.githubusercontent.com/u/10137?v=3" width="110px;"/><br /><sub>Deleted user</sub>](https://github.com/ghost)<br />[🌍](#translation-ghost "Translation") | [<img src="https://avatars1.githubusercontent.com/u/10802313?v=3" width="110px;"/><br /><sub>tiagom62</sub>](https://github.com/tiagom62)<br />[💻](https://github.com/snipe/snipe-it/commits?author=tiagom62 "Code") [🚇](#infra-tiagom62 "Infrastructure (Hosting, Build-Tools, etc)") |
| [<img src="https://avatars0.githubusercontent.com/u/10640152?v=3" width="110px;"/><br /><sub>Karol</sub>](https://github.com/kpawelski)<br />[🌍](#translation-kpawelski "Translation") [💻](https://github.com/snipe/snipe-it/commits?author=kpawelski "Code") | [<img src="https://avatars3.githubusercontent.com/u/600106?v=3" width="110px;"/><br /><sub>morph027</sub>](http://blog.morph027.de/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=morph027 "Code") | [<img src="https://avatars3.githubusercontent.com/u/22935755?v=3" width="110px;"/><br /><sub>fvleminckx</sub>](https://github.com/fvleminckx)<br />[🚇](#infra-fvleminckx "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars2.githubusercontent.com/u/15633547?v=3" width="110px;"/><br /><sub>itsupportcmsukorg</sub>](https://github.com/itsupportcmsukorg)<br />[💻](https://github.com/snipe/snipe-it/commits?author=itsupportcmsukorg "Code") [🐛](https://github.com/snipe/snipe-it/issues?q=author%3Aitsupportcmsukorg "Bug reports") | [<img src="https://avatars3.githubusercontent.com/u/12373799?v=3" width="110px;"/><br /><sub>Frank</sub>](https://override.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=base-zero "Code") | [<img src="https://avatars0.githubusercontent.com/u/10137?v=3" width="110px;"/><br /><sub>Deleted user</sub>](https://github.com/ghost)<br />[🌍](#translation-ghost "Translation") [💻](https://github.com/snipe/snipe-it/commits?author=ghost "Code") | [<img src="https://avatars1.githubusercontent.com/u/10802313?v=3" width="110px;"/><br /><sub>tiagom62</sub>](https://github.com/tiagom62)<br />[💻](https://github.com/snipe/snipe-it/commits?author=tiagom62 "Code") [🚇](#infra-tiagom62 "Infrastructure (Hosting, Build-Tools, etc)") |
| [<img src="https://avatars3.githubusercontent.com/u/2389047?v=3" width="110px;"/><br /><sub>Ryan Stafford</sub>](https://github.com/rystaf)<br />[💻](https://github.com/snipe/snipe-it/commits?author=rystaf "Code") | [<img src="https://avatars2.githubusercontent.com/u/10345935?v=3" width="110px;"/><br /><sub>Eammon Hanlon</sub>](https://github.com/ehanlon)<br />[💻](https://github.com/snipe/snipe-it/commits?author=ehanlon "Code") | [<img src="https://avatars0.githubusercontent.com/u/441924?v=3" width="110px;"/><br /><sub>zjean</sub>](https://github.com/zjean)<br />[💻](https://github.com/snipe/snipe-it/commits?author=zjean "Code") | [<img src="https://avatars0.githubusercontent.com/u/12660103?v=3" width="110px;"/><br /><sub>Matthias Frei</sub>](http://www.frei.media)<br />[💻](https://github.com/snipe/snipe-it/commits?author=FREImedia "Code") | [<img src="https://avatars0.githubusercontent.com/u/3767518?v=3" width="110px;"/><br /><sub>opsydev</sub>](https://github.com/opsydev)<br />[💻](https://github.com/snipe/snipe-it/commits?author=opsydev "Code") | [<img src="https://avatars1.githubusercontent.com/u/82290?v=3" width="110px;"/><br /><sub>Daniel Dreier</sub>](http://www.ddreier.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=ddreier "Code") | [<img src="https://avatars0.githubusercontent.com/u/23448?v=3" width="110px;"/><br /><sub>Nikolai Prokoschenko</sub>](http://rassie.org)<br />[💻](https://github.com/snipe/snipe-it/commits?author=rassie "Code") |
| [<img src="https://avatars0.githubusercontent.com/u/13452757?v=3" width="110px;"/><br /><sub>Drew</sub>](https://github.com/YetAnotherCodeMonkey)<br />[💻](https://github.com/snipe/snipe-it/commits?author=YetAnotherCodeMonkey "Code") | [<img src="https://avatars0.githubusercontent.com/u/1342320?v=3" width="110px;"/><br /><sub>Walter</sub>](https://github.com/merid14)<br />[💻](https://github.com/snipe/snipe-it/commits?author=merid14 "Code") | [<img src="https://avatars3.githubusercontent.com/u/11254614?v=3" width="110px;"/><br /><sub>Petr Baloun</sub>](https://github.com/balous)<br />[💻](https://github.com/snipe/snipe-it/commits?author=balous "Code") | [<img src="https://avatars0.githubusercontent.com/u/6117660?v=3" width="110px;"/><br /><sub>reidblomquist</sub>](https://github.com/reidblomquist)<br />[📖](https://github.com/snipe/snipe-it/commits?author=reidblomquist "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/539914?v=3" width="110px;"/><br /><sub>Mathieu Kooiman</sub>](https://github.com/mathieuk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=mathieuk "Code") | [<img src="https://avatars3.githubusercontent.com/u/6606421?v=3" width="110px;"/><br /><sub>csayre</sub>](https://github.com/csayre)<br />[📖](https://github.com/snipe/snipe-it/commits?author=csayre "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/768488?v=3" width="110px;"/><br /><sub>Adam Dunson</sub>](https://github.com/adamdunson)<br />[💻](https://github.com/snipe/snipe-it/commits?author=adamdunson "Code") |
| [<img src="https://avatars0.githubusercontent.com/u/5547470?v=3" width="110px;"/><br /><sub>Hereward</sub>](https://github.com/thehereward)<br />[💻](https://github.com/snipe/snipe-it/commits?author=thehereward "Code") | [<img src="https://avatars0.githubusercontent.com/u/5802977?v=3" width="110px;"/><br /><sub>swoopdk</sub>](https://github.com/swoopdk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=swoopdk "Code") | [<img src="https://avatars1.githubusercontent.com/u/3470403?v=3" width="110px;"/><br /><sub>Abdullah Alansari</sub>](https://linkedin.com/in/ahimta)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Ahimta "Code") | [<img src="https://avatars0.githubusercontent.com/u/796443?v=3" width="110px;"/><br /><sub>Micael Rodrigues</sub>](https://github.com/MicaelRodrigues)<br />[💻](https://github.com/snipe/snipe-it/commits?author=MicaelRodrigues "Code") | [<img src="https://avatars0.githubusercontent.com/u/614564?v=3" width="110px;"/><br /><sub>Patrick Gallagher</sub>](http://macadmincorner.com)<br />[📖](https://github.com/snipe/snipe-it/commits?author=patgmac "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/7165922?v=3" width="110px;"/><br /><sub>Miliamber</sub>](https://github.com/Miliamber)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Miliamber "Code") | [<img src="https://avatars3.githubusercontent.com/u/861766?v=3" width="110px;"/><br /><sub>hawk554</sub>](https://github.com/hawk554)<br />[💻](https://github.com/snipe/snipe-it/commits?author=hawk554 "Code") |
@@ -119,7 +121,16 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
| [<img src="https://avatars0.githubusercontent.com/u/6609453?v=4" width="110px;"/><br /><sub>Sxderp</sub>](https://github.com/Sxderp)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Sxderp "Code") | [<img src="https://avatars1.githubusercontent.com/u/4807843?v=4" width="110px;"/><br /><sub>fanta8897</sub>](https://github.com/fanta8897)<br />[💻](https://github.com/snipe/snipe-it/commits?author=fanta8897 "Code") | [<img src="https://avatars2.githubusercontent.com/u/2576509?v=4" width="110px;"/><br /><sub>Andrey Bolonin</sub>](https://andreybolonin.com/phpconsulting/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=andreybolonin "Code") | [<img src="https://avatars3.githubusercontent.com/u/2173307?v=4" width="110px;"/><br /><sub>shinayoshi</sub>](http://www.shinayoshi.net/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=shinayoshi "Code") | [<img src="https://avatars3.githubusercontent.com/u/2130159?v=4" width="110px;"/><br /><sub>Hubert</sub>](https://github.com/reuser)<br />[💻](https://github.com/snipe/snipe-it/commits?author=reuser "Code") | [<img src="https://avatars0.githubusercontent.com/u/6865789?v=4" width="110px;"/><br /><sub>KeenRivals</sub>](https://brashear.me)<br />[💻](https://github.com/snipe/snipe-it/commits?author=KeenRivals "Code") | [<img src="https://avatars3.githubusercontent.com/u/2902513?v=4" width="110px;"/><br /><sub>omyno</sub>](https://github.com/omyno)<br />[💻](https://github.com/snipe/snipe-it/commits?author=omyno "Code") |
| [<img src="https://avatars1.githubusercontent.com/u/6271335?v=4" width="110px;"/><br /><sub>Evgeny</sub>](https://github.com/jackka)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jackka "Code") | [<img src="https://avatars2.githubusercontent.com/u/1169963?v=4" width="110px;"/><br /><sub>Colin Campbell</sub>](https://digitalist.se)<br />[💻](https://github.com/snipe/snipe-it/commits?author=colin-campbell "Code") | [<img src="https://avatars3.githubusercontent.com/u/2872098?v=4" width="110px;"/><br /><sub>Ľubomír Kučera</sub>](https://github.com/lubo)<br />[💻](https://github.com/snipe/snipe-it/commits?author=lubo "Code") | [<img src="https://avatars3.githubusercontent.com/u/570639?v=4" width="110px;"/><br /><sub>Martin Meredith</sub>](https://www.sourceguru.net)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Mezzle "Code") | [<img src="https://avatars1.githubusercontent.com/u/7632599?v=4" width="110px;"/><br /><sub>Tim Farmer</sub>](https://github.com/timothyfarmer)<br />[💻](https://github.com/snipe/snipe-it/commits?author=timothyfarmer "Code") | [<img src="https://avatars0.githubusercontent.com/u/17459600?v=4" width="110px;"/><br /><sub>Marián Skrip</sub>](https://github.com/mskrip)<br />[💻](https://github.com/snipe/snipe-it/commits?author=mskrip "Code") | [<img src="https://avatars2.githubusercontent.com/u/47435081?v=4" width="110px;"/><br /><sub>Godfrey Martinez</sub>](https://github.com/Godmartinz)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Godmartinz "Code") |
| [<img src="https://avatars1.githubusercontent.com/u/2075128?v=4" width="110px;"/><br /><sub>bigtreeEdo</sub>](https://github.com/bigtreeEdo)<br />[💻](https://github.com/snipe/snipe-it/commits?author=bigtreeEdo "Code") | [<img src="https://avatars0.githubusercontent.com/u/5000430?v=4" width="110px;"/><br /><sub>Colin McNeil</sub>](https://colinmcneil.me/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=ColinMcNeil "Code") | [<img src="https://avatars0.githubusercontent.com/u/421625?v=4" width="110px;"/><br /><sub>JoKneeMo</sub>](https://github.com/JoKneeMo)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JoKneeMo "Code") | [<img src="https://avatars0.githubusercontent.com/u/54849013?v=4" width="110px;"/><br /><sub>Joshi</sub>](http://www.redbridge.se)<br />[💻](https://github.com/snipe/snipe-it/commits?author=joshi-redbridge "Code") | [<img src="https://avatars2.githubusercontent.com/u/15731458?v=4" width="110px;"/><br /><sub>Anthony Burns</sub>](https://github.com/anthonypburns)<br />[💻](https://github.com/snipe/snipe-it/commits?author=anthonypburns "Code") | [<img src="https://avatars1.githubusercontent.com/u/63399474?v=4" width="110px;"/><br /><sub>johnson-yi</sub>](https://github.com/johnson-yi)<br />[💻](https://github.com/snipe/snipe-it/commits?author=johnson-yi "Code") | [<img src="https://avatars1.githubusercontent.com/u/1862720?v=4" width="110px;"/><br /><sub>Sanjay Govind</sub>](https://tangentmc.net)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sanjay900 "Code") |
| [<img src="https://avatars0.githubusercontent.com/u/1255375?v=4" width="110px;"/><br /><sub>Peter Upfold</sub>](https://peter.upfold.org.uk/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=PeterUpfold "Code") | [<img src="https://avatars2.githubusercontent.com/u/961717?v=4" width="110px;"/><br /><sub>Jared Biel</sub>](https://github.com/jbiel)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jbiel "Code") | [<img src="https://avatars1.githubusercontent.com/u/1733625?v=4" width="110px;"/><br /><sub>Dampfklon</sub>](https://github.com/dampfklon)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dampfklon "Code") | [<img src="https://avatars2.githubusercontent.com/u/52973156?v=4" width="110px;"/><br /><sub>Charles Hamilton</sub>](https://communityclosing.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=chamilton-ccn "Code") |
| [<img src="https://avatars0.githubusercontent.com/u/1255375?v=4" width="110px;"/><br /><sub>Peter Upfold</sub>](https://peter.upfold.org.uk/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=PeterUpfold "Code") | [<img src="https://avatars2.githubusercontent.com/u/961717?v=4" width="110px;"/><br /><sub>Jared Biel</sub>](https://github.com/jbiel)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jbiel "Code") | [<img src="https://avatars1.githubusercontent.com/u/1733625?v=4" width="110px;"/><br /><sub>Dampfklon</sub>](https://github.com/dampfklon)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dampfklon "Code") | [<img src="https://avatars2.githubusercontent.com/u/52973156?v=4" width="110px;"/><br /><sub>Charles Hamilton</sub>](https://communityclosing.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=chamilton-ccn "Code") | [<img src="https://avatars.githubusercontent.com/u/551789?v=4" width="110px;"/><br /><sub>Giuseppe Iannello</sub>](https://github.com/giannello)<br />[💻](https://github.com/snipe/snipe-it/commits?author=giannello "Code") | [<img src="https://avatars.githubusercontent.com/u/3691490?v=4" width="110px;"/><br /><sub>Peter Dave Hello</sub>](https://www.peterdavehello.org/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=PeterDaveHello "Code") | [<img src="https://avatars.githubusercontent.com/u/6106332?v=4" width="110px;"/><br /><sub>sigmoidal</sub>](https://github.com/sigmoidal)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sigmoidal "Code") |
| [<img src="https://avatars.githubusercontent.com/u/2082554?v=4" width="110px;"/><br /><sub>Vincent Lainé</sub>](https://github.com/phenixdotnet)<br />[💻](https://github.com/snipe/snipe-it/commits?author=phenixdotnet "Code") | [<img src="https://avatars.githubusercontent.com/u/1943040?v=4" width="110px;"/><br /><sub>Lucas Pleß</sub>](http://www.lucas-pless.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=derlucas "Code") | [<img src="https://avatars.githubusercontent.com/u/472804?v=4" width="110px;"/><br /><sub>Ian Littman</sub>](http://twitter.com/iansltx)<br />[💻](https://github.com/snipe/snipe-it/commits?author=iansltx "Code") | [<img src="https://avatars.githubusercontent.com/u/3519029?v=4" width="110px;"/><br /><sub>João Paulo</sub>](https://github.com/PauloLuna)<br />[💻](https://github.com/snipe/snipe-it/commits?author=PauloLuna "Code") | [<img src="https://avatars.githubusercontent.com/u/70443365?v=4" width="110px;"/><br /><sub>ThoBur</sub>](https://github.com/ThoBur)<br />[💻](https://github.com/snipe/snipe-it/commits?author=ThoBur "Code") | [<img src="https://avatars.githubusercontent.com/u/1972329?v=4" width="110px;"/><br /><sub>Alexander Chibrikin</sub>](http://phpprofi.ru/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=alek13 "Code") | [<img src="https://avatars.githubusercontent.com/u/438332?v=4" width="110px;"/><br /><sub>Anthony Winstanley</sub>](https://github.com/winstan)<br />[💻](https://github.com/snipe/snipe-it/commits?author=winstan "Code") |
| [<img src="https://avatars.githubusercontent.com/u/3075214?v=4" width="110px;"/><br /><sub>Folke</sub>](https://github.com/fashberg)<br />[💻](https://github.com/snipe/snipe-it/commits?author=fashberg "Code") | [<img src="https://avatars.githubusercontent.com/u/1351571?v=4" width="110px;"/><br /><sub>Bennett Blodinger</sub>](https://github.com/benwa)<br />[💻](https://github.com/snipe/snipe-it/commits?author=benwa "Code") | [<img src="https://avatars.githubusercontent.com/u/2974631?v=4" width="110px;"/><br /><sub>NMC</sub>](https://nmc.dev)<br />[💻](https://github.com/snipe/snipe-it/commits?author=ncareau "Code") | [<img src="https://avatars.githubusercontent.com/u/52182449?v=4" width="110px;"/><br /><sub>andres-baller</sub>](https://github.com/andres-baller)<br />[💻](https://github.com/snipe/snipe-it/commits?author=andres-baller "Code") | [<img src="https://avatars.githubusercontent.com/u/67109348?v=4" width="110px;"/><br /><sub>sean-borg</sub>](https://github.com/sean-borg)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sean-borg "Code") | [<img src="https://avatars.githubusercontent.com/u/32170051?v=4" width="110px;"/><br /><sub>EDVLeer</sub>](https://github.com/EDVLeer)<br />[💻](https://github.com/snipe/snipe-it/commits?author=EDVLeer "Code") | [<img src="https://avatars.githubusercontent.com/u/23075196?v=4" width="110px;"/><br /><sub>Kurokat</sub>](https://github.com/Kurokat)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Kurokat "Code") |
| [<img src="https://avatars.githubusercontent.com/u/915514?v=4" width="110px;"/><br /><sub>Kevin Köllmann</sub>](https://www.kevinkoellmann.de)<br />[💻](https://github.com/snipe/snipe-it/commits?author=koelle25 "Code") | [<img src="https://avatars.githubusercontent.com/u/49025941?v=4" width="110px;"/><br /><sub>sw-mreyes</sub>](https://github.com/sw-mreyes)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sw-mreyes "Code") | [<img src="https://avatars.githubusercontent.com/u/70129?v=4" width="110px;"/><br /><sub>Joel Pittet</sub>](https://pittet.ca)<br />[💻](https://github.com/snipe/snipe-it/commits?author=joelpittet "Code") | [<img src="https://avatars.githubusercontent.com/u/792695?v=4" width="110px;"/><br /><sub>Eli Young</sub>](https://elyscape.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=elyscape "Code") | [<img src="https://avatars.githubusercontent.com/u/317015?v=4" width="110px;"/><br /><sub>Raell Dottin</sub>](https://github.com/raelldottin)<br />[💻](https://github.com/snipe/snipe-it/commits?author=raelldottin "Code") | [<img src="https://avatars.githubusercontent.com/u/1446856?v=4" width="110px;"/><br /><sub>Tom Misilo</sub>](https://github.com/misilot)<br />[💻](https://github.com/snipe/snipe-it/commits?author=misilot "Code") | [<img src="https://avatars.githubusercontent.com/u/4496300?v=4" width="110px;"/><br /><sub>David Davenne</sub>](http://david.davenne.be)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JuustoMestari "Code") |
| [<img src="https://avatars.githubusercontent.com/u/9255772?v=4" width="110px;"/><br /><sub>Mark Stenglein</sub>](https://markstenglein.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=ocelotsloth "Code") | [<img src="https://avatars.githubusercontent.com/u/35658596?v=4" width="110px;"/><br /><sub>ajsy</sub>](https://github.com/ajsy)<br />[💻](https://github.com/snipe/snipe-it/commits?author=ajsy "Code") | [<img src="https://avatars.githubusercontent.com/u/3628035?v=4" width="110px;"/><br /><sub>Jan Kiesewetter</sub>](https://github.com/t3easy)<br />[💻](https://github.com/snipe/snipe-it/commits?author=t3easy "Code") | [<img src="https://avatars.githubusercontent.com/u/79449630?v=4" width="110px;"/><br /><sub>Tetrachloromethane250</sub>](https://github.com/Tetrachloromethane250)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Tetrachloromethane250 "Code") | [<img src="https://avatars.githubusercontent.com/u/22004482?v=4" width="110px;"/><br /><sub>Lars Kajes</sub>](https://www.kajes.se/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=kajes "Code") | [<img src="https://avatars.githubusercontent.com/u/13993216?v=4" width="110px;"/><br /><sub>Joly0</sub>](https://github.com/Joly0)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Joly0 "Code") | [<img src="https://avatars.githubusercontent.com/u/1501022?v=4" width="110px;"/><br /><sub>theburger</sub>](https://github.com/limeless)<br />[💻](https://github.com/snipe/snipe-it/commits?author=limeless "Code") |
| [<img src="https://avatars.githubusercontent.com/u/36065681?v=4" width="110px;"/><br /><sub>David Valin Alonso</sub>](https://github.com/deivishome)<br />[💻](https://github.com/snipe/snipe-it/commits?author=deivishome "Code") | [<img src="https://avatars.githubusercontent.com/u/8290389?v=4" width="110px;"/><br /><sub>andreaci</sub>](https://github.com/andreaci)<br />[💻](https://github.com/snipe/snipe-it/commits?author=andreaci "Code") | [<img src="https://avatars.githubusercontent.com/u/1828542?v=4" width="110px;"/><br /><sub>Jelle Sebreghts</sub>](http://www.jellesebreghts.be)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Jelle-S "Code") | [<img src="https://avatars.githubusercontent.com/u/11180862?v=4" width="110px;"/><br /><sub>Michael Pietsch</sub>](https://github.com/Skywalker-11)<br /> | [<img src="https://avatars.githubusercontent.com/u/22068886?v=4" width="110px;"/><br /><sub>Masudul Haque Shihab</sub>](https://github.com/sh1hab)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sh1hab "Code") | [<img src="https://avatars.githubusercontent.com/u/16099942?v=4" width="110px;"/><br /><sub>Supapong Areeprasertkul</sub>](http://www.freedomdive.com/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=zybersup "Code") | [<img src="https://avatars.githubusercontent.com/u/207358?v=4" width="110px;"/><br /><sub>Peter Sarossy</sub>](https://github.com/psarossy)<br />[💻](https://github.com/snipe/snipe-it/commits?author=psarossy "Code") |
| [<img src="https://avatars.githubusercontent.com/u/11823649?v=4" width="110px;"/><br /><sub>Renee Margaret McConahy</sub>](https://github.com/nepella)<br />[💻](https://github.com/snipe/snipe-it/commits?author=nepella "Code") | [<img src="https://avatars.githubusercontent.com/u/5553884?v=4" width="110px;"/><br /><sub>JohnnyPicnic</sub>](https://github.com/JohnnyPicnic)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JohnnyPicnic "Code") | [<img src="https://avatars.githubusercontent.com/u/8799594?v=4" width="110px;"/><br /><sub>markbrule</sub>](https://github.com/markbrule)<br />[💻](https://github.com/snipe/snipe-it/commits?author=markbrule "Code") | [<img src="https://avatars.githubusercontent.com/u/1962801?v=4" width="110px;"/><br /><sub>Mike Campbell</sub>](https://github.com/mikecmpbll)<br />[💻](https://github.com/snipe/snipe-it/commits?author=mikecmpbll "Code") | [<img src="https://avatars.githubusercontent.com/u/11973217?v=4" width="110px;"/><br /><sub>tbrconnect</sub>](https://github.com/tbrconnect)<br />[💻](https://github.com/snipe/snipe-it/commits?author=tbrconnect "Code") | [<img src="https://avatars.githubusercontent.com/u/12447225?v=4" width="110px;"/><br /><sub>kcoyo</sub>](https://github.com/kcoyo)<br />[💻](https://github.com/snipe/snipe-it/commits?author=kcoyo "Code") | [<img src="https://avatars.githubusercontent.com/u/494017?v=4" width="110px;"/><br /><sub>Travis Miller</sub>](https://travismiller.com/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=travismiller "Code") |
| [<img src="https://avatars.githubusercontent.com/u/8735148?v=4" width="110px;"/><br /><sub>Petri Asikainen</sub>](https://github.com/PetriAsi)<br />[💻](https://github.com/snipe/snipe-it/commits?author=PetriAsi "Code") | [<img src="https://avatars.githubusercontent.com/u/11424540?v=4" width="110px;"/><br /><sub>derdeagle</sub>](https://github.com/derdeagle)<br />[💻](https://github.com/snipe/snipe-it/commits?author=derdeagle "Code") | [<img src="https://avatars.githubusercontent.com/u/176950?v=4" width="110px;"/><br /><sub>Mike Frysinger</sub>](https://wh0rd.org/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=vapier "Code") | [<img src="https://avatars.githubusercontent.com/u/22044358?v=4" width="110px;"/><br /><sub>ALPHA</sub>](https://github.com/AL4AL)<br />[💻](https://github.com/snipe/snipe-it/commits?author=AL4AL "Code") | [<img src="https://avatars.githubusercontent.com/u/1042587?v=4" width="110px;"/><br /><sub>FliegenKLATSCH</sub>](https://www.ifern.de)<br />[💻](https://github.com/snipe/snipe-it/commits?author=FliegenKLATSCH "Code") | [<img src="https://avatars.githubusercontent.com/u/442138?v=4" width="110px;"/><br /><sub>Jeremy Price</sub>](https://github.com/jerm)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jerm "Code") | [<img src="https://avatars.githubusercontent.com/u/84392209?v=4" width="110px;"/><br /><sub>Toreg87</sub>](https://github.com/Toreg87)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Toreg87 "Code") |
| [<img src="https://avatars.githubusercontent.com/u/67638596?v=4" width="110px;"/><br /><sub>Matthew Nickson</sub>](https://github.com/Computroniks)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Computroniks "Code") | [<img src="https://avatars.githubusercontent.com/u/1646397?v=4" width="110px;"/><br /><sub>Jethro Nederhof</sub>](https://jethron.id.au)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jethron "Code") | [<img src="https://avatars.githubusercontent.com/u/23289826?v=4" width="110px;"/><br /><sub>Oskar Stenberg</sub>](https://github.com/01ste02)<br />[💻](https://github.com/snipe/snipe-it/commits?author=01ste02 "Code") | [<img src="https://avatars.githubusercontent.com/u/82208283?v=4" width="110px;"/><br /><sub>Robert-Azelis</sub>](https://github.com/Robert-Azelis)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Robert-Azelis "Code") | [<img src="https://avatars.githubusercontent.com/u/60648387?v=4" width="110px;"/><br /><sub>Alexander William Smith</sub>](https://github.com/alwism)<br />[💻](https://github.com/snipe/snipe-it/commits?author=alwism "Code") | [<img src="https://avatars.githubusercontent.com/u/24418301?v=4" width="110px;"/><br /><sub>LEITWERK AG</sub>](https://www.leitwerk.de/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=leitwerk-ag "Code") | [<img src="https://avatars.githubusercontent.com/u/1911435?v=4" width="110px;"/><br /><sub>Adam</sub>](http://www.aboutcher.co.uk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=adamboutcher "Code") |
| [<img src="https://avatars.githubusercontent.com/u/16104273?v=4" width="110px;"/><br /><sub>Ian</sub>](https://snksrv.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sneak-it "Code") | [<img src="https://avatars.githubusercontent.com/u/4023909?v=4" width="110px;"/><br /><sub>Shao Yu-Lung (Allen)</sub>](http://blog.bestlong.idv.tw/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=bestlong "Code") | [<img src="https://avatars.githubusercontent.com/u/76475453?v=4" width="110px;"/><br /><sub>Haxatron</sub>](https://github.com/Haxatron)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Haxatron "Code") | [<img src="https://avatars.githubusercontent.com/u/3842948?v=4" width="110px;"/><br /><sub>Bradley Coudriet</sub>](http://bjcpgd.cias.rit.edu)<br />[💻](https://github.com/snipe/snipe-it/commits?author=exula "Code") | [<img src="https://avatars.githubusercontent.com/u/21966173?v=4" width="110px;"/><br /><sub>Dalton Durst</sub>](https://daltondur.st)<br />[💻](https://github.com/snipe/snipe-it/commits?author=UniversalSuperBox "Code") | [<img src="https://avatars.githubusercontent.com/u/48162670?v=4" width="110px;"/><br /><sub>TenOfTens</sub>](https://github.com/TenOfTens)<br />[💻](https://github.com/snipe/snipe-it/commits?author=TenOfTens "Code") | [<img src="https://avatars.githubusercontent.com/u/917232?v=4" width="110px;"/><br /><sub>Simona Avornicesei</sub>](http://www.avornicesei.com)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=savornicesei "Tests") |
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

27
SECURITY.md Normal file
View File

@@ -0,0 +1,27 @@
# Security Policy
We take security issues very seriously, and will always attempt to address any
vulnerabilities as quickly as possible.
## Supported Versions
We try to make a reasonable effort to support older versions of Snipe-IT,
however there are times when library dependencies and/or PHP/MySQL dependencies
make it impossible to backport security fixes on older versions.
| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |
## Reporting a Vulnerability
Security vulnerabilities should be sent to security@snipeitapp.com. You can typically expect a
response within two business days, and we typically have fixes out in under a week from the initial disclosure.
This obviously varies based on the severity of the security issue and the difficulty in remediation,
but those have historically been the timelines we worm around.
For a full breakdown of our security policies, please see https://snipeitapp.com/security.

27
Vagrantfile vendored
View File

@@ -8,25 +8,34 @@ Vagrant.configure("2") do |config|
config.vm.define "bionic" do |bionic|
bionic.vm.box = "ubuntu/bionic64"
bionic.vm.hostname = 'bionic'
bionic.vm.network "public_network", bridge: NETWORK_BRIDGE
bionic.vm.provision :shell, :inline => "wget #{SNIPEIT_SH_URL}"
bionic.vm.provision :shell, :inline => "chmod 755 snipeit.sh"
bionic.vm.network "forwarded_port", guest: 80, host: 8080
bionic.vm.synced_folder ".", "/vagrant", :owner => 'www-data',
:group => 'vagrant', :mount_options => ['dmode=775', 'fmode=775']
bionic.vm.provision "ansible_local" do |ansible|
ansible.playbook = "ansible/ubuntu/vagrant_playbook.yml"
end
end
config.vm.define "xenial" do |xenial|
xenial.vm.box = "ubuntu/xenial64"
xenial.vm.hostname = 'xenial'
xenial.vm.network "public_network", bridge: NETWORK_BRIDGE
xenial.vm.provision :shell, :inline => "wget #{SNIPEIT_SH_URL}"
xenial.vm.provision :shell, :inline => "chmod 755 snipeit.sh"
xenial.vm.network "forwarded_port", guest: 80, host: 8080
xenial.vm.synced_folder ".", "/vagrant", :owner => 'www-data',
:group => 'vagrant', :mount_options => ['dmode=775', 'fmode=775']
xenial.vm.provision "ansible_local" do |ansible|
ansible.playbook = "ansible/ubuntu/vagrant_playbook.yml"
end
end
config.vm.define "trusty" do |trusty|
trusty.vm.box = "ubuntu/trusty32"
trusty.vm.hostname = 'trusty'
trusty.vm.network "public_network", bridge: NETWORK_BRIDGE
trusty.vm.provision :shell, :inline => "wget #{SNIPEIT_SH_URL}"
trusty.vm.provision :shell, :inline => "chmod 755 snipeit.sh"
trusty.vm.network "forwarded_port", guest: 80, host: 8080
trusty.vm.synced_folder ".", "/vagrant", :owner => 'www-data',
:group => 'vagrant', :mount_options => ['dmode=775', 'fmode=775']
trusty.vm.provision "ansible_local" do |ansible|
ansible.playbook = "ansible/ubuntu/vagrant_playbook.yml"
end
end
config.vm.define "centos7" do |centos7|

View File

@@ -0,0 +1,10 @@
<VirtualHost *:80>
<Directory {{ app_path }}/public>
Allow From All
AllowOverride All
Options -Indexes
</Directory>
DocumentRoot {{ app_path }}/public
ServerName {{ fqdn }}
</VirtualHost>

View File

@@ -0,0 +1,226 @@
---
- name: Set up local server
hosts: all
remote_user: vagrant
become_user: root
become_method: sudo
vars:
app_path: "/var/www/snipeit"
fqdn: "localhost"
tasks:
- name: Update and upgrade existing apt packages
become: true
apt:
upgrade: yes
update_cache: yes
- name: Install Utilities
become: true
apt:
name: "{{ packages }}"
state: present
vars:
packages:
- nano
- vim
- name: Installing Apache httpd, PHP, MariaDB and other requirements.
become: true
apt:
name: "{{ packages }}"
state: present
vars:
packages:
- mariadb-client
- php
- php-curl
- php-mysql
- php-gd
- php-ldap
- php-zip
- php-mbstring
- php-xml
- php-bcmath
- curl
- git
- unzip
- python-pymysql
#
# Install the lastest version of composer
#
- name: Composer check
stat:
path: /usr/local/bin/composer
register: composer_exits
- name: Install Composer
shell: |
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
mv composer.phar /usr/local/bin/composer
exit $RESULT
when: not composer_exits.stat.exists
args:
creates: /usr/local/bin/composer
become: true
#
# Install and Configure MariaDB
#
- name: Install MariaDB
become: true
apt:
name: mariadb-server
state: present
register: sql_server
- name: Start and Enable MySQL server
become: true
systemd:
state: started
enabled: yes
name: mariadb
- name: Create Vagrant mysql password
become: true
mysql_user:
name: vagrant
password: vagrant
login_unix_socket: /var/run/mysqld/mysqld.sock
priv: "*.*:ALL"
state: present
- name: Enable remote mysql
replace:
path: /etc/mysql/mariadb.conf.d/50-server.cnf
regexp: "127.0.0.1"
replace: "0.0.0.0"
become: true
notify:
- restart mysql
- name: Create snipeit database
become: true
mysql_db:
name: snipeit
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
#
# Install Apache Web Server
#
- name: Install Apache 2.4
apt:
name: "{{ packages }}"
state: present
vars:
packages:
- apache2
- libapache2-mod-php
become: true
register: apache2_server
- name: Start and Enable Apache2 Server
become: true
systemd:
name: apache2
state: started
enabled: yes
#- name: Disable Apache modules
# become: true
# apache2_module:
# state: absent
# name: "{{ item }}"
# with_items:
# #- mpm_prefork
# notify:
# - restart apache2
- name: Enable Apache modules
become: true
apache2_module:
state: present
name: "{{ item }}"
with_items:
- rewrite
- vhost_alias
- deflate
- expires
- proxy_fcgi
- proxy
notify:
- restart apache2
- name: Install Apache VirtualHost File
become: true
template:
src: apachevirtualhost.conf.j2
dest: "/etc/apache2/sites-available/snipeit.conf"
- name: Enable VirtualHost
become: true
command: a2ensite snipeit
args:
creates: /etc/apache2/sites-enabled/snipeit.conf
notify:
- restart apache2
- name: Map apache dir to local folder
become: true
file:
src: /vagrant
dest: "{{ app_path }}"
state: link
notify:
- restart apache2
#
# Install dependencies from composer
#
- name: Install dependencies from composer
composer:
command: install
working_dir: "{{ app_path }}"
notify:
- restart apache2
#
# Configure .env file
#
- name: Copy .env file
copy:
src: "{{ app_path }}/.env.example"
dest: "{{ app_path }}/.env"
- name: Configure .env file
lineinfile:
path: "{{ app_path }}/.env"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^DB_HOST=', line: 'DB_HOST=127.0.0.1'}
- { regexp: '^DB_DATABASE=', line: 'DB_DATABASE=snipeit' }
- { regexp: '^DB_USERNAME=', line: 'DB_USERNAME=vagrant' }
- { regexp: '^DB_PASSWORD=', line: 'DB_PASSWORD=vagrant' }
- { regexp: '^APP_URL=', line: "APP_URL=http://{{ fqdn }}" }
- { regexp: '^APP_ENV=', line: "APP_ENV=development" }
- { regexp: '^APP_DEBUG=', line: "APP_DEBUG=true" }
- name: Generate application key
shell: "php {{ app_path }}/artisan key:generate --force"
- name: Artisan Migrate
shell: "php {{ app_path }}/artisan migrate --force"
#
# Create Cron Job
#
- name: Create scheduler cron job
become: true
cron:
name: "Snipe-IT Artisan Scheduler"
job: "/usr/bin/php {{ app_path }}/artisan schedule:run"
handlers:
- name: restart apache2
become: true
systemd:
name: apache2
state: restarted
- name: restart mysql
become: true
systemd:
name: mysql
state: restarted

154
app.json Normal file
View File

@@ -0,0 +1,154 @@
{
"name": "Snipe-IT",
"description": "Open source asset management.",
"keywords": [
"asset management",
"it asset"
],
"website": "https://snipeitapp.com/",
"repository": "https://github.com/snipe/snipe-it",
"logo": "https://pbs.twimg.com/profile_images/976748875733020672/K-HnZCCK_400x400.jpg",
"success_url": "/setup",
"env": {
"APP_ENV": {
"description": "Laravel environment mode. Unless developing the application, this should be production.",
"value": "production"
},
"APP_DEBUG": {
"description": "Laravel debug mode. Unless developing the application or actively debugging a problem, this should be set to false.",
"value": "false"
},
"APP_KEY": {
"description": "A secret key for verifying the integrity of signed cookies. (See either https://snipe-it.readme.io/docs/generate-your-app-key or generate at https://coderstoolbox.online/toolbox/generate-symfony-secret)",
"value": ""
},
"APP_URL": {
"description": "URL where your Snipe-IT install will be available at.",
"value": "https://your-app-name.herokuapp.com"
},
"APP_TIMEZONE": {
"description": "Which timezone do you want to use for your install? (http://php.net/manual/en/timezones.php)",
"value": "UTC"
},
"APP_LOCALE": {
"description": "Which language do you want to use for your install? (https://snipe-it.readme.io/docs/configuration#setting-a-language)",
"value": "en"
},
"MAX_RESULTS": {
"description": "The maximum number of search results that can be returned at one time.",
"value": "500"
},
"MAIL_DRIVER": {
"description": "Mail driver - Generally SMTP on Heroku - https://snipe-it.readme.io/docs/configuration#required-outgoing-mail-settings",
"value": "smtp"
},
"MAIL_HOST": {
"description": "SMTP Server Hostname",
"value": "smtp.your.domain.name"
},
"MAIL_PORT": {
"description": "SMTP Server Port",
"value": "25"
},
"MAIL_USERNAME": {
"description": "SMTP Server Username",
"value": "YOURUSERNAME"
},
"MAIL_PASSWORD": {
"description": "SMTP Server Password",
"value": "YOURPASSWORD"
},
"MAIL_ENCRYPTION": {
"description": "Encryption protocol for email sending.",
"value": "null"
},
"MAIL_FROM_ADDR": {
"description": "Email from address",
"value": "no-reply@domain.name"
},
"MAIL_FROM_NAME": {
"description": "Email from Name",
"value": "Snipe-IT"
},
"MAIL_REPLYTO_ADDR": {
"description": "Email Reply-To address",
"value": "your@domain.name"
},
"MAIL_REPLYTO_NAME": {
"description": "Email Reply-To Name",
"value": "Snipe-IT"
},
"MAIL_AUTO_EMBED": {
"description": "Whether or not to embed images in emails (via CID or base64) versus linking to them.",
"value": "true"
},
"MAIL_AUTO_EMBED_METHOD": {
"description": "Method that should be used for attaching inline images.",
"value": "base64"
},
"SESSION_LIFETIME": {
"description": "Specify the time in minutes that the session should remain valid.",
"value": "12000"
},
"EXPIRE_ON_CLOSE": {
"description": "Specify whether or not the logged in session should be expired when the user closes their browser window.",
"value": "false"
},
"ENCRYPT": {
"description": "Specify whether you wish to use encrypted cookies for your Snipe-IT sessions.",
"value": "true"
},
"COOKIE_NAME": {
"description": "The name of the cookie set by Snipe-IT for session management.",
"value": "snipeit_session"
},
"COOKIE_DOMAIN": {
"description": "The domain name that the session cookie should be sent for.",
"value": "your-app-name.herokuapp.com"
},
"SECURE_COOKIES": {
"description": "Should cookies only be sent for HTTPS connections? Generally true on Heroku.",
"value": "true"
},
"LOGIN_MAX_ATTEMPTS": {
"description": "The maximum number of failed attempts allowed before the user is throttled.",
"value": "5"
},
"LOGIN_LOCKOUT_DURATION": {
"description": "The duration (in seconds) that the user should be blocked from attempting to authenticate again.",
"value": "60"
},
"APP_LOG": {
"description": "Driver to send logs to. (errorlog for stderr)",
"value": "errorlog"
},
"ALLOW_IFRAMING": {
"description": "Allow Snipe-IT to be loaded using an iFrame?",
"value": "false"
},
"GOOGLE_MAPS_API": {
"description": "Include your Google Maps API key here if you'd like Snipe-IT to load maps from Google on your locations and suppliers pages.",
"required": false
},
"BACKUP_ENV": {
"description": "Set this to true if you wish to backup your .env file in your Admin > Backups process.",
"value": "true"
},
"ENABLE_HSTS": {
"description": "Whether or not to send the HSTS security policy header.",
"value": "false"
}
},
"formation": {
"web": {
"quantity": 1,
"size": "free"
}
},
"image": "heroku/php",
"addons": [
"cleardb:ignite",
"heroku-redis:hobby-dev",
"papertrail:choklad"
]
}

View File

@@ -40,7 +40,7 @@ class FixDoubleEscape extends Command
$tables = [
'\App\Models\Asset' => ['name'],
'\App\Models\License' => ['name'],
'\App\Models\License' => ['name', 'license_name'],
'\App\Models\Consumable' => ['name'],
'\App\Models\Accessory' => ['name'],
'\App\Models\Component' => ['name'],
@@ -53,7 +53,7 @@ class FixDoubleEscape extends Command
'\App\Models\Group' => ['name'],
'\App\Models\Department' => ['name'],
'\App\Models\Location' => ['name'],
'\App\Models\User' => ['first_name', 'last_name'],
'\App\Models\User' => ['first_name', 'last_name', 'jobtitle'],
];
$count = array();
@@ -69,10 +69,14 @@ class FixDoubleEscape extends Command
$count[$classname]['classname']++;
$count[$classname][$field] = 0;
foreach($classname::where("$field",'LIKE','%&%')->get() as $row) {
$this->info('Updating '.$field.' for '.$classname);
$row->{$field} = html_entity_decode($row->{$field},ENT_QUOTES);
$row->save();
foreach($classname::where("$field",'LIKE','%;%')->get() as $row) {
$fixed = html_entity_decode($row->{$field});
if ($row->save()) {
$this->info('Updating '.$field.' for '.$classname.' to '.$row->{$field}.' to '.$fixed);
} else {
$this->error('Could NOT update '.$field.' for '.$classname.' to '.$row->{$field}.' to '.$fixed.': '.$row->getErrors());
}
$count[$classname][$field]++;
}

View File

@@ -88,11 +88,13 @@ class ImportLocations extends Command
if (array_key_exists('Parent Name', $row)) {
$parent_name = trim($row['Parent Name']);
} else {
$parent_name = null;
}
// Set the location attributes to save
if (array_key_exists('Name', $row)) {
$location = Location::firstOrNew(array('name' => trim($row['Name'])));
$location = Location::firstOrCreate(array('name' => trim($row['Name'])));
$location->name = trim($row['Name']);
$this->info('Checking location: '.$location->name);
} else {

583
app/Console/Commands/LdapSync.php Normal file → Executable file
View File

@@ -1,24 +1,15 @@
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use Log;
use Exception;
use App\Models\User;
use App\Services\LdapAd;
use App\Models\Location;
use App\Models\Department;
use Illuminate\Console\Command;
use Adldap\Models\User as AdldapUser;
use App\Models\Setting;
use App\Models\Ldap;
use App\Models\User;
use App\Models\Location;
use Log;
/**
* LDAP / AD sync command.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
class LdapSync extends Command
{
/**
@@ -26,79 +17,23 @@ class LdapSync extends Command
*
* @var string
*/
protected $signature = 'snipeit:ldap-sync
{--location= : A location name }
{--location_id= : A location id}
{--base_dn= : A diffrent base DN to use }
{--summary : Print summary }
{--json_summary : Print summary in json format }
{--dryrun : Run the sync process but don\'t update the database}';
protected $signature = 'snipeit:ldap-sync {--location=} {--location_id=} {--base_dn=} {--summary} {--json_summary}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command line LDAP/AD sync';
/**
* An LdapAd instance.
*
* @var \App\Models\LdapAd
*/
private $ldap;
/**
* LDAP settings collection.
*
* @var \Illuminate\Support\Collection
*/
private $settings = null;
/**
* A default location collection.
*
* @var \Illuminate\Support\Collection
*/
private $defaultLocation = null;
/**
* Mapped locations collection.
*
* @var \Illuminate\Support\Collection
*/
private $mappedLocations = null;
/**
* The summary collection.
*
* @var \Illuminate\Support\Collection
*/
private $summary;
/**
* Is dry-run?
*
* @var bool
*/
private $dryrun = false;
/**
* Show users to be imported.
*
* @var array
*/
private $userlist = [];
protected $description = 'Command line LDAP sync';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct(LdapAd $ldap)
public function __construct()
{
parent::__construct();
$this->ldap = $ldap;
$this->settings = $this->ldap->ldapSettings;
$this->summary = collect();
}
/**
@@ -108,275 +43,267 @@ class LdapSync extends Command
*/
public function handle()
{
ini_set('max_execution_time', env('LDAP_TIME_LIM', "600")); //600 seconds = 10 minutes
ini_set('memory_limit', '500M');
$old_error_reporting = error_reporting(); // grab old error_reporting .ini setting, for later re-enablement
error_reporting($old_error_reporting & ~E_DEPRECATED); // disable deprecation warnings, for LDAP in PHP 7.4 (and greater)
ini_set('max_execution_time', env('LDAP_TIME_LIM', 600)); //600 seconds = 10 minutes
ini_set('memory_limit', env('LDAP_MEM_LIM', '500M'));
$ldap_result_username = Setting::getSettings()->ldap_username_field;
$ldap_result_last_name = Setting::getSettings()->ldap_lname_field;
$ldap_result_first_name = Setting::getSettings()->ldap_fname_field;
if ($this->option('dryrun')) {
$this->dryrun = true;
}
$this->checkIfLdapIsEnabled();
$this->checkLdapConnection();
$this->setBaseDn();
$this->getUserDefaultLocation();
/*
* Use the default location if set, this is needed for the LDAP users sync page
*/
if (!$this->option('base_dn') && null == $this->defaultLocation) {
$this->getMappedLocations();
}
$this->processLdapUsers();
// Print table of users
if ($this->dryrun) {
$this->info('The following users will be synced!');
$headers = ['First Name', 'Last Name', 'Username', 'Email', 'Employee #', 'Location Id', 'Status'];
$this->table($headers, $this->summary->toArray());
$ldap_result_active_flag = Setting::getSettings()->ldap_active_flag;
$ldap_result_emp_num = Setting::getSettings()->ldap_emp_num;
$ldap_result_email = Setting::getSettings()->ldap_email;
$ldap_result_phone = Setting::getSettings()->ldap_phone_field;
$ldap_result_jobtitle = Setting::getSettings()->ldap_jobtitle;
$ldap_result_country = Setting::getSettings()->ldap_country;
$ldap_result_dept = Setting::getSettings()->ldap_dept;
try {
$ldapconn = Ldap::connectToLdap();
Ldap::bindAdminToLdap($ldapconn);
} catch (\Exception $e) {
if ($this->option('json_summary')) {
$json_summary = [ "error" => true, "error_message" => $e->getMessage(), "summary" => [] ];
$this->info(json_encode($json_summary));
}
LOG::info($e);
return [];
}
error_reporting($old_error_reporting); // re-enable deprecation warnings.
return $this->getSummary();
}
$summary = array();
/**
* Generate the LDAP sync summary.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*
* @return string
*/
private function getSummary(): string
{
if ($this->option('summary') && null === $this->dryrun) {
$this->summary->each(function ($item) {
$this->info('USER: '.$item['note']);
if ('ERROR' === $item['status']) {
$this->error('ERROR: '.$item['note']);
}
});
} elseif ($this->option('json_summary')) {
$json_summary = [
'error' => false,
'error_message' => '',
'summary' => $this->summary->toArray(),
];
$this->info(json_encode($json_summary));
try {
if ($this->option('base_dn') != '') {
$search_base = $this->option('base_dn');
LOG::debug('Importing users from specified base DN: \"'.$search_base.'\".');
} else {
$search_base = null;
}
$results = Ldap::findLdapUsers($search_base);
} catch (\Exception $e) {
if ($this->option('json_summary')) {
$json_summary = [ "error" => true, "error_message" => $e->getMessage(), "summary" => [] ];
$this->info(json_encode($json_summary));
}
LOG::info($e);
return [];
}
return '';
}
/* Determine which location to assign users to by default. */
$location = NULL; // FIXME - this would be better called "$default_location", which is more explicit about its purpose
/**
* Create a new user or update an existing user.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*
* @param \Adldap\Models\User $snipeUser
*/
private function updateCreateUser(AdldapUser $snipeUser): void
{
$user = $this->ldap->processUser($snipeUser, $this->defaultLocation, $this->mappedLocations);
$summary = [
'firstname' => $user->first_name,
'lastname' => $user->last_name,
'username' => $user->username,
'employee_number' => $user->employee_num,
'email' => $user->email,
'location_id' => $user->location_id,
];
// Only update the database if is not a dry run
if (!$this->dryrun) {
if ($user->isDirty()) { //if nothing on the user changed, don't bother trying to save anything nor put anything in the summary
if ($user->save()) {
$summary['note'] = ($user->wasRecentlyCreated ? 'CREATED' : 'UPDATED');
$summary['status'] = 'SUCCESS';
} else {
$errors = '';
foreach ($user->getErrors()->getMessages() as $error) {
$errors .= implode(", ",$error);
if ($this->option('location')!='') {
$location = Location::where('name', '=', $this->option('location'))->first();
LOG::debug('Location name '.$this->option('location').' passed');
LOG::debug('Importing to '.$location->name.' ('.$location->id.')');
} elseif ($this->option('location_id')!='') {
$location = Location::where('id', '=', $this->option('location_id'))->first();
LOG::debug('Location ID '.$this->option('location_id').' passed');
LOG::debug('Importing to '.$location->name.' ('.$location->id.')');
}
if (!isset($location)) {
LOG::debug('That location is invalid or a location was not provided, so no location will be assigned by default.');
}
/* Process locations with explicitly defined OUs, if doing a full import. */
if ($this->option('base_dn')=='') {
// Retrieve locations with a mapped OU, and sort them from the shallowest to deepest OU (see #3993)
$ldap_ou_locations = Location::where('ldap_ou', '!=', '')->get()->toArray();
$ldap_ou_lengths = array();
foreach ($ldap_ou_locations as $ou_loc) {
$ldap_ou_lengths[] = strlen($ou_loc["ldap_ou"]);
}
array_multisort($ldap_ou_lengths, SORT_ASC, $ldap_ou_locations);
if (sizeof($ldap_ou_locations) > 0) {
LOG::debug('Some locations have special OUs set. Locations will be automatically set for users in those OUs.');
}
// Inject location information fields
for ($i = 0; $i < $results["count"]; $i++) {
$results[$i]["ldap_location_override"] = false;
$results[$i]["location_id"] = 0;
}
// Grab subsets based on location-specific DNs, and overwrite location for these users.
foreach ($ldap_ou_locations as $ldap_loc) {
try {
$location_users = Ldap::findLdapUsers($ldap_loc["ldap_ou"]);
} catch (\Exception $e) { // FIXME: this is stolen from line 77 or so above
if ($this->option('json_summary')) {
$json_summary = [ "error" => true, "error_message" => trans('admin/users/message.error.ldap_could_not_search')." Location: ".$ldap_loc['name']." (ID: ".$ldap_loc['id'].") cannot connect to \"".$ldap_loc["ldap_ou"]."\" - ".$e->getMessage(), "summary" => [] ];
$this->info(json_encode($json_summary));
}
$summary['note'] = $snipeUser->getDN().' was not imported. REASON: '.$errors;
$summary['status'] = 'ERROR';
LOG::info($e);
return [];
}
} else {
$summary = null;
}
}
$usernames = array();
for ($i = 0; $i < $location_users["count"]; $i++) {
// $summary['note'] = ($user->getOriginal('username') ? 'UPDATED' : 'CREATED'); // this seems, kinda, like, superfluous, relative to the $summary['note'] thing above, yeah?
if($summary) { //if the $user wasn't dirty, $summary was set to null so that we will skip the following push()
$this->summary->push($summary);
}
}
if (array_key_exists($ldap_result_username, $location_users[$i])) {
$location_users[$i]["ldap_location_override"] = true;
$location_users[$i]["location_id"] = $ldap_loc["id"];
$usernames[] = $location_users[$i][$ldap_result_username][0];
}
/**
* Process the users to update / create.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*
*/
private function processLdapUsers(): void
{
try {
$ldapUsers = $this->ldap->getLdapUsers();
} catch (Exception $e) {
$this->outputError($e);
exit($e->getMessage());
}
if (0 == $ldapUsers->count()) {
$msg = 'ERROR: No users found!';
Log::error($msg);
if ($this->dryrun) {
$this->error($msg);
}
exit($msg);
}
// Process each individual users
foreach ($ldapUsers->getResults() as $user) { // AdLdap2's paginate() method is weird, it gets *everything* and ->getResults() returns *everything*
$this->updateCreateUser($user);
}
}
/**
* Get the mapped locations if a base_dn is provided.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
private function getMappedLocations()
{
$ldapOuLocation = Location::where('ldap_ou', '!=', '')->select(['id', 'ldap_ou'])->get();
$locations = $ldapOuLocation->sortBy(function ($ou, $key) {
return strlen($ou->ldap_ou);
});
if ($locations->count() > 0) {
$msg = 'Some locations have special OUs set. Locations will be automatically set for users in those OUs.';
LOG::debug($msg);
if ($this->dryrun) {
$this->info($msg);
}
$this->mappedLocations = $locations->pluck('ldap_ou', 'id'); // TODO: this seems ok-ish, but the key-> value is going location_id -> OU name, and the primary action here is the opposite of that - going from OU's to location ID's.
}
}
/**
* Set the base dn if supplied.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
private function setBaseDn(): void
{
if ($this->option('base_dn')) {
$this->ldap->baseDn = $this->option('base_dn');
$msg = sprintf('Importing users from specified base DN: "%s"', $this->ldap->baseDn);
LOG::debug($msg);
if ($this->dryrun) {
$this->info($msg);
}
}
}
/**
* Get a default location id for imported users.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
private function getUserDefaultLocation(): void
{
$location = $this->option('location_id') ?? $this->option('location');
if ($location) {
$userLocation = Location::where('name', '=', $location)
->orWhere('id', '=', intval($location))
->select(['name', 'id'])
->first();
if ($userLocation) {
$msg = 'Importing users with default location: '.$userLocation->name.' ('.$userLocation->id.')';
LOG::debug($msg);
if ($this->dryrun) {
$this->info($msg);
}
$this->defaultLocation = collect([
$userLocation->id => $userLocation->name,
// Delete located users from the general group.
foreach ($results as $key => $generic_entry) {
if ((is_array($generic_entry)) && (array_key_exists($ldap_result_username, $generic_entry))) {
if (in_array($generic_entry[$ldap_result_username][0], $usernames)) {
unset($results[$key]);
}
}
}
$global_count = $results['count'];
$results = array_merge($location_users, $results);
$results['count'] = $global_count;
}
}
/* Create user account entries in Snipe-IT */
$tmp_pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
$pass = bcrypt($tmp_pass);
for ($i = 0; $i < $results["count"]; $i++) {
$item = array();
$item["username"] = isset($results[$i][$ldap_result_username][0]) ? $results[$i][$ldap_result_username][0] : "";
$item["employee_number"] = isset($results[$i][$ldap_result_emp_num][0]) ? $results[$i][$ldap_result_emp_num][0] : "";
$item["lastname"] = isset($results[$i][$ldap_result_last_name][0]) ? $results[$i][$ldap_result_last_name][0] : "";
$item["firstname"] = isset($results[$i][$ldap_result_first_name][0]) ? $results[$i][$ldap_result_first_name][0] : "";
$item["email"] = isset($results[$i][$ldap_result_email][0]) ? $results[$i][$ldap_result_email][0] : "" ;
$item["ldap_location_override"] = isset($results[$i]["ldap_location_override"]) ? $results[$i]["ldap_location_override"]:"";
$item["location_id"] = isset($results[$i]["location_id"]) ? $results[$i]["location_id"]:"";
$item["telephone"] = isset($results[$i][$ldap_result_phone][0]) ? $results[$i][$ldap_result_phone][0] : "";
$item["jobtitle"] = isset($results[$i][$ldap_result_jobtitle][0]) ? $results[$i][$ldap_result_jobtitle][0] : "";
$item["country"] = isset($results[$i][$ldap_result_country][0]) ? $results[$i][$ldap_result_country][0] : "";
$item["department"] = isset($results[$i][$ldap_result_dept][0]) ? $results[$i][$ldap_result_dept][0] : "";
$department = Department::firstOrCreate([
'name' => $item["department"],
]);
} else {
$msg = 'The supplied location is invalid!';
LOG::error($msg);
if ($this->dryrun) {
$this->error($msg);
$user = User::where('username', $item["username"])->first();
if ($user) {
// Updating an existing user.
$item["createorupdate"] = 'updated';
} else {
// Creating a new user.
$user = new User;
$user->password = $pass;
$user->activated = 1; // newly created users can log in by default, unless AD's UAC is in use, or an active flag is set (below)
$item["createorupdate"] = 'created';
}
$user->first_name = $item["firstname"];
$user->last_name = $item["lastname"];
$user->username = $item["username"];
$user->email = $item["email"];
$user->employee_num = e($item["employee_number"]);
$user->phone = $item["telephone"];
$user->jobtitle = $item["jobtitle"];
$user->country = $item["country"];
$user->department_id = $department->id;
if ( !empty($ldap_result_active_flag)) { // IF we have an 'active' flag set....
// ....then *most* things that are truthy will activate the user. Anything falsey will deactivate them.
// (Specifically, we don't handle a value of '0.0' correctly)
$raw_value = @$results[$i][$ldap_result_active_flag][0];
$filter_var = filter_var($raw_value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
$boolean_cast = (bool)$raw_value;
$user->activated = $filter_var ?? $boolean_cast; // if filter_var() was true or false, use that. If it's null, use the $boolean_cast
} elseif ( array_key_exists('useraccountcontrol', $results[$i]) ) {
// ....otherwise, (ie if no 'active' LDAP flag is defined), IF the UAC setting exists,
// ....then use the UAC setting on the account to determine can-log-in vs. cannot-log-in
/* The following is _probably_ the correct logic, but we can't use it because
some users may have been dependent upon the previous behavior, and this
could cause additional access to be available to users they don't want
to allow to log in.
$useraccountcontrol = $results[$i]['useraccountcontrol'][0];
if(
// based on MS docs at: https://support.microsoft.com/en-us/help/305144/how-to-use-useraccountcontrol-to-manipulate-user-account-properties
($useraccountcontrol & 0x200) && // is a NORMAL_ACCOUNT
!($useraccountcontrol & 0x02) && // *and* _not_ ACCOUNTDISABLE
!($useraccountcontrol & 0x10) // *and* _not_ LOCKOUT
) {
$user->activated = 1;
} else {
$user->activated = 0;
} */
$enabled_accounts = [
'512', // 0x200 NORMAL_ACCOUNT
'544', // 0x220 NORMAL_ACCOUNT, PASSWD_NOTREQD
'66048', // 0x10200 NORMAL_ACCOUNT, DONT_EXPIRE_PASSWORD
'66080', // 0x10220 NORMAL_ACCOUNT, PASSWD_NOTREQD, DONT_EXPIRE_PASSWORD
'262656', // 0x40200 NORMAL_ACCOUNT, SMARTCARD_REQUIRED
'262688', // 0x40220 NORMAL_ACCOUNT, PASSWD_NOTREQD, SMARTCARD_REQUIRED
'328192', // 0x50200 NORMAL_ACCOUNT, SMARTCARD_REQUIRED, DONT_EXPIRE_PASSWORD
'328224', // 0x50220 NORMAL_ACCOUNT, PASSWD_NOT_REQD, SMARTCARD_REQUIRED, DONT_EXPIRE_PASSWORD
'4194816',// 0x400200 NORMAL_ACCOUNT, DONT_REQ_PREAUTH
'4260352',// 0x410200 NORMAL_ACCOUNT, DONT_EXPIRE_PASSWORD, DONT_REQ_PREAUTH
'1049088',// 0x100200 NORMAL_ACCOUNT, NOT_DELEGATED
];
$user->activated = ( in_array($results[$i]['useraccountcontrol'][0], $enabled_accounts) ) ? 1 : 0;
} /* implied 'else' here - leave the $user->activated flag alone. Newly-created accounts will be active.
already-existing accounts will be however the administrator has set them */
if ($item['ldap_location_override'] == true) {
$user->location_id = $item['location_id'];
} elseif ((isset($location)) && (!empty($location))) {
if ((is_array($location)) && (array_key_exists('id', $location))) {
$user->location_id = $location['id'];
} elseif (is_object($location)) {
$user->location_id = $location->id;
}
}
$user->ldap_import = 1;
$errors = '';
if ($user->save()) {
$item["note"] = $item["createorupdate"];
$item["status"]='success';
} else {
foreach ($user->getErrors()->getMessages() as $key => $err) {
$errors .= $err[0];
}
$item["note"] = $errors;
$item["status"]='error';
}
array_push($summary, $item);
}
if ($this->option('summary')) {
for ($x = 0; $x < count($summary); $x++) {
if ($summary[$x]['status']=='error') {
$this->error('ERROR: '.$summary[$x]['firstname'].' '.$summary[$x]['lastname'].' (username: '.$summary[$x]['username'].') was not imported: '.$summary[$x]['note']);
} else {
$this->info('User '.$summary[$x]['firstname'].' '.$summary[$x]['lastname'].' (username: '.$summary[$x]['username'].') was '.strtoupper($summary[$x]['createorupdate']).'.');
}
exit(0);
}
}
}
/**
* Check if LDAP intergration is enabled.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
private function checkIfLdapIsEnabled(): void
{
if (false === $this->settings['ldap_enabled']) {
$msg = 'LDAP intergration is not enabled. Exiting sync process.';
$this->info($msg);
Log::info($msg);
exit(0);
}
}
/**
* Check to make sure we can access the server.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
private function checkLdapConnection(): void
{
try {
$this->ldap->testLdapAdUserConnection();
$this->ldap->testLdapAdBindConnection();
} catch (Exception $e) {
$this->outputError($e);
exit(0);
}
}
/**
* Output the json summary to the screen if enabled.
*
* @param Exception $error
*/
private function outputError($error): void
{
if ($this->option('json_summary')) {
$json_summary = [
'error' => true,
'error_message' => $error->getMessage(),
'summary' => [],
];
} else if ($this->option('json_summary')) {
$json_summary = [ "error" => false, "error_message" => "", "summary" => $summary ]; // hardcoding the error to false and the error_message to blank seems a bit weird
$this->info(json_encode($json_summary));
} else {
return $summary;
}
$this->error($error->getMessage());
LOG::error($error);
}
}

View File

@@ -0,0 +1,399 @@
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use Log;
use Exception;
use App\Models\User;
use App\Services\LdapAd;
use App\Models\Location;
use Illuminate\Console\Command;
use Adldap\Models\User as AdldapUser;
/**
* LDAP / AD sync command.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
class LdapSyncNg extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'snipeit:ldap-sync-ng
{--location= : A location name }
{--location_id= : A location id}
{--base_dn= : A diffrent base DN to use }
{--summary : Print summary }
{--json_summary : Print summary in json format }
{--dryrun : Run the sync process but don\'t update the database}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command line LDAP/AD sync';
/**
* An LdapAd instance.
*
* @var \App\Models\LdapAd
*/
private $ldap;
/**
* LDAP settings collection.
*
* @var \Illuminate\Support\Collection
*/
private $settings = null;
/**
* A default location collection.
*
* @var \Illuminate\Support\Collection
*/
private $defaultLocation = null;
/**
* Mapped locations collection.
*
* @var \Illuminate\Support\Collection
*/
private $mappedLocations = null;
/**
* The summary collection.
*
* @var \Illuminate\Support\Collection
*/
private $summary;
/**
* Is dry-run?
*
* @var bool
*/
private $dryrun = false;
/**
* Show users to be imported.
*
* @var array
*/
private $userlist = [];
/**
* Create a new command instance.
*/
public function __construct(LdapAd $ldap)
{
parent::__construct();
$this->ldap = $ldap;
$this->settings = $this->ldap->ldapSettings;
$this->summary = collect();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$dispatcher = \Adldap\Adldap::getEventDispatcher();
// Listen for all model events.
$dispatcher->listen('Adldap\Models\Events\*', function ($eventName, array $data) {
echo $eventName; // Returns 'Adldap\Models\Events\Updating'
var_dump($data); // Returns [0] => (object) Adldap\Models\Events\Updating;
\Log::debug("Event: ".$eventName." data - ".print_r($data, true));
});
$dispatcher->listen('Adldap\Auth\Events\*', function ($eventName, array $data) {
echo $eventName; // Returns 'Adldap\Models\Events\Updating'
var_dump($data); // Returns [0] => (object) Adldap\Models\Events\Updating;
\Log::debug("Event: ".$eventName." data - ".print_r($data, true));
});
ini_set('max_execution_time', env('LDAP_TIME_LIM', "600")); //600 seconds = 10 minutes
ini_set('memory_limit', '500M');
$old_error_reporting = error_reporting(); // grab old error_reporting .ini setting, for later re-enablement
error_reporting($old_error_reporting & ~E_DEPRECATED); // disable deprecation warnings, for LDAP in PHP 7.4 (and greater)
if ($this->option('dryrun')) {
$this->dryrun = true;
}
$this->checkIfLdapIsEnabled();
$this->checkLdapConnection();
$this->setBaseDn();
$this->getUserDefaultLocation();
/*
* Use the default location if set, this is needed for the LDAP users sync page
*/
if (!$this->option('base_dn') && null == $this->defaultLocation) {
$this->getMappedLocations();
}
$this->processLdapUsers();
// Print table of users
if ($this->dryrun) {
$this->info('The following users will be synced!');
$headers = ['First Name', 'Last Name', 'Username', 'Email', 'Employee #', 'Location Id', 'Status'];
$this->table($headers, $this->summary->toArray());
}
error_reporting($old_error_reporting); // re-enable deprecation warnings.
return $this->getSummary();
}
/**
* Generate the LDAP sync summary.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*
* @return string
*/
private function getSummary(): string
{
if ($this->option('summary') && null === $this->dryrun) {
$this->summary->each(function ($item) {
$this->info('USER: '.$item['note']);
if ('ERROR' === $item['status']) {
$this->error('ERROR: '.$item['note']);
}
});
} elseif ($this->option('json_summary')) {
$json_summary = [
'error' => false,
'error_message' => '',
'summary' => $this->summary->toArray(),
];
$this->info(json_encode($json_summary));
}
return '';
}
/**
* Create a new user or update an existing user.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*
* @param \Adldap\Models\User $snipeUser
*/
private function updateCreateUser(AdldapUser $snipeUser): void
{
$user = $this->ldap->processUser($snipeUser, $this->defaultLocation, $this->mappedLocations);
$summary = [
'firstname' => $user->first_name,
'lastname' => $user->last_name,
'username' => $user->username,
'employee_number' => $user->employee_num,
'email' => $user->email,
'location_id' => $user->location_id,
];
// Only update the database if is not a dry run
if (!$this->dryrun) {
if ($user->isDirty()) { //if nothing on the user changed, don't bother trying to save anything nor put anything in the summary
if ($user->save()) {
$summary['note'] = ($user->wasRecentlyCreated ? 'CREATED' : 'UPDATED');
$summary['status'] = 'SUCCESS';
} else {
$errors = '';
foreach ($user->getErrors()->getMessages() as $error) {
$errors .= implode(", ",$error);
}
$summary['note'] = $snipeUser->getDN().' was not imported. REASON: '.$errors;
$summary['status'] = 'ERROR';
}
} else {
$summary = null;
}
}
// $summary['note'] = ($user->getOriginal('username') ? 'UPDATED' : 'CREATED'); // this seems, kinda, like, superfluous, relative to the $summary['note'] thing above, yeah?
if($summary) { //if the $user wasn't dirty, $summary was set to null so that we will skip the following push()
$this->summary->push($summary);
}
}
/**
* Process the users to update / create.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*
*/
private function processLdapUsers(): void
{
try {
\Log::debug("CAL:LING GET LDAP SUSERS");
$ldapUsers = $this->ldap->getLdapUsers();
\Log::debug("END CALLING GET LDAP USERS");
} catch (Exception $e) {
$this->outputError($e);
exit($e->getMessage());
}
if (0 == $ldapUsers->count()) {
$msg = 'ERROR: No users found!';
Log::error($msg);
if ($this->dryrun) {
$this->error($msg);
}
exit($msg);
}
// Process each individual users
foreach ($ldapUsers->getResults() as $user) { // AdLdap2's paginate() method is weird, it gets *everything* and ->getResults() returns *everything*
$this->updateCreateUser($user);
}
}
/**
* Get the mapped locations if a base_dn is provided.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
private function getMappedLocations()
{
$ldapOuLocation = Location::where('ldap_ou', '!=', '')->select(['id', 'ldap_ou'])->get();
$locations = $ldapOuLocation->sortBy(function ($ou, $key) {
return strlen($ou->ldap_ou);
});
if ($locations->count() > 0) {
$msg = 'Some locations have special OUs set. Locations will be automatically set for users in those OUs.';
LOG::debug($msg);
if ($this->dryrun) {
$this->info($msg);
}
$this->mappedLocations = $locations->pluck('ldap_ou', 'id'); // TODO: this seems ok-ish, but the key-> value is going location_id -> OU name, and the primary action here is the opposite of that - going from OU's to location ID's.
}
}
/**
* Set the base dn if supplied.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
private function setBaseDn(): void
{
if ($this->option('base_dn')) {
$this->ldap->baseDn = $this->option('base_dn');
$msg = sprintf('Importing users from specified base DN: "%s"', $this->ldap->baseDn);
LOG::debug($msg);
if ($this->dryrun) {
$this->info($msg);
}
}
}
/**
* Get a default location id for imported users.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
private function getUserDefaultLocation(): void
{
$location = $this->option('location_id') ?? $this->option('location');
if ($location) {
$userLocation = Location::where('name', '=', $location)
->orWhere('id', '=', intval($location))
->select(['name', 'id'])
->first();
if ($userLocation) {
$msg = 'Importing users with default location: '.$userLocation->name.' ('.$userLocation->id.')';
LOG::debug($msg);
if ($this->dryrun) {
$this->info($msg);
}
$this->defaultLocation = collect([
$userLocation->id => $userLocation->name,
]);
} else {
$msg = 'The supplied location is invalid!';
LOG::error($msg);
if ($this->dryrun) {
$this->error($msg);
}
exit(0);
}
}
}
/**
* Check if LDAP intergration is enabled.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
private function checkIfLdapIsEnabled(): void
{
if (false === $this->settings['ldap_enabled']) {
$msg = 'LDAP intergration is not enabled. Exiting sync process.';
$this->info($msg);
Log::info($msg);
exit(0);
}
}
/**
* Check to make sure we can access the server.
*
* @author Wes Hulette <jwhulette@gmail.com>
*
* @since 5.0.0
*/
private function checkLdapConnection(): void
{
try {
$this->ldap->testLdapAdUserConnection();
$this->ldap->testLdapAdBindConnection();
} catch (Exception $e) {
$this->outputError($e);
exit(0);
}
}
/**
* Output the json summary to the screen if enabled.
*
* @param Exception $error
*/
private function outputError($error): void
{
if ($this->option('json_summary')) {
$json_summary = [
'error' => true,
'error_message' => $error->getMessage(),
'summary' => [],
];
$this->info(json_encode($json_summary));
}
$this->error($error->getMessage());
LOG::error($error);
}
}

View File

@@ -5,8 +5,8 @@ use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
ini_set('max_execution_time', 600); //600 seconds = 10 minutes
ini_set('memory_limit', '500M');
ini_set('max_execution_time', env('IMPORT_TIME_LIMIT', 600)); //600 seconds = 10 minutes
ini_set('memory_limit', env('IMPORT_MEMORY_LIMIT', '500M'));
/**
* Class ObjectImportCommand

View File

@@ -2,23 +2,9 @@
namespace App\Console\Commands;
use App\Models\Accessory;
use App\Models\Asset;
use App\Models\AssetModel;
use App\Models\Category;
use App\Models\Company;
use App\Models\Component;
use App\Models\Consumable;
use App\Models\Department;
use App\Models\Depreciation;
use App\Models\Group;
use App\Models\Import;
use App\Models\License;
use App\Models\LicenseSeat;
use App\Models\Location;
use App\Models\Manufacturer;
use App\Models\Statuslabel;
use App\Models\Supplier;
use App\Models\CustomField;
use Schema;
use DB;
use Illuminate\Console\Command;
@@ -29,15 +15,14 @@ class PaveIt extends Command
*
* @var string
*/
protected $signature = 'snipeit:pave
{--soft : Perform a "Soft" Delete, leaving all migrations, table structure, and the first user in place.}';
protected $signature = 'snipeit:pave {--force : Skip the interactive yes/no prompt for confirmation}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Pave the database to start over. This should ALMOST NEVER BE USED. (It is primarily a quick tool for developers.)';
protected $description = 'Clear the database tables, leaving all migrations, table structure, and the first user in place. (It is primarily a quick tool for developers.) If you want to destroy all tables as well, use php artisan db:wipe.';
/**
* Create a new command instance.
@@ -56,106 +41,51 @@ class PaveIt extends Command
*/
public function handle()
{
if ($this->confirm("\n****************************************************\nTHIS WILL DELETE ALL OF THE DATA IN YOUR DATABASE. \nThere is NO undo. This WILL destroy ALL of your data. \n****************************************************\n\nDo you wish to continue? No backsies! [y|N]")) {
if ($this->option('soft')) {
Accessory::getQuery()->delete();
Asset::getQuery()->delete();
Category::getQuery()->delete();
Company::getQuery()->delete();
Component::getQuery()->delete();
Consumable::getQuery()->delete();
Department::getQuery()->delete();
Depreciation::getQuery()->delete();
License::getQuery()->delete();
LicenseSeat::getQuery()->delete();
Location::getQuery()->delete();
Manufacturer::getQuery()->delete();
AssetModel::getQuery()->delete();
Statuslabel::getQuery()->delete();
Supplier::getQuery()->delete();
Group::getQuery()->delete();
Import::getQuery()->delete();
DB::statement('delete from accessories_users');
DB::statement('delete from asset_logs');
DB::statement('delete from asset_maintenances');
DB::statement('delete from login_attempts');
DB::statement('delete from asset_uploads');
DB::statement('delete from action_logs');
DB::statement('delete from checkout_requests');
DB::statement('delete from checkout_acceptances');
DB::statement('delete from consumables_users');
DB::statement('delete from custom_field_custom_fieldset');
DB::statement('delete from custom_fields');
DB::statement('delete from custom_fieldsets');
DB::statement('delete from components_assets');
DB::statement('delete from kits');
DB::statement('delete from kits_accessories');
DB::statement('delete from kits_consumables');
DB::statement('delete from kits_licenses');
DB::statement('delete from kits_models');
DB::statement('delete from login_attempts');
DB::statement('delete from models_custom_fields');
DB::statement('delete from permission_groups');
DB::statement('delete from password_resets');
DB::statement('delete from requested_assets');
DB::statement('delete from requests');
DB::statement('delete from throttle');
DB::statement('delete from users_groups');
DB::statement('delete from users WHERE id!=1');
} else {
\DB::statement('drop table IF EXISTS accessories_users');
\DB::statement('drop table IF EXISTS accessories');
\DB::statement('drop table IF EXISTS asset_logs');
\DB::statement('drop table IF EXISTS action_logs');
\DB::statement('drop table IF EXISTS asset_maintenances');
\DB::statement('drop table IF EXISTS asset_uploads');
\DB::statement('drop table IF EXISTS assets');
\DB::statement('drop table IF EXISTS categories');
\DB::statement('drop table IF EXISTS checkout_requests');
\DB::statement('drop table IF EXISTS checkout_acceptances');
\DB::statement('drop table IF EXISTS companies');
\DB::statement('drop table IF EXISTS components');
\DB::statement('drop table IF EXISTS components_assets');
\DB::statement('drop table IF EXISTS consumables_users');
\DB::statement('drop table IF EXISTS consumables');
\DB::statement('drop table IF EXISTS custom_field_custom_fieldset');
\DB::statement('drop table IF EXISTS custom_fields');
\DB::statement('drop table IF EXISTS custom_fieldsets');
\DB::statement('drop table IF EXISTS depreciations');
\DB::statement('drop table IF EXISTS departments');
\DB::statement('drop table IF EXISTS groups');
\DB::statement('drop table IF EXISTS history');
\DB::statement('drop table IF EXISTS kits');
\DB::statement('drop table IF EXISTS kits_accessories');
\DB::statement('drop table IF EXISTS kits_consumables');
\DB::statement('drop table IF EXISTS kits_licenses');
\DB::statement('drop table IF EXISTS kits_models');
\DB::statement('drop table IF EXISTS models_custom_fields');
\DB::statement('drop table IF EXISTS permission_groups');
\DB::statement('drop table IF EXISTS license_seats');
\DB::statement('drop table IF EXISTS licenses');
\DB::statement('drop table IF EXISTS locations');
\DB::statement('drop table IF EXISTS login_attempts');
\DB::statement('drop table IF EXISTS manufacturers');
\DB::statement('drop table IF EXISTS models');
\DB::statement('drop table IF EXISTS migrations');
\DB::statement('drop table IF EXISTS oauth_access_tokens');
\DB::statement('drop table IF EXISTS oauth_auth_codes');
\DB::statement('drop table IF EXISTS oauth_clients');
\DB::statement('drop table IF EXISTS oauth_personal_access_clients');
\DB::statement('drop table IF EXISTS oauth_refresh_tokens');
\DB::statement('drop table IF EXISTS password_resets');
\DB::statement('drop table IF EXISTS requested_assets');
\DB::statement('drop table IF EXISTS requests');
\DB::statement('drop table IF EXISTS settings');
\DB::statement('drop table IF EXISTS status_labels');
\DB::statement('drop table IF EXISTS suppliers');
\DB::statement('drop table IF EXISTS throttle');
\DB::statement('drop table IF EXISTS users_groups');
\DB::statement('drop table IF EXISTS users');
\DB::statement('drop table IF EXISTS imports');
if (!$this->option('force')) {
$confirmation = $this->confirm("\n****************************************************\nTHIS WILL DELETE ALL OF THE DATA IN YOUR DATABASE. \nThere is NO undo. This WILL destroy ALL of your data, \nINCLUDING ANY non-Snipe-IT tables you have in this database. \n****************************************************\n\nDo you wish to continue? No backsies! ");
if (!$confirmation) {
$this->error('ABORTING');
exit(-1);
}
}
// List all the tables in the database so we don't have to worry about missing some as the app grows
$tables = DB::connection()->getDoctrineSchemaManager()->listTableNames();
$except_tables = [
'oauth_access_tokens',
'oauth_clients',
'oauth_personal_access_clients',
'migrations',
'settings',
'users',
];
// We only need to find out what these are so we can nuke these columns on the assets table.
$custom_fields = CustomField::get();
foreach ($custom_fields as $custom_field) {
$this->info('DROP the '.$custom_field->db_column.' column from assets as well.');
if (\Schema::hasColumn('assets', $custom_field->db_column)) {
\Schema::table('assets', function ($table) use ($custom_field) {
$table->dropColumn($custom_field->db_column);
});
}
}
foreach ($tables as $table) {
if (in_array($table, $except_tables)) {
$this->info($table. ' is SKIPPED.');
} else {
\DB::statement('truncate '.$table);
$this->info($table. ' is TRUNCATED.');
}
}
// Leave in the demo oauth keys so we don't have to reset them every day in the demos
\DB::statement('delete from oauth_clients WHERE id > 2');
\DB::statement('delete from oauth_access_tokens WHERE id > 2');
}
}
}

View File

@@ -66,9 +66,6 @@ class ResetDemoSettings extends Command
$settings->version_footer = 'on';
$settings->support_footer = null;
$settings->saml_enabled = '0';
$settings->saml_sp_entitiyid = '0';
$settings->saml_sp_acs_url = null;
$settings->saml_sp_sls_url = null;
$settings->saml_sp_x509cert = null;
$settings->saml_idp_metadata = null;
$settings->saml_attr_mapping_username = null;
@@ -84,7 +81,9 @@ class ResetDemoSettings extends Command
$user->save();
}
\Storage::disk('public')->put('snipe-logo.png', file_get_contents(public_path('img/demo/snipe-logo.png')));
\Storage::disk('public')->put('snipe-logo-lg.png', file_get_contents(public_path('img/demo/snipe-logo-lg.png')));
}
}

View File

@@ -0,0 +1,297 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use ZipArchive;
class RestoreFromBackup extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'snipeit:restore
{--force : Skip the danger prompt; assuming you hit "y"}
{filename : The zip file to be migrated}
{--no-progress : Don\'t show a progress bar}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Restore from a previously created backup';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$dir = getcwd();
print "Current working directory is: $dir\n";
//
$filename = $this->argument('filename');
if (!$filename) {
return $this->error("Missing required filename");
}
if (!$this->option('force') && !$this->confirm('Are you sure you wish to restore from the given backup file? This can lead to MASSIVE DATA LOSS!')) {
return $this->error("Data loss not confirmed");
}
if (config('database.default') != 'mysql') {
return $this->error("DB_CONNECTION must be MySQL in order to perform a restore. Detected: ".config('database.default'));
}
$za = new ZipArchive();
$errcode = $za->open($filename/* , ZipArchive::RDONLY */); // that constant only exists in PHP 7.4 and higher
if ($errcode !== true) {
$errors = [
ZipArchive::ER_EXISTS => "File already exists.",
ZipArchive::ER_INCONS => "Zip archive inconsistent.",
ZipArchive::ER_INVAL => "Invalid argument.",
ZipArchive::ER_MEMORY => "Malloc failure.",
ZipArchive::ER_NOENT => "No such file.",
ZipArchive::ER_NOZIP => "Not a zip archive.",
ZipArchive::ER_OPEN => "Can't open file.",
ZipArchive::ER_READ => "Read error.",
ZipArchive::ER_SEEK => "Seek error."
];
return $this->error("Could not access file: ".$filename." - ".array_key_exists($errcode,$errors) ? $errors[$errcode] : " Unknown reason: $errcode");
}
$private_dirs = [
'storage/private_uploads/assets', // these are asset _files_, not the pictures.
'storage/private_uploads/audits',
'storage/private_uploads/imports',
'storage/private_uploads/assetmodels',
'storage/private_uploads/users',
'storage/private_uploads/licenses',
'storage/private_uploads/signatures'
];
$private_files = [
'storage/oauth-private.key',
'storage/oauth-public.key'
];
$public_dirs = [
'public/uploads/companies',
'public/uploads/components',
'public/uploads/categories',
'public/uploads/manufacturers',
//'public/uploads/barcodes', // we don't want this, let the barcodes be regenerated
'public/uploads/consumables',
'public/uploads/departments',
'public/uploads/avatars',
'public/uploads/suppliers',
'public/uploads/assets', // these are asset _pictures_, not asset files
'public/uploads/locations',
'public/uploads/accessories',
'public/uploads/models',
'public/uploads/categories',
'public/uploads/avatars',
'public/uploads/manufacturers'
];
$public_files = [
'public/uploads/logo.*',
'public/uploads/setting-email_logo*',
'public/uploads/setting-label_logo*',
'public/uploads/setting-logo*',
'public/uploads/favicon.*',
'public/uploads/favicon-uploaded.*'
];
$all_files = $private_dirs + $public_dirs;
$sqlfiles = [];
$sqlfile_indices = [];
$interesting_files = [];
$boring_files = [];
for ($i=0; $i<$za->numFiles;$i++) {
$stat_results = $za->statIndex($i);
// echo "index: $i\n";
// print_r($stat_results);
$raw_path = $stat_results['name'];
if(strpos($raw_path,'\\')!==false) { //found a backslash, swap it to forward-slash
$raw_path = strtr($raw_path,'\\','/');
//print "Translating file: ".$stat_results['name']." to: ".$raw_path."\n";
}
// skip macOS resource fork files (?!?!?!)
if(strpos($raw_path,"__MACOSX")!==false && strpos($raw_path,"._") !== false) {
//print "SKIPPING macOS Resource fork file: $raw_path\n";
$boring_files[] = $raw_path;
continue;
}
if(@pathinfo($raw_path)['extension'] == "sql") {
print "Found a sql file!\n";
$sqlfiles[] = $raw_path;
$sqlfile_indices[] = $i;
continue;
}
foreach(array_merge($private_dirs,$public_dirs) as $dir) {
$last_pos = strrpos($raw_path,$dir.'/');
if($last_pos !== false ) {
//print("INTERESTING - last_pos is $last_pos when searching $raw_path for $dir - last_pos+strlen(\$dir) is: ".($last_pos+strlen($dir))." and strlen(\$rawpath) is: ".strlen($raw_path)."\n");
//print("We would copy $raw_path to $dir.\n"); //FIXME append to a path?
$interesting_files[$raw_path] = ['dest' =>$dir, 'index' => $i];
continue 2;
if($last_pos + strlen($dir) +1 == strlen($raw_path)) {
// we don't care about that; we just want files with the appropriate prefix
//print("FOUND THE EXACT DIRECTORY: $dir AT: $raw_path!!!\n");
}
}
}
$good_extensions = ["png","gif","jpg","svg","jpeg","doc","docx","pdf","txt",
"zip","rar","xls","xlsx","lic","xml","rtf", "webp","key","ico"];
foreach(array_merge($private_files, $public_files) as $file) {
$has_wildcard = (strpos($file,"*") !== false);
if($has_wildcard) {
$file = substr($file,0,-1); //trim last character (which should be the wildcard)
}
$last_pos = strrpos($raw_path,$file); // no trailing slash!
if($last_pos !== false ) {
$extension = strtolower(pathinfo($raw_path, PATHINFO_EXTENSION));
if(!in_array($extension, $good_extensions)) {
$this->warn("Potentially unsafe file ".$raw_path." is being skipped");
$boring_files[] = $raw_path;
continue 2;
}
//print("INTERESTING - last_pos is $last_pos when searching $raw_path for $file - last_pos+strlen(\$file) is: ".($last_pos+strlen($file))." and strlen(\$rawpath) is: ".strlen($raw_path)."\n");
//no wildcards found in $file, process 'normally'
if($last_pos + strlen($file) == strlen($raw_path) || $has_wildcard) { //again, no trailing slash. or this is a wildcard and we just take it.
// print("FOUND THE EXACT FILE: $file AT: $raw_path!!!\n"); //we *do* care about this, though.
$interesting_files[$raw_path] = ['dest' => dirname($file),'index' => $i];
continue 2;
}
}
}
$boring_files[] = $raw_path; //if we've gotten to here and haven't continue'ed our way into the next iteration, we don't want this file
} // end of pre-processing the ZIP file for-loop
// print_r($interesting_files);exit(-1);
if( count($sqlfiles) != 1) {
return $this->error("There should be exactly *one* sql backup file found, found: ".( count($sqlfiles) == 0 ? "None" : implode(", ",$sqlfiles)));
}
if( strpos($sqlfiles[0], "db-dumps") === false ) {
//return $this->error("SQL backup file is missing 'db-dumps' component of full pathname: ".$sqlfiles[0]);
//older Snipe-IT installs don't have the db-dumps subdirectory component
}
//how to invoke the restore?
$pipes = [];
$env_vars = getenv();
$env_vars['MYSQL_PWD'] = config("database.connections.mysql.password");
$proc_results = proc_open("mysql -h ".escapeshellarg(config('database.connections.mysql.host'))." -u ".escapeshellarg(config('database.connections.mysql.username'))." ".escapeshellarg(config('database.connections.mysql.database')), // yanked -p since we pass via ENV
[0 => ['pipe','r'],1 => ['pipe','w'],2 => ['pipe','w']],
$pipes,
null,
$env_vars); // this is not super-duper awesome-secure, but definitely more secure than showing it on the CLI, or dropping temporary files with passwords in them.
if($proc_results === false) {
return $this->error("Unable to invoke mysql via CLI");
}
// $this->info("Stdout says? ".fgets($pipes[1])); //FIXME: I think we might need to set non-blocking mode to use this properly?
// $this->info("Stderr says? ".fgets($pipes[2])); //FIXME: ditto, same.
// should we read stdout?
// fwrite($pipes[0],config("database.connections.mysql.password")."\n"); //this doesn't work :(
//$sql_contents = fopen($sqlfiles[0], "r"); //NOPE! This isn't a real file yet, silly-billy!
$sql_stat = $za->statIndex($sqlfile_indices[0]);
//$this->info("SQL Stat is: ".print_r($sql_stat,true));
$sql_contents = $za->getStream($sql_stat['name']);
if ($sql_contents === false) {
$stdout = fgets($pipes[1]);
$this->info($stdout);
$stderr = fgets($pipes[2]);
$this->info($stderr);
return false;
}
while(($buffer = fgets($sql_contents)) !== false ) {
//$this->info("Buffer is: '$buffer'");
$bytes_written = fwrite($pipes[0],$buffer);
if($bytes_written === false) {
$stdout = fgets($pipes[1]);
$this->info($stdout);
$stderr = fgets($pipes[2]);
$this->info($stderr);
return false;
}
}
fclose($pipes[0]);
fclose($sql_contents);
$this->line(stream_get_contents($pipes[1]));
fclose($pipes[1]);
$this->error(stream_get_contents($pipes[2]));
fclose($pipes[2]);
//wait, have to do fclose() on all pipes first?
$close_results = proc_close($proc_results);
if($close_results != 0) {
return $this->error("There may have been a problem with the database import: Error number ".$close_results);
}
//and now copy the files over too (right?)
//FIXME - we don't prune the filesystem space yet!!!!
if($this->option('no-progress')) {
$bar = null;
} else {
$bar = $this->output->createProgressBar(count($interesting_files));
}
foreach($interesting_files AS $pretty_file_name => $file_details) {
$ugly_file_name = $za->statIndex($file_details['index'])['name'];
$fp = $za->getStream($ugly_file_name);
//$this->info("Weird problem, here are file details? ".print_r($file_details,true));
$migrated_file = fopen($file_details['dest']."/".basename($pretty_file_name),"w");
while(($buffer = fgets($fp))!== false) {
fwrite($migrated_file,$buffer);
}
fclose($migrated_file);
fclose($fp);
//$this->info("Wrote $ugly_file_name to $pretty_file_name");
if($bar) {
$bar->advance();
}
}
if($bar) {
$bar->finish();
$this->line("");
} else {
$this->info(count($interesting_files)." files were succesfully transferred");
}
foreach($boring_files as $boring_file) {
$this->warn($boring_file." was skipped.");
}
}
}

View File

@@ -8,6 +8,7 @@ use App\Notifications\ExpectedCheckinAdminNotification;
use App\Notifications\ExpectedCheckinNotification;
use Carbon\Carbon;
use Illuminate\Console\Command;
use App\Models\Recipients\AlertRecipient;
class SendExpectedCheckinAlerts extends Command
{

View File

@@ -8,6 +8,7 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use App\Helpers\Helper;
use Illuminate\Validation\ValidationException;
use Log;
use JsonException;
class Handler extends ExceptionHandler
@@ -25,6 +26,8 @@ class Handler extends ExceptionHandler
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
\Intervention\Image\Exception\NotSupportedException::class,
\League\OAuth2\Server\Exception\OAuthServerException::class,
JsonException::class
];
/**
@@ -38,7 +41,7 @@ class Handler extends ExceptionHandler
public function report(Exception $exception)
{
if ($this->shouldReport($exception)) {
Log::error($exception);
\Log::error($exception);
return parent::report($exception);
}
}
@@ -59,6 +62,12 @@ class Handler extends ExceptionHandler
return redirect()->back()->with('error', trans('general.token_expired'));
}
// Invalid JSON exception
// TODO: don't understand why we have to do this when we have the invalidJson() method, below, but, well, whatever
if ($e instanceof JsonException) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'invalid JSON'), 422);
}
// Handle Ajax requests that fail because the model doesn't exist
if ($request->ajax() || $request->wantsJson()) {
@@ -105,7 +114,7 @@ class Handler extends ExceptionHandler
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthorized.'], 401);
return response()->json(['error' => 'Unauthorized or unauthenticated.'], 401);
}
return redirect()->guest('login');
@@ -120,6 +129,6 @@ class Handler extends ExceptionHandler
*/
protected function invalidJson($request, ValidationException $exception)
{
return response()->json(Helper::formatStandardApiResponse('error', null, $exception->errors(), 400));
return response()->json(Helper::formatStandardApiResponse('error', null, $exception->errors(), 422));
}
}

View File

@@ -46,7 +46,10 @@ class Helper
public static function formatCurrencyOutput($cost)
{
if (is_numeric($cost)) {
return number_format($cost, 2, '.', '');
if (Setting::getSettings()->digit_separator=='1.234,56') {
return number_format($cost, 2, ',', '.');
}
return number_format($cost, 2, '.', ',');
}
// It's already been parsed.
return $cost;
@@ -64,7 +67,7 @@ class Helper
{
$colors = [
"#008941",
"#FF4A46",
"#FF851B",
"#006FA6",
"#A30059",
"#1CE6FF",
@@ -400,6 +403,19 @@ class Helper
*/
public static function ParseFloat($floatString)
{
/*******
*
* WARNING: This does conversions based on *locale* - a Unix-ey-like thing.
*
* Everything else in the system tends to convert based on the Snipe-IT settings
*
* So it's very likely this is *not* what you want - instead look for the new
*
* ParseCurrency($currencyString)
*
* Which should be directly below here
*
*/
$LocaleInfo = localeconv();
$floatString = str_replace(",", "", $floatString);
$floatString = str_replace($LocaleInfo["decimal_point"], ".", $floatString);
@@ -413,6 +429,26 @@ class Helper
$floatString = str_replace($currencySymbol, '', $floatString);
return floatval($floatString);
}
/**
* Format currency using comma or period for thousands, and period or comma for decimal, based on settings.
*
* @author [B. Wetherington] [<bwetherington@grokability.com>]
* @since [v5.2]
* @return Float
*/
public static function ParseCurrency($currencyString) {
$without_currency = str_replace(Setting::getSettings()->default_currency, '', $currencyString); //generally shouldn't come up, since we don't do this in fields, but just in case it does...
if(Setting::getSettings()->digit_separator=='1.234,56') {
//EU format
$without_thousands = str_replace('.', '', $without_currency);
$corrected_decimal = str_replace(',', '.', $without_thousands);
} else {
$without_thousands = str_replace(',', '', $without_currency);
$corrected_decimal = $without_thousands; // decimal is already OK
}
return floatval($corrected_decimal);
}
/**
* Get the list of status labels in an array to make a dropdown menu
@@ -428,6 +464,26 @@ class Helper
return $statuslabel_list;
}
/**
* Get the list of deployable status labels in an array to make a dropdown menu
*
* @todo This should probably be a selectlist, same as the other endpoints
* and we should probably add to the API controllers to make sure that
* the status_id submitted is actually really deployable.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v5.1.0]
* @return Array
*/
public static function deployableStatusLabelList()
{
$statuslabel_list = Statuslabel::where('deployable', '=', '1')->orderBy('default_label', 'desc')
->orderBy('name','asc')
->orderBy('deployable','desc')
->pluck('name', 'id')->toArray();
return $statuslabel_list;
}
/**
* Get the list of status label types in an array to make a dropdown menu
*
@@ -754,10 +810,9 @@ class Helper
/**
* Gracefully handle decrypting the legacy data (encrypted via mcrypt) and use the new
* decryption method instead.
* Gracefully handle decrypting encrypted fields (custom fields, etc).
*
* This is not currently used, but will be.
* @todo allow this to handle more than just strings (arrays, etc)
*
* @author A. Gianotto
* @since 3.6
@@ -868,7 +923,8 @@ class Helper
// If upload_max_size is less, then reduce. Except if upload_max_size is
// zero, which indicates no limit.
$upload_max = Helper::parse_size(ini_get('upload_max_filesize'));
if ($upload_max > 0 && $upload_max < $max_size) {
if ($upload_max > 0 && $upload_max < $post_max_size) {
$max_size = ini_get('upload_max_filesize');
}
}
@@ -983,38 +1039,38 @@ class Helper
* @return string path to uploaded image or false if something went wrong
*/
public static function processUploadedImage(String $image_data, String $save_path) {
if ($image_data != null && $save_path != null) {
// After modification, the image is prefixed by mime info like the following:
// data:image/jpeg;base64,; This causes the image library to be unhappy, so we need to remove it.
$header = explode(';', $image_data, 2)[0];
// Grab the image type from the header while we're at it.
$extension = substr($header, strpos($header, '/')+1);
// Start reading the image after the first comma, postceding the base64.
$image = substr($image_data, strpos($image_data, ',')+1);
$file_name = str_random(25).".".$extension;
$directory= public_path($save_path);
// Check if the uploads directory exists. If not, try to create it.
if (!file_exists($directory)) {
mkdir($directory, 0755, true);
}
$path = public_path($save_path.$file_name);
try {
Image::make($image)->resize(500, 500, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
} catch (\Exception $e) {
return false;
}
return $file_name;
if ($image_data == null || $save_path == null) {
return false;
}
return false;
// After modification, the image is prefixed by mime info like the following:
// data:image/jpeg;base64,; This causes the image library to be unhappy, so we need to remove it.
$header = explode(';', $image_data, 2)[0];
// Grab the image type from the header while we're at it.
$extension = substr($header, strpos($header, '/')+1);
// Start reading the image after the first comma, postceding the base64.
$image = substr($image_data, strpos($image_data, ',')+1);
$file_name = str_random(25).".".$extension;
$directory= public_path($save_path);
// Check if the uploads directory exists. If not, try to create it.
if (!file_exists($directory)) {
mkdir($directory, 0755, true);
}
$path = public_path($save_path.$file_name);
try {
Image::make($image)->resize(500, 500, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
} catch (\Exception $e) {
return false;
}
return $file_name;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Helpers;
use Illuminate\Support\Facades\Storage;
class StorageHelper
{
static function downloader($filename, $disk = 'default') {
if($disk == 'default') {
$disk = config('filesystems.default');
}
switch(config("filesystems.disks.$disk.driver")) {
case 'local':
return response()->download(Storage::disk($disk)->path($filename)); //works for PRIVATE or public?!
case 's3':
return redirect()->away(Storage::disk($disk)->temporaryUrl($filename, now()->addMinutes(5))); //works for private or public, I guess?
default:
return Storage::disk($disk)->download($filename);
}
}
}

View File

@@ -74,7 +74,7 @@ class AccessoriesController extends Controller
$accessory->manufacturer_id = request('manufacturer_id');
$accessory->model_number = request('model_number');
$accessory->purchase_date = request('purchase_date');
$accessory->purchase_cost = Helper::ParseFloat(request('purchase_cost'));
$accessory->purchase_cost = Helper::ParseCurrency(request('purchase_cost'));
$accessory->qty = request('qty');
$accessory->user_id = Auth::user()->id;
$accessory->supplier_id = request('supplier_id');
@@ -137,7 +137,7 @@ class AccessoriesController extends Controller
$accessory->order_number = request('order_number');
$accessory->model_number = request('model_number');
$accessory->purchase_date = request('purchase_date');
$accessory->purchase_cost = request('purchase_cost');
$accessory->purchase_cost = Helper::ParseCurrency(request('purchase_cost'));
$accessory->qty = request('qty');
$accessory->supplier_id = request('supplier_id');

View File

@@ -13,6 +13,7 @@ use Carbon\Carbon;
use Auth;
use DB;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
class AccessoriesController extends Controller
{
@@ -26,9 +27,23 @@ class AccessoriesController extends Controller
public function index(Request $request)
{
$this->authorize('view', Accessory::class);
$allowed_columns = ['id','name','model_number','eol','notes','created_at','min_amt','company_id'];
// This array is what determines which fields should be allowed to be sorted on ON the table itself, no relations
// Relations will be handled in query scopes a little further down.
$allowed_columns =
[
'id',
'name',
'model_number',
'eol',
'notes',
'created_at',
'min_amt',
'company_id'
];
$accessories = Accessory::with('category', 'company', 'manufacturer', 'users', 'location');
$accessories = Accessory::select('accessories.*')->with('category', 'company', 'manufacturer', 'users', 'location', 'supplier');
if ($request->filled('search')) {
$accessories = $accessories->TextSearch($request->input('search'));
@@ -50,6 +65,10 @@ class AccessoriesController extends Controller
$accessories->where('supplier_id','=',$request->input('supplier_id'));
}
if ($request->filled('location_id')) {
$accessories->where('location_id','=',$request->input('location_id'));
}
// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
// case we override with the actual count, so we should return 0 items.
$offset = (($accessories) && ($request->get('offset') > $accessories->count())) ? $accessories->count() : $request->get('offset', 0);
@@ -57,24 +76,32 @@ class AccessoriesController extends Controller
// Check to make sure the limit is not higher than the max allowed
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';
$sort_override = $request->input('sort');
$column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'created_at';
switch ($sort) {
switch ($sort_override) {
case 'category':
$accessories = $accessories->OrderCategory($order);
break;
case 'company':
$accessories = $accessories->OrderCompany($order);
break;
case 'location':
$accessories = $accessories->OrderLocation($order);
break;
case 'manufacturer':
$accessories = $accessories->OrderManufacturer($order);
break;
case 'supplier':
$accessories = $accessories->OrderSupplier($order);
break;
default:
$accessories = $accessories->orderBy($sort, $order);
$accessories = $accessories->orderBy($column_sort, $order);
break;
}
$accessories->orderBy($sort, $order);
$total = $accessories->count();
$accessories = $accessories->skip($offset)->take($limit)->get();
return (new AccessoriesTransformer)->transformAccessories($accessories, $total);
@@ -86,14 +113,15 @@ class AccessoriesController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Accessory::class);
$accessory = new Accessory;
$accessory->fill($request->all());
$accessory = $request->handleImages($accessory);
if ($accessory->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $accessory, trans('admin/accessories/message.create.success')));
@@ -165,9 +193,13 @@ class AccessoriesController extends Controller
if ($request->filled('search')) {
$accessory_users = $accessory->users()
->where('first_name', 'like', '%'.$request->input('search').'%')
->orWhere('last_name', 'like', '%'.$request->input('search').'%')
->get();
->where(function ($query) use ($request) {
$search_str = '%' . $request->input('search') . '%';
$query->where('first_name', 'like', $search_str)
->orWhere('last_name', 'like', $search_str)
->orWhere('note', 'like', $search_str);
})
->get();
$total = $accessory_users->count();
}
@@ -180,15 +212,16 @@ class AccessoriesController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', Accessory::class);
$accessory = Accessory::findOrFail($id);
$accessory->fill($request->all());
$accessory = $request->handleImages($accessory);
if ($accessory->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $accessory, trans('admin/accessories/message.update.success')));
@@ -254,7 +287,8 @@ class AccessoriesController extends Controller
'accessory_id' => $accessory->id,
'created_at' => Carbon::now(),
'user_id' => Auth::id(),
'assigned_to' => $request->get('assigned_to')
'assigned_to' => $request->get('assigned_to'),
'note' => $request->get('note')
]);
$accessory->logCheckout($request->input('note'), $user);
@@ -286,7 +320,7 @@ class AccessoriesController extends Controller
$accessory = Accessory::find($accessory_user->accessory_id);
$this->authorize('checkin', $accessory);
$logaction = $accessory->logCheckin(User::find($accessoryUserId), $request->input('note'));
$logaction = $accessory->logCheckin(User::find($accessory_user->user_id), $request->input('note'));
// Was the accessory updated?
if (DB::table('accessories_users')->where('id', '=', $accessory_user->id)->delete()) {

View File

@@ -105,7 +105,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance = new AssetMaintenance();
$assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = e($request->input('cost'));
$assetMaintenance->cost = Helper::ParseCurrency($request->input('cost'));
$assetMaintenance->notes = e($request->input('notes'));
$asset = Asset::find(e($request->input('asset_id')));
@@ -162,7 +162,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance->supplier_id = e($request->input('supplier_id'));
$assetMaintenance->is_warranty = e($request->input('is_warranty'));
$assetMaintenance->cost = Helper::ParseFloat(e($request->input('cost')));
$assetMaintenance->cost = Helper::ParseCurrency($request->input('cost'));
$assetMaintenance->notes = e($request->input('notes'));
$asset = Asset::find(request('asset_id'));

View File

@@ -9,6 +9,7 @@ use App\Http\Transformers\SelectlistTransformer;
use App\Models\Asset;
use App\Models\AssetModel;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Storage;
/**
@@ -30,7 +31,20 @@ class AssetModelsController extends Controller
public function index(Request $request)
{
$this->authorize('view', AssetModel::class);
$allowed_columns = ['id','image','name','model_number','eol','notes','created_at','manufacturer','requestable', 'assets_count'];
$allowed_columns =
[
'id',
'image',
'name',
'model_number',
'eol',
'notes',
'created_at',
'manufacturer',
'requestable',
'assets_count',
'category'
];
$assetmodels = AssetModel::select([
'models.id',
@@ -53,7 +67,7 @@ class AssetModelsController extends Controller
if ($request->filled('status')) {
if ($request->input('status')=='deleted') {
$assetmodels->onlyTrashed();
}
@@ -75,13 +89,14 @@ class AssetModelsController extends Controller
case 'manufacturer':
$assetmodels->OrderManufacturer($order);
break;
case 'category':
$assetmodels->OrderCategory($order);
break;
default:
$assetmodels->orderBy($sort, $order);
break;
}
$total = $assetmodels->count();
$assetmodels = $assetmodels->skip($offset)->take($limit)->get();
return (new AssetModelsTransformer)->transformAssetModels($assetmodels, $total);
@@ -93,14 +108,15 @@ class AssetModelsController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', AssetModel::class);
$assetmodel = new AssetModel;
$assetmodel->fill($request->all());
$assetmodel = $request->handleImages($assetmodel);
if ($assetmodel->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $assetmodel, trans('admin/models/message.create.success')));
@@ -145,16 +161,17 @@ class AssetModelsController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', AssetModel::class);
$assetmodel = AssetModel::findOrFail($id);
$assetmodel->fill($request->all());
$assetmodel = $request->handleImages($assetmodel);
/**
* Allow custom_fieldset_id to override and populate fieldset_id.
* This is stupid, but required for legacy API support.
@@ -217,6 +234,7 @@ class AssetModelsController extends Controller
public function selectlist(Request $request)
{
$this->authorize('view.selectlists');
$assetmodels = AssetModel::select([
'models.id',
'models.name',
@@ -239,17 +257,17 @@ class AssetModelsController extends Controller
$assetmodel->use_text = '';
if ($settings->modellistCheckedValue('category')) {
$assetmodel->use_text .= (($assetmodel->category) ? e($assetmodel->category->name).' - ' : '');
$assetmodel->use_text .= (($assetmodel->category) ? $assetmodel->category->name.' - ' : '');
}
if ($settings->modellistCheckedValue('manufacturer')) {
$assetmodel->use_text .= (($assetmodel->manufacturer) ? e($assetmodel->manufacturer->name).' ' : '');
$assetmodel->use_text .= (($assetmodel->manufacturer) ? $assetmodel->manufacturer->name.' ' : '');
}
$assetmodel->use_text .= e($assetmodel->name);
$assetmodel->use_text .= $assetmodel->name;
if (($settings->modellistCheckedValue('model_number')) && ($assetmodel->model_number!='')) {
$assetmodel->use_text .= ' (#'.e($assetmodel->model_number).')';
$assetmodel->use_text .= ' (#'.$assetmodel->model_number.')';
}
$assetmodel->use_image = ($settings->modellistCheckedValue('image') && ($assetmodel->image)) ? Storage::disk('public')->url('models/'.e($assetmodel->image)) : null;

View File

@@ -1,13 +1,16 @@
<?php
namespace App\Http\Controllers\Api;
use App\Events\CheckoutableCheckedIn;
use Illuminate\Support\Facades\Gate;
use App\Helpers\Helper;
use App\Http\Controllers\Controller;
use App\Http\Requests\AssetCheckoutRequest;
use App\Http\Transformers\AssetsTransformer;
use App\Http\Transformers\DepreciationReportTransformer;
use App\Http\Transformers\LicensesTransformer;
use App\Http\Transformers\SelectlistTransformer;
use App\Models\Actionlog;
use App\Models\Asset;
use App\Models\AssetModel;
use App\Models\Company;
@@ -20,12 +23,14 @@ use Auth;
use Carbon\Carbon;
use DB;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use Input;
use Paginator;
use Slack;
use Str;
use TCPDF;
use Validator;
use Route;
/**
@@ -46,10 +51,33 @@ class AssetsController extends Controller
* @since [v4.0]
* @return JsonResponse
*/
public function index(Request $request, $audit = null)
public function index(Request $request, $audit = null)
{
$this->authorize('index', Asset::class);
\Log::debug(Route::currentRouteName());
$filter_non_deprecable_assets = false;
/**
* This looks MAD janky (and it is), but the AssetsController@index does a LOT of heavy lifting throughout the
* app. This bit here just makes sure that someone without permission to view assets doesn't
* end up with priv escalations because they asked for a different endpoint.
*
* Since we never gave the specification for which transformer to use before, it should default
* gracefully to just use the AssetTransformer by default, which shouldn't break anything.
*
* It was either this mess, or repeating ALL of the searching and sorting and filtering code,
* which would have been far worse of a mess. *sad face* - snipe (Sept 1, 2021)
*/
if (Route::currentRouteName()=='api.depreciation-report.index') {
$filter_non_deprecable_assets = true;
$transformer = 'App\Http\Transformers\DepreciationReportTransformer';
$this->authorize('reports.view');
} else {
$transformer = 'App\Http\Transformers\AssetsTransformer';
$this->authorize('index', Asset::class);
}
$settings = Setting::getSettings();
$allowed_columns = [
@@ -88,13 +116,28 @@ class AssetsController extends Controller
}
$assets = Company::scopeCompanyables(Asset::select('assets.*'),"company_id","assets")
->with('location', 'assetstatus', 'assetlog', 'company', 'defaultLoc','assignedTo',
'model.category', 'model.manufacturer', 'model.fieldset','supplier');
->with('location', 'assetstatus', 'company', 'defaultLoc','assignedTo',
'model.category', 'model.manufacturer', 'model.fieldset','supplier'); //it might be tempting to add 'assetlog' here, but don't. It blows up update-heavy users.
if ($filter_non_deprecable_assets) {
$non_deprecable_models = AssetModel::select('id')->whereNotNull('depreciation_id')->get();
$assets->InModelList($non_deprecable_models->toArray());
}
// These are used by the API to query against specific ID numbers.
// They are also used by the individual searches on detail pages like
// locations, etc.
// Search custom fields by column name
foreach ($all_custom_fields as $field) {
if ($request->filled($field->db_column_name())) {
$assets->where($field->db_column_name(), '=', $request->input($field->db_column_name()));
}
}
if ($request->filled('status_id')) {
$assets->where('assets.status_id', '=', $request->input('status_id'));
}
@@ -141,8 +184,6 @@ class AssetsController extends Controller
}
$request->filled('order_number') ? $assets = $assets->where('assets.order_number', '=', e($request->get('order_number'))) : '';
$offset = (($assets) && (request('offset') > $assets->count())) ? 0 : request('offset', 0);
// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
// case we override with the actual count, so we should return 0 items.
@@ -245,7 +286,7 @@ class AssetsController extends Controller
$assets->TextSearch($request->input('search'));
}
// This is kinda gross, but we need to do this because the Bootstrap Tables
// API passes custom field ordering as custom_fields.fieldname, and we have to strip
// that out to let the default sorter below order them correctly on the assets table.
@@ -294,8 +335,25 @@ class AssetsController extends Controller
$total = $assets->count();
$assets = $assets->skip($offset)->take($limit)->get();
// dd($assets);
return (new AssetsTransformer)->transformAssets($assets, $total);
/**
* Include additional associated relationships
*/
if ($request->input('components')) {
$assets->loadMissing(['components' => function ($query) {
$query->orderBy('created_at', 'desc');
}]);
}
/**
* Here we're just determining which Transformer (via $transformer) to use based on the
* variables we set earlier on in this method - we default to AssetsTransformer.
*/
return (new $transformer)->transformAssets($assets, $total, $request);
}
@@ -307,11 +365,11 @@ class AssetsController extends Controller
* @since [v4.2.1]
* @return JsonResponse
*/
public function showByTag($tag)
public function showByTag(Request $request, $tag)
{
if ($asset = Asset::with('assetstatus')->with('assignedTo')->where('asset_tag',$tag)->first()) {
$this->authorize('view', $asset);
return (new AssetsTransformer)->transformAsset($asset);
return (new AssetsTransformer)->transformAsset($asset, $request);
}
return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200);
@@ -325,18 +383,24 @@ class AssetsController extends Controller
* @since [v4.2.1]
* @return JsonResponse
*/
public function showBySerial($serial)
public function showBySerial(Request $request, $serial)
{
$this->authorize('index', Asset::class);
if ($assets = Asset::with('assetstatus')->with('assignedTo')
->withTrashed()->where('serial',$serial)->get()) {
return (new AssetsTransformer)->transformAssets($assets, $assets->count());
$assets = Asset::with('assetstatus')->with('assignedTo');
if ($request->input('deleted', 'false') === 'true') {
$assets = $assets->withTrashed();
}
return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200);
$assets = $assets->where('serial', $serial)->get();
if ($assets) {
return (new AssetsTransformer)->transformAssets($assets, $assets->count());
} else {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200);
}
}
/**
* Returns JSON with information about an asset for detail view.
*
@@ -345,17 +409,17 @@ class AssetsController extends Controller
* @since [v4.0]
* @return JsonResponse
*/
public function show($id)
public function show(Request $request, $id)
{
if ($asset = Asset::with('assetstatus')->with('assignedTo')->withTrashed()
->withCount('checkins as checkins_count', 'checkouts as checkouts_count', 'userRequests as user_requests_count')->findOrFail($id)) {
$this->authorize('view', $asset);
return (new AssetsTransformer)->transformAsset($asset);
return (new AssetsTransformer)->transformAsset($asset, $request->input('components') );
}
}
public function licenses($id)
public function licenses(Request $request, $id)
{
$this->authorize('view', Asset::class);
$this->authorize('view', License::class);
@@ -426,11 +490,11 @@ class AssetsController extends Controller
* Accepts a POST request to create a new asset
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @param Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @since [v4.0]
* @return JsonResponse
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Asset::class);
@@ -451,7 +515,7 @@ class AssetsController extends Controller
$asset->depreciate = '0';
$asset->status_id = $request->get('status_id', 0);
$asset->warranty_months = $request->get('warranty_months', null);
$asset->purchase_cost = Helper::ParseFloat($request->get('purchase_cost'));
$asset->purchase_cost = Helper::ParseCurrency($request->get('purchase_cost')); // this is the API's store method, so I don't know that I want to do this? Confusing. FIXME (or not?!)
$asset->purchase_date = $request->get('purchase_date', null);
$asset->assigned_to = $request->get('assigned_to', null);
$asset->supplier_id = $request->get('supplier_id', 0);
@@ -459,34 +523,51 @@ class AssetsController extends Controller
$asset->rtd_location_id = $request->get('rtd_location_id', null);
$asset->location_id = $request->get('rtd_location_id', null);
if ($request->has('image_source') && $request->input('image_source') != "") {
$saved_image_path = Helper::processUploadedImage(
$request->input('image_source'), 'uploads/assets/'
);
/**
* this is here just legacy reasons. Api\AssetController
* used image_source once to allow encoded image uploads.
*/
if ($request->has('image_source')) {
$request->offsetSet('image', $request->offsetGet('image_source'));
}
if (!$saved_image_path) {
return response()->json(Helper::formatStandardApiResponse(
'error',
null,
trans('admin/hardware/message.create.error')
), 200);
}
$asset->image = $saved_image_path;
}
$asset = $request->handleImages($asset);
// Update custom fields in the database.
// Validation for these fields is handled through the AssetRequest form request
$model = AssetModel::find($request->get('model_id'));
if (($model) && ($model->fieldset)) {
foreach ($model->fieldset->fields as $field) {
if ($field->field_encrypted=='1') {
if (Gate::allows('admin')) {
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt($request->input($field->convertUnicodeDbSlug()));
}
} else {
$asset->{$field->convertUnicodeDbSlug()} = $request->input($field->convertUnicodeDbSlug());
// Set the field value based on what was sent in the request
$field_val = $request->input($field->convertUnicodeDbSlug(), null);
// If input value is null, use custom field's default value
if ($field_val == null) {
\Log::debug('Field value for '.$field->convertUnicodeDbSlug().' is null');
$field_val = $field->defaultValue($request->get('model_id'));
\Log::debug('Use the default fieldset value of '.$field->defaultValue($request->get('model_id')));
}
// if the field is set to encrypted, make sure we encrypt the value
if ($field->field_encrypted == '1') {
\Log::debug('This model field is encrypted in this fieldset.');
if (Gate::allows('admin')) {
// If input value is null, use custom field's default value
if (($field_val == null) && ($request->has('model_id')!='')){
$field_val = \Crypt::encrypt($field->defaultValue($request->get('model_id')));
} else {
$field_val = \Crypt::encrypt($request->input($field->convertUnicodeDbSlug()));
}
}
}
$asset->{$field->convertUnicodeDbSlug()} = $field_val;
}
}
@@ -518,11 +599,11 @@ class AssetsController extends Controller
* Accepts a POST request to update an asset
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @param Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @since [v4.0]
* @return JsonResponse
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', Asset::class);
@@ -536,32 +617,19 @@ class AssetsController extends Controller
($request->filled('company_id')) ?
$asset->company_id = Company::getIdForCurrentUser($request->get('company_id')) : '';
($request->filled('rtd_location_id')) ?
$asset->location_id = $request->get('rtd_location_id') : null;
if ($request->filled('image_source')) {
if ($request->input('image_source') == "") {
($request->filled('rtd_location_id')) ?
$asset->location_id = $request->get('rtd_location_id') : null;
$asset->image = null;
} else {
$saved_image_path = Helper::processUploadedImage(
$request->input('image_source'), 'uploads/assets/'
);
if (!$saved_image_path) {
return response()->json(Helper::formatStandardApiResponse(
'error',
null,
trans('admin/hardware/message.update.error')
), 200);
}
$asset->image = $saved_image_path;
}
}
/**
* this is here just legacy reasons. Api\AssetController
* used image_source once to allow encoded image uploads.
*/
if ($request->has('image_source')) {
$request->offsetSet('image', $request->offsetGet('image_source'));
}
$asset = $request->handleImages($asset);
// Update custom fields
if (($model = AssetModel::find($asset->model_id)) && (isset($model->fieldset))) {
foreach ($model->fieldset->fields as $field) {
@@ -636,6 +704,39 @@ class AssetsController extends Controller
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.does_not_exist')), 200);
}
/**
* Restore a soft-deleted asset.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @param int $assetId
* @since [v5.1.18]
* @return JsonResponse
*/
public function restore($assetId = null)
{
// Get asset information
$asset = Asset::withTrashed()->find($assetId);
$this->authorize('delete', $asset);
if (isset($asset->id)) {
// Restore the asset
Asset::withTrashed()->where('id', $assetId)->restore();
$logaction = new Actionlog();
$logaction->item_type = Asset::class;
$logaction->item_id = $asset->id;
$logaction->created_at = date("Y-m-d H:i:s");
$logaction->user_id = Auth::user()->id;
$logaction->logaction('restored');
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/hardware/message.restore.success')));
}
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.does_not_exist')), 200);
}
/**
@@ -759,12 +860,18 @@ class AssetsController extends Controller
$asset->status_id = $request->input('status_id');
}
$checkin_at = null;
if ($request->filled('checkin_at')) {
$checkin_at = $request->input('checkin_at');
}
if ($asset->save()) {
$asset->logCheckin($target, e($request->input('note')));
event(new CheckoutableCheckedIn($asset, $target, Auth::user(), $request->input('note'), $checkin_at));
return response()->json(Helper::formatStandardApiResponse('success', ['asset'=> e($asset->asset_tag)], trans('admin/hardware/message.checkin.success')));
}
return response()->json(Helper::formatStandardApiResponse('success', ['asset'=> e($asset->asset_tag)], trans('admin/hardware/message.checkin.error')));
return response()->json(Helper::formatStandardApiResponse('error', ['asset'=> e($asset->asset_tag)], trans('admin/hardware/message.checkin.error')));
}
@@ -812,7 +919,7 @@ class AssetsController extends Controller
$asset->location_id = $request->input('location_id');
}
$asset->last_audit_date = date('Y-m-d h:i:s');
$asset->last_audit_date = date('Y-m-d H:i:s');
if ($asset->save()) {
$log = $asset->logAudit(request('note'),request('location_id'));
@@ -824,7 +931,7 @@ class AssetsController extends Controller
}
}
return response()->json(Helper::formatStandardApiResponse('error', ['asset_tag'=> e($request->input('asset_tag'))], 'Asset with tag '.$request->input('asset_tag').' not found'));
return response()->json(Helper::formatStandardApiResponse('error', ['asset_tag'=> e($request->input('asset_tag'))], 'Asset with tag '.e($request->input('asset_tag')).' not found'));

View File

@@ -8,6 +8,7 @@ use App\Http\Transformers\CategoriesTransformer;
use App\Http\Transformers\SelectlistTransformer;
use App\Models\Category;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Storage;
class CategoriesController extends Controller
@@ -54,14 +55,16 @@ class CategoriesController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Category::class);
$category = new Category;
$category->fill($request->all());
$category->category_type = strtolower($request->input('category_type'));
$category = $request->handleImages($category);
if ($category->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $category, trans('admin/categories/message.create.success')));
@@ -92,15 +95,17 @@ class CategoriesController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', Category::class);
$category = Category::findOrFail($id);
$category->fill($request->all());
$category->category_type = strtolower($request->input('category_type'));
$category = $request->handleImages($category);
if ($category->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $category, trans('admin/categories/message.update.success')));
@@ -143,7 +148,7 @@ class CategoriesController extends Controller
*/
public function selectlist(Request $request, $category_type = 'asset')
{
$this->authorize('view.selectlists');
$categories = Category::select([
'id',
'name',

View File

@@ -8,6 +8,7 @@ use App\Http\Transformers\CompaniesTransformer;
use App\Http\Transformers\SelectlistTransformer;
use App\Models\Company;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Storage;
class CompaniesController extends Controller
@@ -65,15 +66,16 @@ class CompaniesController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Company::class);
$company = new Company;
$company->fill($request->all());
$company = $request->handleImages($company);
if ($company->save()) {
return response()->json(Helper::formatStandardApiResponse('success', (new CompaniesTransformer)->transformCompany($company), trans('admin/companies/message.create.success')));
}
@@ -104,15 +106,16 @@ class CompaniesController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', Company::class);
$company = Company::findOrFail($id);
$company->fill($request->all());
$company = $request->handleImages($company);
if ($company->save()) {
return response()
@@ -156,7 +159,7 @@ class CompaniesController extends Controller
*/
public function selectlist(Request $request)
{
$this->authorize('view.selectlists');
$companies = Company::select([
'companies.id',
'companies.name',

View File

@@ -8,6 +8,10 @@ use App\Http\Transformers\ComponentsTransformer;
use App\Models\Company;
use App\Models\Component;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use App\Events\CheckoutableCheckedIn;
use App\Events\ComponentCheckedIn;
use App\Models\Asset;
class ComponentsController extends Controller
{
@@ -22,8 +26,25 @@ class ComponentsController extends Controller
public function index(Request $request)
{
$this->authorize('view', Component::class);
// This array is what determines which fields should be allowed to be sorted on ON the table itself, no relations
// Relations will be handled in query scopes a little further down.
$allowed_columns =
[
'id',
'name',
'min_amt',
'order_number',
'serial',
'purchase_date',
'purchase_cost',
'qty',
'image',
];
$components = Company::scopeCompanyables(Component::select('components.*')
->with('company', 'location', 'category'));
->with('company', 'location', 'category', 'assets'));
if ($request->filled('search')) {
$components = $components->TextSearch($request->input('search'));
@@ -48,11 +69,12 @@ class ComponentsController extends Controller
// Check to make sure the limit is not higher than the max allowed
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
$allowed_columns = ['id','name','min_amt','order_number','serial','purchase_date','purchase_cost','company','category','qty','location','image'];
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';
$sort_override = $request->input('sort');
$column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'created_at';
switch ($sort) {
switch ($sort_override) {
case 'category':
$components = $components->OrderCategory($order);
break;
@@ -63,7 +85,7 @@ class ComponentsController extends Controller
$components = $components->OrderCompany($order);
break;
default:
$components = $components->orderBy($sort, $order);
$components = $components->orderBy($column_sort, $order);
break;
}
@@ -78,14 +100,15 @@ class ComponentsController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Component::class);
$component = new Component;
$component->fill($request->all());
$component = $request->handleImages($component);
if ($component->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $component, trans('admin/components/message.create.success')));
@@ -116,15 +139,17 @@ class ComponentsController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', Component::class);
$component = Component::findOrFail($id);
$component->fill($request->all());
$component = $request->handleImages($component);
if ($component->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $component, trans('admin/components/message.update.success')));
@@ -172,4 +197,119 @@ class ComponentsController extends Controller
$assets = $assets->skip($offset)->take($limit)->get();
return (new ComponentsTransformer)->transformCheckedoutComponents($assets, $total);
}
/**
* Validate and checkout the component.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* t
* @since [v5.1.8]
* @param Request $request
* @param int $componentId
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function checkout(Request $request, $componentId)
{
// Check if the component exists
if (is_null($component = Component::find($componentId))) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/components/message.does_not_exist')));
}
$this->authorize('checkout', $component);
if ($component->numRemaining() >= $request->get('assigned_qty')) {
if (!$asset = Asset::find($request->input('assigned_to'))) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.does_not_exist')));
}
// Update the accessory data
$component->assigned_to = $request->input('assigned_to');
$component->assets()->attach($component->id, [
'component_id' => $component->id,
'created_at' => \Carbon::now(),
'assigned_qty' => $request->get('assigned_qty', 1),
'user_id' => \Auth::id(),
'asset_id' => $request->get('assigned_to')
]);
$component->logCheckout($request->input('note'), $asset);
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/components/message.checkout.success')));
}
return response()->json(Helper::formatStandardApiResponse('error', null, 'Not enough components remaining: '.$component->numRemaining().' remaining, '.$request->get('assigned_qty').' requested.'));
}
/**
* Validate and store checkin data.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v5.1.8]
* @param Request $request
* @param $component_asset_id
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function checkin(Request $request, $component_asset_id)
{
if ($component_assets = \DB::table('components_assets')->find($component_asset_id)) {
if (is_null($component = Component::find($component_assets->component_id))) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/components/message.not_found')));
}
$this->authorize('checkin', $component);
$max_to_checkin = $component_assets->assigned_qty;
if ($max_to_checkin > 1) {
$validator = \Validator::make($request->all(), [
"checkin_qty" => "required|numeric|between:1,$max_to_checkin"
]);
if ($validator->fails()) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Checkin quantity must be between 1 and '.$max_to_checkin));
}
}
// Validation passed, so let's figure out what we have to do here.
$qty_remaining_in_checkout = ($component_assets->assigned_qty - (int)$request->input('checkin_qty', 1));
// We have to modify the record to reflect the new qty that's
// actually checked out.
$component_assets->assigned_qty = $qty_remaining_in_checkout;
\Log::debug($component_asset_id.' - '.$qty_remaining_in_checkout.' remaining in record '.$component_assets->id);
\DB::table('components_assets')->where('id',
$component_asset_id)->update(['assigned_qty' => $qty_remaining_in_checkout]);
// If the checked-in qty is exactly the same as the assigned_qty,
// we can simply delete the associated components_assets record
if ($qty_remaining_in_checkout == 0) {
\DB::table('components_assets')->where('id', '=', $component_asset_id)->delete();
}
$asset = Asset::find($component_assets->asset_id);
event(new CheckoutableCheckedIn($component, $asset, \Auth::user(), $request->input('note'), \Carbon::now()));
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/components/message.checkin.success')));
}
return response()->json(Helper::formatStandardApiResponse('error', null, 'No matching checkouts for that component join record'));
}
}

View File

@@ -10,6 +10,7 @@ use App\Models\Company;
use App\Models\Consumable;
use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
class ConsumablesController extends Controller
{
@@ -24,6 +25,26 @@ class ConsumablesController extends Controller
public function index(Request $request)
{
$this->authorize('index', Consumable::class);
// This array is what determines which fields should be allowed to be sorted on ON the table itself, no relations
// Relations will be handled in query scopes a little further down.
$allowed_columns =
[
'id',
'name',
'order_number',
'min_amt',
'purchase_date',
'purchase_cost',
'company',
'category',
'model_number',
'item_no',
'qty',
'image',
];
$consumables = Company::scopeCompanyables(
Consumable::select('consumables.*')
->with('company', 'location', 'category', 'users', 'manufacturer')
@@ -41,10 +62,18 @@ class ConsumablesController extends Controller
$consumables->where('category_id','=',$request->input('category_id'));
}
if ($request->filled('model_number')) {
$consumables->where('model_number','=',$request->input('model_number'));
}
if ($request->filled('manufacturer_id')) {
$consumables->where('manufacturer_id','=',$request->input('manufacturer_id'));
}
if ($request->filled('location_id')) {
$consumables->where('location_id','=',$request->input('location_id'));
}
// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
// case we override with the actual count, so we should return 0 items.
@@ -53,12 +82,14 @@ class ConsumablesController extends Controller
// Check to make sure the limit is not higher than the max allowed
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
$allowed_columns = ['id','name','order_number','min_amt','purchase_date','purchase_cost','company','category','model_number', 'item_no', 'manufacturer','location','qty','image'];
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';
$sort_override = $request->input('sort');
$column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'created_at';
switch ($sort) {
switch ($sort_override) {
case 'category':
$consumables = $consumables->OrderCategory($order);
break;
@@ -72,7 +103,7 @@ class ConsumablesController extends Controller
$consumables = $consumables->OrderCompany($order);
break;
default:
$consumables = $consumables->orderBy($sort, $order);
$consumables = $consumables->orderBy($column_sort, $order);
break;
}
@@ -90,14 +121,15 @@ class ConsumablesController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Consumable::class);
$consumable = new Consumable;
$consumable->fill($request->all());
$consumable = $request->handleImages($consumable);
if ($consumable->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $consumable, trans('admin/consumables/message.create.success')));
@@ -125,16 +157,17 @@ class ConsumablesController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', Consumable::class);
$consumable = Consumable::findOrFail($id);
$consumable->fill($request->all());
$consumable = $request->handleImages($consumable);
if ($consumable->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $consumable, trans('admin/consumables/message.update.success')));
}

View File

@@ -95,7 +95,14 @@ class CustomFieldsController extends Controller
$field = new CustomField;
$data = $request->all();
$validator = Validator::make($data, $field->validationRules());
$regex_format = null;
if (str_contains($data["format"], "regex:")){
$regex_format = $data["format"];
}
$validator = Validator::make($data, $field->validationRules($regex_format));
if ($validator->fails()) {
return response()->json(Helper::formatStandardApiResponse('error', null, $validator->errors()));
}

View File

@@ -9,6 +9,7 @@ use App\Http\Transformers\SelectlistTransformer;
use App\Models\Department;
use Auth;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Storage;
class DepartmentsController extends Controller
@@ -73,14 +74,16 @@ class DepartmentsController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Department::class);
$department = new Department;
$department->fill($request->all());
$department = $request->handleImages($department);
$department->user_id = Auth::user()->id;
$department->manager_id = ($request->filled('manager_id' ) ? $request->input('manager_id') : null);
@@ -111,15 +114,16 @@ class DepartmentsController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v5.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', Department::class);
$department = Department::findOrFail($id);
$department->fill($request->all());
$department = $request->handleImages($department);
if ($department->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $department, trans('admin/departments/message.update.success')));
@@ -164,6 +168,7 @@ class DepartmentsController extends Controller
public function selectlist(Request $request)
{
$this->authorize('view.selectlists');
$departments = Department::select([
'id',
'name',

View File

@@ -20,9 +20,9 @@ class DepreciationsController extends Controller
public function index(Request $request)
{
$this->authorize('view', Depreciation::class);
$allowed_columns = ['id','name','created_at'];
$allowed_columns = ['id','name','months','depreciation_min','created_at'];
$depreciations = Depreciation::select('id','name','months','user_id','created_at','updated_at');
$depreciations = Depreciation::select('id','name','months','depreciation_min','user_id','created_at','updated_at');
if ($request->filled('search')) {
$depreciations = $depreciations->TextSearch($request->input('search'));

View File

@@ -49,10 +49,12 @@ class ImportController extends Controller
if (!in_array($file->getMimeType(), array(
'application/vnd.ms-excel',
'text/csv',
'application/csv',
'text/x-Algol68', // because wtf CSV files?
'text/plain',
'text/comma-separated-values',
'text/tsv'))) {
$results['error']='File type must be CSV';
$results['error']='File type must be CSV. Uploaded file is '.$file->getMimeType();
return response()->json(Helper::formatStandardApiResponse('error', null, $results['error']), 500);
}

View File

@@ -0,0 +1,141 @@
<?php
namespace App\Http\Controllers\Api;
use App\Helpers\Helper;
use App\Http\Controllers\Controller;
use App\Http\Transformers\LicenseSeatsTransformer;
use App\Models\Asset;
use App\Models\License;
use App\Models\LicenseSeat;
use App\Models\User;
use Auth;
use Illuminate\Http\Request;
class LicenseSeatsController extends Controller
{
/**
* Display a listing of the resource.
*
* @param \Illuminate\Http\Request $request
* @param int $licenseId
* @return \Illuminate\Http\Response
*/
public function index(Request $request, $licenseId)
{
//
if ($license = License::find($licenseId)) {
$this->authorize('view', $license);
$seats = LicenseSeat::with('license', 'user', 'asset', 'user.department')
->where('license_seats.license_id', $licenseId);
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
if ($request->input('sort')=='department') {
$seats->OrderDepartments($order);
} else {
$seats->orderBy('id', $order);
}
$total = $seats->count();
$offset = (($seats) && (request('offset') > $total)) ? 0 : request('offset', 0);
$limit = request('limit', 50);
$seats = $seats->skip($offset)->take($limit)->get();
if ($seats) {
return (new LicenseSeatsTransformer)->transformLicenseSeats($seats, $total);
}
}
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/licenses/message.does_not_exist')), 200);
}
/**
* Display the specified resource.
*
* @param int $licenseId
* @param int $seatId
* @return \Illuminate\Http\Response
*/
public function show($licenseId, $seatId)
{
//
$this->authorize('view', License::class);
// sanity checks:
// 1. does the license seat exist?
if (!$licenseSeat = LicenseSeat::find($seatId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat not found'));
}
// 2. does the seat belong to the specified license?
if (!$license = $licenseSeat->license()->first() || $license->id != intval($licenseId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat does not belong to the specified license'));
}
return (new LicenseSeatsTransformer)->transformLicenseSeat($licenseSeat);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $licenseId
* @param int $seatId
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $licenseId, $seatId)
{
$this->authorize('checkout', License::class);
// sanity checks:
// 1. does the license seat exist?
if (!$licenseSeat = LicenseSeat::find($seatId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat not found'));
}
// 2. does the seat belong to the specified license?
if (!$license = $licenseSeat->license()->first() || $license->id != intval($licenseId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat does not belong to the specified license'));
}
$oldUser = $licenseSeat->user()->first();
$oldAsset = $licenseSeat->asset()->first();
// attempt to update the license seat
$licenseSeat->fill($request->all());
$licenseSeat->user_id = Auth::user()->id;
// check if this update is a checkin operation
// 1. are relevant fields touched at all?
$touched = $licenseSeat->isDirty('assigned_to') || $licenseSeat->isDirty('asset_id');
// 2. are they cleared? if yes then this is a checkin operation
$is_checkin = ($touched && $licenseSeat->assigned_to === null && $licenseSeat->asset_id === null);
if (!$touched) {
// nothing to update
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
}
if ($licenseSeat->save()) {
// the logging functions expect only one "target". if both asset and user are present in the request,
// we simply let assets take precedence over users...
$changes = $licenseSeat->getChanges();
if (array_key_exists('assigned_to', $changes)) {
$target = $is_checkin ? $oldUser : User::find($changes['assigned_to']);
}
if (array_key_exists('asset_id', $changes)) {
$target = $is_checkin ? $oldAsset : Asset::find($changes['asset_id']);
}
if ($is_checkin) {
$licenseSeat->logCheckin($target, $request->input('note'));
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
}
// in this case, relevant fields are touched but it's not a checkin operation. so it must be a checkout operation.
$licenseSeat->logCheckout($request->input('note'), $target);
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
}
return Helper::formatStandardApiResponse('error', null, $licenseSeat->getErrors());
}
}

View File

@@ -103,11 +103,33 @@ class LicensesController extends Controller
case 'category':
$licenses = $licenses->leftJoin('categories', 'licenses.category_id', '=', 'categories.id')->orderBy('categories.name', $order);
break;
case 'depreciation':
$licenses = $licenses->leftJoin('depreciations', 'licenses.depreciation_id', '=', 'depreciations.id')->orderBy('depreciations.name', $order);
break;
case 'company':
$licenses = $licenses->leftJoin('companies', 'licenses.company_id', '=', 'companies.id')->orderBy('companies.name', $order);
break;
default:
$allowed_columns = ['id','name','purchase_cost','expiration_date','purchase_order','order_number','notes','purchase_date','serial','company','category','license_name','license_email','free_seats_count','seats'];
$allowed_columns =
[
'id',
'name',
'purchase_cost',
'expiration_date',
'purchase_order',
'order_number',
'notes',
'purchase_date',
'serial',
'company',
'category',
'license_name',
'license_email',
'free_seats_count',
'seats',
'termination_date',
'depreciation_id'
];
$sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at';
$licenses = $licenses->orderBy($sort, $order);
break;
@@ -215,50 +237,6 @@ class LicensesController extends Controller
}
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/licenses/message.assoc_users')));
}
/**
* Get license seat listing
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0]
* @param int $licenseId
* @return \Illuminate\Contracts\View\View
*/
public function seats(Request $request, $licenseId)
{
if ($license = License::find($licenseId)) {
$this->authorize('view', $license);
$seats = LicenseSeat::with('license', 'user', 'asset', 'user.department')
->where('license_seats.license_id', $licenseId);
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
if ($request->input('sort')=='department') {
$seats->OrderDepartments($order);
} else {
$seats->orderBy('id', $order);
}
$offset = (($seats) && (request('offset') > $seats->count())) ? 0 : request('offset', 0);
$limit = request('limit', 50);
$total = $seats->count();
$seats = $seats->skip($offset)->take($limit)->get();
if ($seats) {
return (new LicenseSeatsTransformer)->transformLicenseSeats($seats, $total);
}
}
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/licenses/message.does_not_exist')), 200);
}
/**
* Gets a paginated collection for the select2 menus

View File

@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Api;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use App\Http\Controllers\Controller;
use App\Helpers\Helper;
use App\Models\Location;
@@ -54,7 +55,7 @@ class LocationsController extends Controller
$offset = (($locations) && (request('offset') > $locations->count())) ? 0 : request('offset', 0);
$offset = (($locations) && (request('offset') > $locations->count())) ? $locations->count() : request('offset', 0);
// Check to make sure the limit is not higher than the max allowed
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
@@ -86,14 +87,15 @@ class LocationsController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Location::class);
$location = new Location;
$location->fill($request->all());
$location = $request->handleImages($location);
if ($location->save()) {
return response()->json(Helper::formatStandardApiResponse('success', (new LocationsTransformer)->transformLocation($location), trans('admin/locations/message.create.success')));
@@ -141,17 +143,17 @@ class LocationsController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @param int $id
* @return \Illuminate\Http\JsonResponse
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', Location::class);
$location = Location::findOrFail($id);
$location->fill($request->all());
$location = $request->handleImages($location);
if ($location->isValid()) {
@@ -221,6 +223,8 @@ class LocationsController extends Controller
public function selectlist(Request $request)
{
$this->authorize('view.selectlists');
$locations = Location::select([
'locations.id',
'locations.name',

View File

@@ -8,6 +8,7 @@ use App\Http\Transformers\ManufacturersTransformer;
use App\Http\Transformers\SelectlistTransformer;
use App\Models\Manufacturer;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Storage;
class ManufacturersController extends Controller
@@ -59,14 +60,15 @@ class ManufacturersController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Manufacturer::class);
$manufacturer = new Manufacturer;
$manufacturer->fill($request->all());
$manufacturer = $request->handleImages($manufacturer);
if ($manufacturer->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $manufacturer, trans('admin/manufacturers/message.create.success')));
@@ -96,15 +98,16 @@ class ManufacturersController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', Manufacturer::class);
$manufacturer = Manufacturer::findOrFail($id);
$manufacturer->fill($request->all());
$manufacturer = $request->handleImages($manufacturer);
if ($manufacturer->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $manufacturer, trans('admin/manufacturers/message.update.success')));
@@ -152,6 +155,7 @@ class ManufacturersController extends Controller
public function selectlist(Request $request)
{
$this->authorize('view.selectlists');
$manufacturers = Manufacturer::select([
'id',
'name',

View File

@@ -31,8 +31,8 @@ class PredefinedKitsController extends Controller
$offset = $request->input('offset', 0);
$limit = $request->input('limit', 50);
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'assets_count';
$order = $request->input('order') === 'desc' ? 'desc' : 'asc';
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'name';
$kits->orderBy($sort, $order);
$total = $kits->count();

View File

@@ -16,6 +16,9 @@ use Illuminate\Support\Facades\Notification;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator;
use App\Models\Ldap; // forward-port of v4 LDAP model for Sync
use App\Http\Requests\SlackSettingsRequest;
class SettingsController extends Controller
{
@@ -34,13 +37,17 @@ class SettingsController extends Controller
public function ldapAdSettingsTest(LdapAd $ldap): JsonResponse
{
if(!$ldap->init()) {
Log::info('LDAP is not enabled cannot test.');
Log::info('LDAP is not enabled so we cannot test.');
return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400);
}
// The connect, bind and resulting users message
$message = [];
// This is all kinda fucked right now. The connection test doesn't actually do what you think,
// // and the way we parse the errors
// on the JS side is horrible.
Log::info('Preparing to test LDAP user login');
// Test user can connect to the LDAP server
try {
@@ -49,13 +56,11 @@ class SettingsController extends Controller
'message' => 'Successfully connected to LDAP server.'
];
} catch (\Exception $ex) {
\Log::debug('LDAP connected but Bind failed. Please check your LDAP settings and try again.');
return response()->json([
'message' => 'Error logging into LDAP server, error: ' . $ex->getMessage() . ' - Verify your that your username and password are correct']);
\Log::debug('Connection to LDAP server '.Setting::getSettings()->ldap_server.' failed. Please check your LDAP settings and try again. Server Responded with error: ' . $ex->getMessage());
return response()->json(
['message' => 'Connection to LDAP server '.Setting::getSettings()->ldap_server." failed. Verify that the LDAP hostname is entered correctly and that it can be reached from this web server. \n\nServer Responded with error: " . $ex->getMessage()
} catch (\Exception $e) {
\Log::info('LDAP connection failed but we cannot debug it any further on our end.');
return response()->json(['message' => 'The LDAP connection failed but we cannot debug it any further on our end. The error from the server is: '.$e->getMessage()], 500);
], 400);
}
Log::info('Preparing to test LDAP bind connection');
@@ -64,25 +69,44 @@ class SettingsController extends Controller
Log::info('Testing Bind');
$ldap->testLdapAdBindConnection();
$message['bind'] = [
'message' => 'Successfully binded to LDAP server.'
'message' => 'Successfully bound to LDAP server.'
];
} catch (\Exception $ex) {
Log::info('LDAP Bind failed');
return response()->json([
'message' => 'Error binding to LDAP server, error: ' . $ex->getMessage()
return response()->json(['message' => 'Connection to LDAP successful, but we were unable to Bind the LDAP user '.Setting::getSettings()->ldap_uname.". Verify your that your LDAP Bind username and password are correct. \n\nServer Responded with error: " . $ex->getMessage()
], 400);
}
Log::info('Preparing to get sample user set from LDAP directory');
// Get a sample of 10 users so user can verify the data is correct
$settings = Setting::getSettings();
try {
Log::info('Testing LDAP sync');
error_reporting(E_ALL & ~E_DEPRECATED); // workaround for php7.4, which deprecates ldap_control_paged_result
$users = $ldap->testUserImportSync();
$message['user_sync'] = [
'users' => $users
];
// $users = $ldap->testUserImportSync(); // from AdLdap2 from v5, disabling and falling back to v4's sync code
$users = collect(Ldap::findLdapUsers())->slice(0, 11)->filter(function ($value, $key) { //choosing ELEVEN because one is going to be the count, which we're about to filter out in the next line
return is_int($key);
})->map(function ($item) use ($settings) {
return (object) [
'username' => $item[$settings['ldap_username_field']][0] ?? null,
'employee_number' => $item[$settings['ldap_emp_num']][0] ?? null,
'lastname' => $item[$settings['ldap_lname_field']][0] ?? null,
'firstname' => $item[$settings['ldap_fname_field']][0] ?? null,
'email' => $item[$settings['ldap_email']][0] ?? null,
];
});
if ($users->count() > 0) {
$message['user_sync'] = [
'users' => $users
];
} else {
$message['user_sync'] = [
'message' => 'Connection to LDAP was successful, however there were no users returned from your query. You should confirm the Base Bind DN above.'
];
return response()->json($message, 400);
}
} catch (\Exception $ex) {
Log::info('LDAP sync failed');
$message['user_sync'] = [
@@ -142,31 +166,41 @@ class SettingsController extends Controller
public function slacktest(Request $request)
{
$slack = new Client([
'base_url' => e($request->input('slack_endpoint')),
'defaults' => [
'exceptions' => false
]
$validator = Validator::make($request->all(), [
'slack_endpoint' => 'url|required_with:slack_channel|starts_with:https://hooks.slack.com/|nullable',
'slack_channel' => 'required_with:slack_endpoint|starts_with:#|nullable',
]);
$payload = json_encode(
[
'channel' => e($request->input('slack_channel')),
'text' => trans('general.slack_test_msg'),
'username' => e($request->input('slack_botname')),
'icon_emoji' => ':heart:'
]);
try {
$slack->post($request->input('slack_endpoint'),['body' => $payload]);
return response()->json(['message' => 'Success'], 200);
} catch (\Exception $e) {
return response()->json(['message' => 'Oops! Please check the channel name and webhook endpoint URL. Slack responded with: '.$e->getMessage()], 400);
if ($validator->fails()) {
return response()->json(['message' => 'Validation failed', 'errors' => $validator->errors()], 422);
}
return response()->json(['message' => 'Something went wrong :( '], 400);
// If validation passes, continue to the curl request
$slack = new Client([
'base_url' => e($request->input('slack_endpoint')),
'defaults' => [
'exceptions' => false,
],
]);
$payload = json_encode(
[
'channel' => e($request->input('slack_channel')),
'text' => trans('general.slack_test_msg'),
'username' => e($request->input('slack_botname')),
'icon_emoji' => ':heart:',
]);
try {
$slack->post($request->input('slack_endpoint'), ['body' => $payload]);
return response()->json(['message' => 'Success'], 200);
} catch (\Exception $e) {
return response()->json(['message' => 'Please check the channel name and webhook endpoint URL ('.$request->input('slack_endpoint').'). Slack responded with: '.$e->getMessage()], 400);
}
//}
return response()->json(['message' => 'Something went wrong :( '], 400);
}

View File

@@ -22,7 +22,7 @@ class StatuslabelsController extends Controller
public function index(Request $request)
{
$this->authorize('view', Statuslabel::class);
$allowed_columns = ['id','name','created_at', 'assets_count','color','default_label'];
$allowed_columns = ['id','name','created_at', 'assets_count','color', 'notes','default_label'];
$statuslabels = Statuslabel::withCount('assets as assets_count');
@@ -71,6 +71,10 @@ class StatuslabelsController extends Controller
$statuslabel->deployable = $statusType['deployable'];
$statuslabel->pending = $statusType['pending'];
$statuslabel->archived = $statusType['archived'];
$statuslabel->color = $request->input('color');
$statuslabel->show_in_nav = $request->input('show_in_nav', 0);
$statuslabel->default_label = $request->input('default_label', 0);
if ($statuslabel->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $statuslabel, trans('admin/statuslabels/message.create.success')));
@@ -111,9 +115,7 @@ class StatuslabelsController extends Controller
$request->except('deployable', 'pending','archived');
if (!$request->filled('type')) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Status label type is required.'));
}
$statuslabel->fill($request->all());
@@ -121,6 +123,9 @@ class StatuslabelsController extends Controller
$statuslabel->deployable = $statusType['deployable'];
$statuslabel->pending = $statusType['pending'];
$statuslabel->archived = $statusType['archived'];
$statuslabel->color = $request->input('color');
$statuslabel->show_in_nav = $request->input('show_in_nav');
$statuslabel->default_label = $request->input('default_label');
if ($statuslabel->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $statuslabel, trans('admin/statuslabels/message.update.success')));
@@ -167,18 +172,15 @@ class StatuslabelsController extends Controller
{
$this->authorize('view', Statuslabel::class);
$statuslabels = Statuslabel::with('assets')
->groupBy('id')
->withCount('assets as assets_count')
->get();
$statuslabels = Statuslabel::withCount('assets')->get();
$labels=[];
$points=[];
$default_color_count = 0;
$colors_array = array();
foreach ($statuslabels as $statuslabel) {
if ($statuslabel->assets_count > 0) {
$labels[]=$statuslabel->name. ' ('.number_format($statuslabel->assets_count).')';
$points[]=$statuslabel->assets_count;
@@ -186,8 +188,8 @@ class StatuslabelsController extends Controller
$colors_array[] = $statuslabel->color;
} else {
$colors_array[] = Helper::defaultChartColors($default_color_count);
$default_color_count++;
}
$default_color_count++;
}
}

View File

@@ -8,6 +8,7 @@ use App\Http\Transformers\SelectlistTransformer;
use App\Http\Transformers\SuppliersTransformer;
use App\Models\Supplier;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Storage;
class SuppliersController extends Controller
@@ -55,14 +56,15 @@ class SuppliersController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Supplier::class);
$supplier = new Supplier;
$supplier->fill($request->all());
$supplier = $request->handleImages($supplier);
if ($supplier->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $supplier, trans('admin/suppliers/message.create.success')));
@@ -92,15 +94,16 @@ class SuppliersController extends Controller
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @param \Illuminate\Http\Request $request
* @param \App\Http\Requests\ImageUploadRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(ImageUploadRequest $request, $id)
{
$this->authorize('update', Supplier::class);
$supplier = Supplier::findOrFail($id);
$supplier->fill($request->all());
$supplier = $request->handleImages($supplier);
if ($supplier->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $supplier, trans('admin/suppliers/message.update.success')));
@@ -152,6 +155,8 @@ class SuppliersController extends Controller
public function selectlist(Request $request)
{
$this->authorize('view.selectlists');
$suppliers = Supplier::select([
'id',
'name',

View File

@@ -16,6 +16,7 @@ use App\Models\License;
use App\Models\User;
use Auth;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use Illuminate\Support\Facades\Storage;
class UsersController extends Controller
@@ -49,6 +50,7 @@ class UsersController extends Controller
'users.jobtitle',
'users.last_login',
'users.last_name',
'users.locale',
'users.location_id',
'users.manager_id',
'users.notes',
@@ -60,6 +62,7 @@ class UsersController extends Controller
'users.updated_at',
'users.username',
'users.zip',
'users.ldap_import',
])->with('manager', 'groups', 'userloc', 'company', 'department','assets','licenses','accessories','consumables')
->withCount('assets as assets_count','licenses as licenses_count','accessories as accessories_count','consumables as consumables_count');
@@ -72,6 +75,10 @@ class UsersController extends Controller
$users = $users->withTrashed();
}
if ($request->filled('activated')) {
$users = $users->where('users.activated', '=', $request->input('activated'));
}
if ($request->filled('company_id')) {
$users = $users->where('users.company_id', '=', $request->input('company_id'));
}
@@ -88,6 +95,30 @@ class UsersController extends Controller
$users = $users->where('users.username', '=', $request->input('username'));
}
if ($request->filled('first_name')) {
$users = $users->where('users.first_name', '=', $request->input('first_name'));
}
if ($request->filled('last_name')) {
$users = $users->where('users.last_name', '=', $request->input('last_name'));
}
if ($request->filled('employee_num')) {
$users = $users->where('users.employee_num', '=', $request->input('employee_num'));
}
if ($request->filled('state')) {
$users = $users->where('users.state', '=', $request->input('state'));
}
if ($request->filled('country')) {
$users = $users->where('users.country', '=', $request->input('country'));
}
if ($request->filled('zip')) {
$users = $users->where('users.zip', '=', $request->input('zip'));
}
if ($request->filled('group_id')) {
$users = $users->ByGroup($request->get('group_id'));
}
@@ -96,6 +127,10 @@ class UsersController extends Controller
$users = $users->where('users.department_id','=',$request->input('department_id'));
}
if ($request->filled('manager_id')) {
$users = $users->where('users.manager_id','=',$request->input('manager_id'));
}
if ($request->filled('search')) {
$users = $users->TextSearch($request->input('search'));
}
@@ -131,7 +166,7 @@ class UsersController extends Controller
'assets','accessories', 'consumables','licenses','groups','activated','created_at',
'two_factor_enrolled','two_factor_optin','last_login', 'assets_count', 'licenses_count',
'consumables_count', 'accessories_count', 'phone', 'address', 'city', 'state',
'country', 'zip', 'id'
'country', 'zip', 'id', 'ldap_import'
];
$sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'first_name';
@@ -184,16 +219,16 @@ class UsersController extends Controller
foreach ($users as $user) {
$name_str = '';
if ($user->last_name!='') {
$name_str .= e($user->last_name).', ';
$name_str .= $user->last_name.', ';
}
$name_str .= e($user->first_name);
$name_str .= $user->first_name;
if ($user->username!='') {
$name_str .= ' ('.e($user->username).')';
$name_str .= ' ('.$user->username.')';
}
if ($user->employee_num!='') {
$name_str .= ' - #'.e($user->employee_num);
$name_str .= ' - #'.$user->employee_num;
}
$user->use_text = $name_str;
@@ -235,7 +270,8 @@ class UsersController extends Controller
$tmp_pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
$user->password = bcrypt($request->get('password', $tmp_pass));
app('App\Http\Requests\ImageUploadRequest')->handleImages($user, 600, 'image', 'avatars', 'avatar');
if ($user->save()) {
if ($request->filled('groups')) {
$user->groups()->sync($request->input('groups'));
@@ -278,9 +314,15 @@ class UsersController extends Controller
$user = User::findOrFail($id);
// This is a janky hack to prevent people from changing admin demo user data on the public demo.
// The $ids 1 and 2 are special since they are seeded as superadmins in the demo seeder.
// Thanks, jerks. You are why we can't have nice things. - snipe
/**
* This is a janky hack to prevent people from changing admin demo user data on the public demo.
*
* The $ids 1 and 2 are special since they are seeded as superadmins in the demo seeder.
*
* Thanks, jerks. You are why we can't have nice things. - snipe
*
*/
if ((($id == 1) || ($id == 2)) && (config('app.lock_passwords'))) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Permission denied. You cannot update user information via API on the demo.'));
@@ -288,7 +330,7 @@ class UsersController extends Controller
$user->fill($request->all());
if ($user->id == $request->input('manager_id')) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'You cannot be your own manager'));
}
@@ -318,6 +360,9 @@ class UsersController extends Controller
Asset::where('assigned_type', User::class)
->where('assigned_to', $user->id)->update(['location_id' => $request->input('location_id', null)]);
app('App\Http\Requests\ImageUploadRequest')->handleImages($user, 600, 'image', 'avatars', 'avatar');
if ($user->save()) {
// Sync group memberships:
@@ -395,12 +440,12 @@ class UsersController extends Controller
* @param $userId
* @return string JSON
*/
public function assets($id)
public function assets(Request $request, $id)
{
$this->authorize('view', User::class);
$this->authorize('view', Asset::class);
$assets = Asset::where('assigned_to', '=', $id)->where('assigned_type', '=', User::class)->with('model')->get();
return (new AssetsTransformer)->transformAssets($assets, $assets->count());
return (new AssetsTransformer)->transformAssets($assets, $assets->count(), $request);
}
/**

View File

@@ -100,7 +100,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance = new AssetMaintenance();
$assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = $request->input('cost');
$assetMaintenance->cost = Helper::ParseCurrency($request->input('cost'));
$assetMaintenance->notes = $request->input('notes');
$asset = Asset::find($request->input('asset_id'));
@@ -209,10 +209,10 @@ class AssetMaintenancesController extends Controller
return static::getInsufficientPermissionsRedirect();
}
$assetMaintenance->supplier_id = e($request->input('supplier_id'));
$assetMaintenance->is_warranty = e($request->input('is_warranty'));
$assetMaintenance->cost = Helper::ParseFloat(e($request->input('cost')));
$assetMaintenance->notes = e($request->input('notes'));
$assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = Helper::ParseCurrency($request->input('cost'));
$assetMaintenance->notes = $request->input('notes');
$asset = Asset::find(request('asset_id'));

View File

@@ -155,7 +155,6 @@ class AssetModelsController extends Controller
$model->requestable = $request->input('requestable', '0');
$this->removeCustomFieldsDefaultValues($model);
if ($request->input('custom_fieldset')=='') {
@@ -168,7 +167,6 @@ class AssetModelsController extends Controller
}
}
if ($model->save()) {
return redirect()->route("models.index")->with('success', trans('admin/models/message.update.success'));
}
@@ -269,6 +267,7 @@ class AssetModelsController extends Controller
*/
public function getClone($modelId = null)
{
$this->authorize('create', AssetModel::class);
// Check if the model exists
if (is_null($model_to_clone = AssetModel::find($modelId))) {
return redirect()->route('models.index')->with('error', trans('admin/models/message.does_not_exist'));
@@ -462,7 +461,9 @@ class AssetModelsController extends Controller
private function assignCustomFieldsDefaultValues(AssetModel $model, array $defaultValues)
{
foreach ($defaultValues as $customFieldId => $defaultValue) {
if ($defaultValue) {
if(is_array($defaultValue)){
$model->defaultValues()->attach($customFieldId, ['default_value' => implode(', ', $defaultValue)]);
}elseif ($defaultValue) {
$model->defaultValues()->attach($customFieldId, ['default_value' => $defaultValue]);
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Assets;
use App\Exceptions\CheckoutNotAllowed;
use App\Helpers\Helper;
use App\Http\Controllers\CheckInOutRequest;
use App\Http\Controllers\Controller;
use App\Http\Requests\AssetCheckoutRequest;
@@ -33,7 +34,8 @@ class AssetCheckoutController extends Controller
$this->authorize('checkout', $asset);
if ($asset->availableForCheckout()) {
return view('hardware/checkout', compact('asset'));
return view('hardware/checkout', compact('asset'))
->with('statusLabel_list', Helper::deployableStatusLabelList());
}
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.checkout.not_available'));
@@ -75,6 +77,10 @@ class AssetCheckoutController extends Controller
$expected_checkin = $request->get('expected_checkin');
}
if ($request->filled('status_id')) {
$asset->status_id = $request->get('status_id');
}
if ($asset->checkOut($target, $admin, $checkout_at, $expected_checkin, e($request->get('note')), $request->get('name'))) {
return redirect()->route("hardware.index")->with('success', trans('admin/hardware/message.checkout.success'));
}

View File

@@ -2,13 +2,14 @@
namespace App\Http\Controllers\Assets;
use App\Http\Controllers\Controller;
use App\Http\Requests\AssetFileRequest;
use App\Models\Actionlog;
use App\Models\Asset;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage;
use App\Helpers\StorageHelper;
use enshrined\svgSanitize\Sanitizer;
class AssetFilesController extends Controller
{
@@ -35,9 +36,29 @@ class AssetFilesController extends Controller
if (!Storage::exists('private_uploads/assets')) Storage::makeDirectory('private_uploads/assets', 775);
foreach ($request->file('file') as $file) {
$extension = $file->getClientOriginalExtension();
$file_name = 'hardware-'.$asset->id.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$extension;
Storage::put('private_uploads/assets/'.$file_name, file_get_contents($file));
// Check for SVG and sanitize it
if ($extension=='svg') {
\Log::debug('This is an SVG');
$sanitizer = new Sanitizer();
$dirtySVG = file_get_contents($file->getRealPath());
$cleanSVG = $sanitizer->sanitize($dirtySVG);
try {
Storage::put('private_uploads/assets/'.$file_name, $cleanSVG);
} catch (\Exception $e) {
\Log::debug('Upload no workie :( ');
\Log::debug($e);
}
} else {
Storage::put('private_uploads/assets/'.$file_name, file_get_contents($file));
}
$asset->logUpload($file_name, e($request->get('notes')));
}
return redirect()->back()->with('success', trans('admin/hardware/message.upload.success'));
@@ -86,7 +107,7 @@ class AssetFilesController extends Controller
}
return JsonResponse::create(["error" => "Failed validation: "], 500);
}
return Storage::download($file);
return StorageHelper::downloader($file);
}
// Prepare the error message
$error = trans('admin/hardware/message.does_not_exist', ['id' => $fileId]);
@@ -109,20 +130,20 @@ class AssetFilesController extends Controller
{
$asset = Asset::find($assetId);
$this->authorize('update', $asset);
$rel_path = 'storage/private_uploads/assets';
$rel_path = 'private_uploads/assets';
// the asset is valid
if (isset($asset->id)) {
$this->authorize('update', $asset);
$log = Actionlog::find($fileId);
if ($log) {
if (file_exists(base_path().'/'.$rel_path.'/'.$log->filename)) {
Storage::disk('public')->delete($rel_path.'/'.$log->filename);
if (Storage::exists($rel_path.'/'.$log->filename)) {
Storage::delete($rel_path.'/'.$log->filename);
}
$log->delete();
return redirect()->back()->with('success', trans('admin/hardware/message.deletefile.success'));
}
$log->delete();
return redirect()->back()
->with('success', trans('admin/hardware/message.deletefile.success'));
}

View File

@@ -14,6 +14,7 @@ use App\Models\Setting;
use App\Models\User;
use Auth;
use Carbon\Carbon;
use Intervention\Image\Facades\Image;
use DB;
use Gate;
use Illuminate\Http\Request;
@@ -137,7 +138,7 @@ class AssetsController extends Controller
$asset->depreciate = '0';
$asset->status_id = request('status_id', 0);
$asset->warranty_months = request('warranty_months', null);
$asset->purchase_cost = Helper::ParseFloat($request->get('purchase_cost'));
$asset->purchase_cost = Helper::ParseCurrency($request->get('purchase_cost'));
$asset->purchase_date = request('purchase_date', null);
$asset->assigned_to = request('assigned_to', null);
$asset->supplier_id = request('supplier_id', 0);
@@ -165,10 +166,17 @@ class AssetsController extends Controller
foreach ($model->fieldset->fields as $field) {
if ($field->field_encrypted=='1') {
if (Gate::allows('admin')) {
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt($request->input($field->convertUnicodeDbSlug()));
}
if(is_array($request->input($field->convertUnicodeDbSlug()))){
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt(e(implode(', ', $request->input($field->convertUnicodeDbSlug()))));
}else{
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt(e($request->input($field->convertUnicodeDbSlug())));
} }
} else {
$asset->{$field->convertUnicodeDbSlug()} = $request->input($field->convertUnicodeDbSlug());
if(is_array($request->input($field->convertUnicodeDbSlug()))){
$asset->{$field->convertUnicodeDbSlug()} = implode(', ', $request->input($field->convertUnicodeDbSlug()));
}else{
$asset->{$field->convertUnicodeDbSlug()} = $request->input($field->convertUnicodeDbSlug());
}
}
}
}
@@ -188,7 +196,7 @@ class AssetsController extends Controller
}
if (isset($target)) {
$asset->checkOut($target, Auth::user(), date('Y-m-d H:i:s'), $request->input('expected_checkin', null), 'Checked out on asset creation', e($request->get('name')), $location);
$asset->checkOut($target, Auth::user(), date('Y-m-d H:i:s'), $request->input('expected_checkin', null), 'Checked out on asset creation', $request->get('name'), $location);
}
$success = true;
@@ -294,7 +302,7 @@ class AssetsController extends Controller
$asset->status_id = $request->input('status_id', null);
$asset->warranty_months = $request->input('warranty_months', null);
$asset->purchase_cost = Helper::ParseFloat($request->input('purchase_cost', null));
$asset->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost', null));
$asset->purchase_date = $request->input('purchase_date', null);
$asset->supplier_id = $request->input('supplier_id', null);
$asset->expected_checkin = $request->input('expected_checkin', null);
@@ -342,10 +350,18 @@ class AssetsController extends Controller
foreach ($model->fieldset->fields as $field) {
if ($field->field_encrypted=='1') {
if (Gate::allows('admin')) {
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt(e($request->input($field->convertUnicodeDbSlug())));
if(is_array($request->input($field->convertUnicodeDbSlug()))){
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt(e(implode(', ', $request->input($field->convertUnicodeDbSlug()))));
}else{
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt(e($request->input($field->convertUnicodeDbSlug())));
}
}
} else {
$asset->{$field->convertUnicodeDbSlug()} = $request->input($field->convertUnicodeDbSlug());
if(is_array($request->input($field->convertUnicodeDbSlug()))){
$asset->{$field->convertUnicodeDbSlug()} = implode(', ', $request->input($field->convertUnicodeDbSlug()));
}else{
$asset->{$field->convertUnicodeDbSlug()} = $request->input($field->convertUnicodeDbSlug());
}
}
}
}
@@ -468,13 +484,19 @@ class AssetsController extends Controller
return response()->file($barcode_file, $header);
} else {
// Calculate barcode width in pixel based on label width (inch)
$barcode_width = ($settings->labels_width - $settings->labels_display_sgutter) * 96.000000000001;
$barcode_width = ($settings->labels_width - $settings->labels_display_sgutter) * 200.000000000001;
$barcode = new \Com\Tecnick\Barcode\Barcode();
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode,$asset->asset_tag,($barcode_width < 300 ? $barcode_width : 300),50);
try {
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode,$asset->asset_tag,($barcode_width < 300 ? $barcode_width : 300),50);
file_put_contents($barcode_file, $barcode_obj->getPngData());
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
} catch(\Exception $e) {
\Log::debug('The barcode format is invalid.');
return response(file_get_contents(public_path('uploads/barcodes/invalid_barcode.gif')))->header('Content-type', 'image/gif');
}
file_put_contents($barcode_file, $barcode_obj->getPngData());
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
}
}
}
@@ -550,7 +572,12 @@ class AssetsController extends Controller
*
* This needs a LOT of love. It's done very inelegantly right now, and there are
* a ton of optimizations that could (and should) be done.
*
*
* Updated to respect checkin dates:
* No checkin column, assume all items are checked in (todays date)
* Checkin date in the past, update history.
* Checkin date in future or empty, check the item out to the user.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v3.3]
* @return View
@@ -567,6 +594,8 @@ class AssetsController extends Controller
}
$csv = Reader::createFromPath($request->file('user_import_csv'));
$csv->setHeaderOffset(0);
$header = $csv->getHeader();
$isCheckinHeaderExplicit = in_array("checkin date", (array_map('strtolower', $header)));
$results = $csv->getRecords();
$item = array();
$status = array();
@@ -581,8 +610,19 @@ class AssetsController extends Controller
}
$batch_counter = count($item[$asset_tag]);
$item[$asset_tag][$batch_counter]['checkout_date'] = Carbon::parse(Helper::array_smart_fetch($row, "checkout date"))->format('Y-m-d H:i:s');
$item[$asset_tag][$batch_counter]['checkin_date'] = Carbon::parse(Helper::array_smart_fetch($row, "checkin date"))->format('Y-m-d H:i:s');
\Log::debug($item[$asset_tag][$batch_counter]['checkin_date']);
if ($isCheckinHeaderExplicit){
//checkin date not empty, assume past transaction or future checkin date (expected)
if (!empty(Helper::array_smart_fetch($row, "checkin date"))) {
$item[$asset_tag][$batch_counter]['checkin_date'] = Carbon::parse(Helper::array_smart_fetch($row, "checkin date"))->format('Y-m-d H:i:s');
} else {
$item[$asset_tag][$batch_counter]['checkin_date'] = '';
}
} else {
//checkin header missing, assume data is unavailable and make checkin date explicit (now) so we don't encounter invalid state.
$item[$asset_tag][$batch_counter]['checkin_date'] = Carbon::parse(now())->format('Y-m-d H:i:s');
}
$item[$asset_tag][$batch_counter]['asset_tag'] = Helper::array_smart_fetch($row, "asset tag");
$item[$asset_tag][$batch_counter]['name'] = Helper::array_smart_fetch($row, "name");
$item[$asset_tag][$batch_counter]['email'] = Helper::array_smart_fetch($row, "email");
@@ -610,16 +650,24 @@ class AssetsController extends Controller
$user_query .= ', or on username '.$firstname['username'];
}
if ($request->input('match_email')=='1') {
if ($item[$asset_tag][$batch_counter]['email']=='') {
if ($item[$asset_tag][$batch_counter]['name']=='') {
$item[$asset_tag][$batch_counter]['username'][] = $user_email = User::generateEmailFromFullName($item[$asset_tag][$batch_counter]['name']);
$user->orWhere('username', '=', $user_email);
$user_query .= ', or on username '.$user_email;
}
}
if ($request->input('match_username') == '1'){
// Added #8825: add explicit username lookup
$raw_username = $item[$asset_tag][$batch_counter]['name'];
$user->orWhere('username', '=', $raw_username);
$user_query .= ', or on username ' . $raw_username;
}
// A matching user was found
if ($user = $user->first()) {
$item[$asset_tag][$batch_counter]['checkedout_to'] = $user->id;
//$user is now matched user from db
$item[$asset_tag][$batch_counter]['user_id'] = $user->id;
Actionlog::firstOrCreate(array(
'item_id' => $asset->id,
'item_type' => Asset::class,
@@ -630,14 +678,44 @@ class AssetsController extends Controller
'created_at' => $item[$asset_tag][$batch_counter]['checkout_date'],
'action_type' => 'checkout',
));
$asset->assigned_to = $user->id;
$checkin_date = $item[$asset_tag][$batch_counter]['checkin_date'];
if ($isCheckinHeaderExplicit) {
//if checkin date header exists, assume that empty or future date is still checked out
//if checkin is before todays date, assume it's checked in and do not assign user ID, if checkin date is in the future or blank, this is the expected checkin date, items is checked out
if ((strtotime($checkin_date) > strtotime(Carbon::now())) || (empty($checkin_date))
) {
//only do this if item is checked out
$asset->assigned_to = $user->id;
$asset->assigned_type = User::class;
}
}
if (!empty($checkin_date)) {
//only make a checkin there is a valid checkin date or we created one on import.
Actionlog::firstOrCreate(array(
'item_id' =>
$item[$asset_tag][$batch_counter]['asset_id'],
'item_type' => Asset::class,
'user_id' => Auth::user()->id,
'note' => 'Checkin imported by ' . Auth::user()->present()->fullName() . ' from history importer',
'target_id' => null,
'created_at' => $checkin_date,
'action_type' => 'checkin'
));
}
if ($asset->save()) {
$status['success'][]['asset'][$asset_tag]['msg'] = 'Asset successfully matched for '.Helper::array_smart_fetch($row, "name").$user_query.' on '.$item[$asset_tag][$batch_counter]['checkout_date'];
} else {
$status['error'][]['asset'][$asset_tag]['msg'] = 'Asset and user was matched but could not be saved.';
}
} else {
$item[$asset_tag][$batch_counter]['checkedout_to'] = null;
$item[$asset_tag][$batch_counter]['user_id'] = null;
$status['error'][]['user'][Helper::array_smart_fetch($row, "name")]['msg'] = 'User does not exist so no checkin log was created.';
}
} else {
@@ -646,31 +724,6 @@ class AssetsController extends Controller
}
}
}
// Loop through and backfill the checkins
foreach ($item as $key => $asset_batch) {
$total_in_batch = count($asset_batch);
for ($x = 0; $x < $total_in_batch; $x++) {
$next = $x + 1;
// Only do this if a matching user was found
if ((array_key_exists('checkedout_to', $asset_batch[$x])) && ($asset_batch[$x]['checkedout_to']!='')) {
if (($total_in_batch > 1) && ($x < $total_in_batch) && (array_key_exists($next, $asset_batch))) {
$checkin_date = Carbon::parse($asset_batch[$next]['checkin_date'])->format('Y-m-d H:i:s');
$asset_batch[$x]['real_checkin'] = $checkin_date;
\Log::debug($asset_batch[$next]['checkin_date']);
\Log::debug($checkin_date);
Actionlog::firstOrCreate(array(
'item_id' => $asset_batch[$x]['asset_id'],
'item_type' => Asset::class,
'user_id' => Auth::user()->id,
'note' => 'Checkin imported by ' . Auth::user()->present()->fullName() . ' from history importer',
'target_id' => null,
'created_at' => $checkin_date,
'action_type' => 'checkin'
));
}
}
}
}
return view('hardware/history')->with('status', $status);
}
@@ -760,7 +813,7 @@ class AssetsController extends Controller
$asset->unsetEventDispatcher();
$asset->next_audit_date = $request->input('next_audit_date');
$asset->last_audit_date = date('Y-m-d h:i:s');
$asset->last_audit_date = date('Y-m-d H:i:s');
// Check to see if they checked the box to update the physical location,
// not just note it in the audit notes

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Assets;
use App\Helpers\Helper;
use App\Http\Controllers\CheckInOutRequest;
use App\Http\Controllers\Controller;
use App\Models\Actionlog;
use App\Models\Asset;
use App\Models\Setting;
use Illuminate\Http\Request;
@@ -32,7 +33,8 @@ class BulkAssetsController extends Controller
return redirect()->back()->with('error', 'No assets selected');
}
$asset_ids = array_keys($request->input('ids'));
$asset_ids = array_values(array_unique($request->input('ids')));
if ($request->filled('bulk_actions')) {
switch($request->input('bulk_actions')) {
@@ -50,7 +52,7 @@ class BulkAssetsController extends Controller
return view('hardware/bulk-delete')->with('assets', $assets);
case 'edit':
return view('hardware/bulk')
->with('assets', request('ids'))
->with('assets', $asset_ids)
->with('statuslabel_list', Helper::statusLabelList());
}
}
@@ -90,6 +92,7 @@ class BulkAssetsController extends Controller
|| ($request->filled('model_id'))
) {
foreach ($assets as $assetId) {
$this->update_array = [];
$this->conditionallyAddItem('purchase_date')
@@ -102,7 +105,7 @@ class BulkAssetsController extends Controller
->conditionallyAddItem('warranty_months');
if ($request->filled('purchase_cost')) {
$this->update_array['purchase_cost'] = Helper::ParseFloat($request->input('purchase_cost'));
$this->update_array['purchase_cost'] = Helper::ParseCurrency($request->input('purchase_cost'));
}
if ($request->filled('company_id')) {
@@ -119,6 +122,24 @@ class BulkAssetsController extends Controller
}
}
$changed = [];
$asset = Asset::where('id' ,$assetId)->get();
foreach ($this->update_array as $key => $value) {
if ($this->update_array[$key] != $asset->toArray()[0][$key]) {
$changed[$key]['old'] = $asset->toArray()[0][$key];
$changed[$key]['new'] = $this->update_array[$key];
}
}
$logAction = new Actionlog();
$logAction->item_type = Asset::class;
$logAction->item_id = $assetId;
$logAction->created_at = date("Y-m-d H:i:s");
$logAction->user_id = Auth::id();
$logAction->log_meta = json_encode($changed);
$logAction->logaction('update');
DB::table('assets')
->where('id', $assetId)
->update($this->update_array);

View File

@@ -29,6 +29,7 @@ class ForgotPasswordController extends Controller
public function __construct()
{
$this->middleware('guest');
$this->middleware('throttle:5,1', ['except' => 'showLinkRequestForm']);
}
/**
@@ -61,7 +62,7 @@ class ForgotPasswordController extends Controller
$request->validate([
'username' => ['required', 'max:255'],
]);
/**
@@ -71,13 +72,21 @@ class ForgotPasswordController extends Controller
* Once we have attempted to send the link, we will examine the response
* then see the message we need to show to the user. Finally, we'll send out a proper response.
*/
$response = $this->broker()->sendResetLink(
array_merge(
$request->only('username'),
['activated' => '1'],
['ldap_import' => '0']
)
);
$response = null;
try {
$response = $this->broker()->sendResetLink(
array_merge(
$request->only('username'),
['activated' => '1'],
['ldap_import' => '0']
)
);
} catch(\Exception $e) {
\Log::info('Password reset attempt: User '.$request->input('username').'failed with exception: '.$e );
}
if ($response === \Password::RESET_LINK_SENT) {
\Log::info('Password reset attempt: User '.$request->input('username').' WAS found, password reset sent');

View File

@@ -58,12 +58,12 @@ class LoginController extends Controller
*
* @return void
*/
public function __construct(LdapAd $ldap, Saml $saml)
public function __construct(/*LdapAd $ldap, */ Saml $saml)
{
parent::__construct();
$this->middleware('guest', ['except' => ['logout','postTwoFactorAuth','getTwoFactorAuth','getTwoFactorEnroll']]);
Session::put('backUrl', \URL::previous());
$this->ldap = $ldap;
// $this->ldap = $ldap;
$this->saml = $saml;
}
@@ -105,13 +105,13 @@ class LoginController extends Controller
$samlData = $request->session()->get('saml_login');
if ($saml->isEnabled() && !empty($samlData)) {
try {
LOG::debug("Attempting to log user in by SAML authentication.");
Log::debug("Attempting to log user in by SAML authentication.");
$user = $saml->samlLogin($samlData);
if(!is_null($user)) {
Auth::login($user, true);
Auth::login($user);
} else {
$username = $saml->getUsername();
LOG::debug("SAML user '$username' could not be found in database.");
\Log::warning("SAML user '$username' could not be found in database.");
$request->session()->flash('error', trans('auth/message.signin.error'));
$saml->clearData();
}
@@ -121,7 +121,7 @@ class LoginController extends Controller
$user->save();
}
} catch (\Exception $e) {
LOG::debug("There was an error authenticating the SAML user: " . $e->getMessage());
\Log::warning("There was an error authenticating the SAML user: " . $e->getMessage());
throw new \Exception($e->getMessage());
}
}
@@ -142,8 +142,9 @@ class LoginController extends Controller
*/
private function loginViaLdap(Request $request): User
{
$ldap = \App::make( LdapAd::class);
try {
return $this->ldap->ldapLogin($request->input('username'), $request->input('password'));
return $ldap->ldapLogin($request->input('username'), $request->input('password'));
} catch (\Exception $ex) {
LOG::debug("LDAP user login: " . $ex->getMessage());
throw new \Exception($ex->getMessage());
@@ -157,15 +158,32 @@ class LoginController extends Controller
if (Setting::getSettings()->login_remote_user_enabled == "1" && isset($remote_user) && !empty($remote_user)) {
Log::debug("Authenticating via HTTP header $header_name.");
$pos = strpos($remote_user, '\\');
$strip_prefixes = [
// IIS/AD
// https://github.com/snipe/snipe-it/pull/5862
'\\',
// Google Cloud IAP
// https://cloud.google.com/iap/docs/identity-howto#getting_the_users_identity_with_signed_headers
'accounts.google.com:',
];
$pos = 0;
foreach ($strip_prefixes as $needle) {
if (($pos = strpos($remote_user, $needle)) !== FALSE) {
$pos += strlen($needle);
break;
}
}
if ($pos > 0) {
$remote_user = substr($remote_user, $pos + 1);
$remote_user = substr($remote_user, $pos);
};
try {
$user = User::where('username', '=', $remote_user)->whereNull('deleted_at')->where('activated', '=', '1')->first();
Log::debug("Remote user auth lookup complete");
if(!is_null($user)) Auth::login($user, true);
if(!is_null($user)) Auth::login($user, $request->input('remember'));
} catch(Exception $e) {
Log::debug("There was an error authenticating the Remote user: " . $e->getMessage());
}
@@ -189,8 +207,8 @@ class LoginController extends Controller
return redirect()->back()->withInput()->withErrors($validator);
}
$this->maxLoginAttempts = config('auth.throttle.max_attempts');
$this->lockoutTime = config('auth.throttle.lockout_duration');
$this->maxLoginAttempts = config('auth.passwords.users.throttle.max_attempts');
$this->lockoutTime = config('auth.passwords.users.throttle.lockout_duration');
if ($lockedOut = $this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
@@ -200,12 +218,12 @@ class LoginController extends Controller
$user = null;
// Should we even check for LDAP users?
if ($this->ldap->init()) {
if (Setting::getSettings()->ldap_enabled) { // avoid hitting the $this->ldap
LOG::debug("LDAP is enabled.");
try {
LOG::debug("Attempting to log user in by LDAP authentication.");
$user = $this->loginViaLdap($request);
Auth::login($user, true);
Auth::login($user, $request->input('remember'));
// If the user was unable to login via LDAP, log the error and let them fall through to
// local authentication.
@@ -452,8 +470,8 @@ class LoginController extends Controller
*/
protected function hasTooManyLoginAttempts(Request $request)
{
$lockoutTime = config('auth.throttle.lockout_duration');
$maxLoginAttempts = config('auth.throttle.max_attempts');
$lockoutTime = config('auth.passwords.users.throttle.lockout_duration');
$maxLoginAttempts = config('auth.passwords.users.throttle.max_attempts');
return $this->limiter()->tooManyAttempts(
$this->throttleKey($request),

View File

@@ -101,8 +101,8 @@ class SamlController extends Controller
$errors = $auth->getErrors();
if (!empty($errors)) {
Log::debug("There was an error with SAML ACS: " . implode(', ', $errors));
Log::debug("Reason: " . $auth->getLastErrorReason());
Log::error("There was an error with SAML ACS: " . implode(', ', $errors));
Log::error("Reason: " . $auth->getLastErrorReason());
return redirect()->route('login')->with('error', trans('auth/message.signin.error'));
}
@@ -115,7 +115,7 @@ class SamlController extends Controller
* Receives LogoutRequest/LogoutResponse from IdP and flashes
* back to the LoginController for logging out.
*
* /saml/slo
* /saml/sls
*
* @author Johnson Yi <jyi.dev@outlook.com>
*
@@ -128,12 +128,13 @@ class SamlController extends Controller
public function sls(Request $request)
{
$auth = $this->saml->getAuth();
$sloUrl = $auth->processSLO(true, null, null, null, true);
$retrieveParametersFromServer = $this->saml->getSetting('retrieveParametersFromServer', false);
$sloUrl = $auth->processSLO(true, null, $retrieveParametersFromServer, null, true);
$errors = $auth->getErrors();
if (!empty($errors)) {
Log::debug("There was an error with SAML SLS: " . implode(', ', $errors));
Log::debug("Reason: " . $auth->getLastErrorReason());
Log::error("There was an error with SAML SLS: " . implode(', ', $errors));
Log::error("Reason: " . $auth->getLastErrorReason());
return view('errors.403');
}

View File

@@ -32,6 +32,7 @@ class BulkAssetModelsController extends Controller
// If deleting....
if ($request->input('bulk_actions')=='delete') {
$this->authorize('delete', AssetModel::class);
$valid_count = 0;
foreach ($models as $model) {
if ($model->assets_count == 0) {
@@ -42,7 +43,7 @@ class BulkAssetModelsController extends Controller
// Otherwise display the bulk edit screen
}
$this->authorize('update', AssetModel::class);
$nochange = ['NC' => 'No Change'];
return view('models/bulk-edit', compact('models'))
->with('fieldset_list', $nochange + Helper::customFieldsetList())
@@ -63,7 +64,8 @@ class BulkAssetModelsController extends Controller
*/
public function update(Request $request)
{
$this->authorize('update', AssetModel::class);
$models_raw_array = $request->input('ids');
$update_array = array();
@@ -103,6 +105,8 @@ class BulkAssetModelsController extends Controller
*/
public function destroy(Request $request)
{
$this->authorize('delete', AssetModel::class);
$models_raw_array = $request->input('ids');
if ((is_array($models_raw_array)) && (count($models_raw_array) > 0)) {

View File

@@ -5,6 +5,7 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\ImageUploadRequest;
use App\Models\Company;
use App\Models\Component;
use App\Helpers\Helper;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Storage;
@@ -74,7 +75,7 @@ class ComponentsController extends Controller
$component->min_amt = $request->input('min_amt', null);
$component->serial = $request->input('serial', null);
$component->purchase_date = $request->input('purchase_date', null);
$component->purchase_cost = $request->input('purchase_cost', null);
$component->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost', null));
$component->qty = $request->input('qty');
$component->user_id = Auth::id();
@@ -144,7 +145,7 @@ class ComponentsController extends Controller
$component->min_amt = $request->input('min_amt');
$component->serial = $request->input('serial');
$component->purchase_date = $request->input('purchase_date');
$component->purchase_cost = request('purchase_cost');
$component->purchase_cost = Helper::ParseCurrency(request('purchase_cost'));
$component->qty = $request->input('qty');
$component = $request->handleImages($component);

View File

@@ -75,7 +75,7 @@ class ConsumablesController extends Controller
$consumable->model_number = $request->input('model_number');
$consumable->item_no = $request->input('item_no');
$consumable->purchase_date = $request->input('purchase_date');
$consumable->purchase_cost = Helper::ParseFloat($request->input('purchase_cost'));
$consumable->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost'));
$consumable->qty = $request->input('qty');
$consumable->user_id = Auth::id();
@@ -141,7 +141,7 @@ class ConsumablesController extends Controller
$consumable->model_number = $request->input('model_number');
$consumable->item_no = $request->input('item_no');
$consumable->purchase_date = $request->input('purchase_date');
$consumable->purchase_cost = Helper::ParseFloat($request->input('purchase_cost'));
$consumable->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost'));
$consumable->qty = Helper::ParseFloat($request->input('qty'));
$consumable = $request->handleImages($consumable);

View File

@@ -40,6 +40,24 @@ class CustomFieldsController extends Controller
}
/**
* Just redirect the user back if they try to view the details of a field.
* We already show those details on the listing page.
*
* @see CustomFieldsController::storeField()
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v5.1.5]
* @return Redirect
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function show()
{
return redirect()->route("fields.index");
}
/**
* Returns a view with a form to create a new custom field.
*
@@ -74,7 +92,7 @@ class CustomFieldsController extends Controller
$this->authorize('create', CustomField::class);
$field = new CustomField([
"name" => $request->get("name"),
"name" => trim($request->get("name")),
"element" => $request->get("element"),
"help_text" => $request->get("help_text"),
"field_values" => $request->get("field_values"),
@@ -115,12 +133,23 @@ class CustomFieldsController extends Controller
$this->authorize('update', $field);
if ($field->fieldset()->detach($fieldset_id)) {
return redirect()->route('fieldsets.show', ['fieldset' => $fieldset_id])
->with("success", trans('admin/custom_fields/message.field.delete.success'));
// Check that the field exists - this is mostly related to the demo, where we
// rewrite the data every x minutes, so it's possible someone might be disassociating
// a field from a fieldset just as we're wiping the database
if (($field) && ($fieldset_id)) {
if ($field->fieldset()->detach($fieldset_id)) {
return redirect()->route('fieldsets.show', ['fieldset' => $fieldset_id])
->with("success", trans('admin/custom_fields/message.field.delete.success'));
} else {
return redirect()->back()->withErrors(['message' => "Field is in use and cannot be deleted."]);
}
}
return redirect()->back()->withErrors(['message' => "Field is in-use"]);
return redirect()->back()->withErrors(['message' => "Error deleting field from fieldset"]);
}
/**
@@ -133,16 +162,19 @@ class CustomFieldsController extends Controller
*/
public function destroy($field_id)
{
$field = CustomField::find($field_id);
if ($field = CustomField::find($field_id)) {
$this->authorize('delete', $field);
$this->authorize('delete', $field);
if ($field->fieldset->count()>0) {
return redirect()->back()->withErrors(['message' => "Field is in-use"]);
if (($field->fieldset) && ($field->fieldset->count() > 0)) {
return redirect()->back()->withErrors(['message' => "Field is in-use"]);
}
$field->delete();
return redirect()->route("fields.index")
->with("success", trans('admin/custom_fields/message.field.delete.success'));
}
$field->delete();
return redirect()->route("fields.index")
->with("success", trans('admin/custom_fields/message.field.delete.success'));
return redirect()->back()->withErrors(['message' => "Field does not exist"]);
}
@@ -157,20 +189,25 @@ class CustomFieldsController extends Controller
*/
public function edit($id)
{
$field = CustomField::find($id);
if ($field = CustomField::find($id)) {
$this->authorize('update', $field);
$this->authorize('update', $field);
$customFormat = '';
if((stripos($field->format, 'regex') === 0) && ($field->format !== CustomField::PREDEFINED_FORMATS['MAC'])) {
$customFormat = $field->format;
}
$customFormat = '';
if((stripos($field->format, 'regex') === 0) && ($field->format !== CustomField::PREDEFINED_FORMATS['MAC'])) {
$customFormat = $field->format;
}
return view("custom_fields.fields.edit",[
'field' => $field,
'customFormat' => $customFormat,
'predefinedFormats' => Helper::predefined_formats()
]);
return view("custom_fields.fields.edit",[
'field' => $field,
'customFormat' => $customFormat,
'predefinedFormats' => Helper::predefined_formats()
]);
}
return redirect()->route("fields.index")
->with("error", trans('admin/custom_fields/message.field.invalid'));
}
@@ -191,7 +228,7 @@ class CustomFieldsController extends Controller
$this->authorize('update', $field);
$field->name = e($request->get("name"));
$field->name = trim(e($request->get("name")));
$field->element = e($request->get("element"));
$field->field_values = e($request->get("field_values"));
$field->user_id = Auth::id();

View File

@@ -23,6 +23,12 @@ use Redirect;
class CustomFieldsetsController extends Controller
{
public function index()
{
return redirect()->route("fields.index")
->with("error", trans('admin/custom_fields/message.fieldset.does_not_exist'));
}
/**
* Validates and stores a new custom field.
*

View File

@@ -69,6 +69,7 @@ class DepreciationsController extends Controller
// Depreciation data
$depreciation->name = $request->input('name');
$depreciation->months = $request->input('months');
$depreciation->depreciation_min= $request->input('depreciation_min');
$depreciation->user_id = Auth::id();
// Was the asset created?
@@ -125,8 +126,9 @@ class DepreciationsController extends Controller
$this->authorize('update', $depreciation);
// Depreciation data
$depreciation->name = $request->input('name');
$depreciation->months = $request->input('months');
$depreciation->name = $request->input('name');
$depreciation->months = $request->input('months');
$depreciation->depreciation_min = $request->input('depreciation_min');
// Was the asset created?
if ($depreciation->save()) {

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Routing\Controller as BaseController;
/**
* This controller provide the healthz route for
* the Snipe-IT Asset Management application.
*
* @version v1.0
*/
class HealthController extends BaseController
{
/**
* Returns a fixed JSON content ({ "status": "ok"}) which indicate the app is up and running
*/
public function get() {
return response()->json([
"status" => "ok"
]);
}
}

View File

@@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
use App\Models\License;
use App\Models\LicenseSeat;
use App\Models\User;
use App\Models\Asset;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;
@@ -80,7 +81,12 @@ class LicenseCheckinController extends Controller
// Ooops.. something went wrong
return redirect()->back()->withInput()->withErrors($validator);
}
$return_to = User::find($licenseSeat->assigned_to);
if($licenseSeat->assigned_to != null){
$return_to = User::find($licenseSeat->assigned_to);
} else {
$return_to = Asset::find($licenseSeat->asset_id);
}
// Update the asset data
$licenseSeat->assigned_to = null;
@@ -88,7 +94,6 @@ class LicenseCheckinController extends Controller
// Was the asset updated?
if ($licenseSeat->save()) {
event(new CheckoutableCheckedIn($licenseSeat, $return_to, Auth::user(), $request->input('note')));
if ($backTo=='user') {

View File

@@ -6,10 +6,11 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\AssetFileRequest;
use App\Models\Actionlog;
use App\Models\License;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\JsonResponse;
use App\Helpers\StorageHelper;
use enshrined\svgSanitize\Sanitizer;
class LicenseFilesController extends Controller
{
@@ -36,28 +37,39 @@ class LicenseFilesController extends Controller
if (!Storage::exists('private_uploads/licenses')) Storage::makeDirectory('private_uploads/licenses', 775);
$upload_success = false;
foreach ($request->file('file') as $file) {
$file_name = 'license-'.$license->id.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$file->getClientOriginalExtension())).'.'.$file->getClientOriginalExtension();
$extension = $file->getClientOriginalExtension();
$file_name = 'license-'.$license->id.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$extension;
$upload_success = $file->storeAs('private_uploads/licenses', $file_name);
// $upload_success = $file->storeAs('private_uploads/licenses/'.$file_name, $file);
// Check for SVG and sanitize it
if ($extension == 'svg') {
\Log::debug('This is an SVG');
\Log::debug($file_name);
$sanitizer = new Sanitizer();
$dirtySVG = file_get_contents($file->getRealPath());
$cleanSVG = $sanitizer->sanitize($dirtySVG);
try {
Storage::put('private_uploads/licenses/'.$file_name, $cleanSVG);
} catch (\Exception $e) {
\Log::debug('Upload no workie :( ');
\Log::debug($e);
}
} else {
Storage::put('private_uploads/licenses/'.$file_name, file_get_contents($file));
}
//Log the upload to the log
$license->logUpload($file_name, e($request->input('notes')));
}
// This being called from a modal seems to confuse redirect()->back()
// It thinks we should go to the dashboard. As this is only used
// from the modal at present, hardcode the redirect. Longterm
// maybe we evaluate something else.
if ($upload_success) {
return redirect()->route('licenses.show', $license->id)->with('success', trans('admin/licenses/message.upload.success'));
}
return redirect()->route('licenses.show', $license->id)->with('error', trans('admin/licenses/message.upload.error'));
}
return redirect()->route('licenses.show', $license->id)->with('error', trans('admin/licenses/message.upload.nofiles'));
}
@@ -143,18 +155,18 @@ class LicenseFilesController extends Controller
// We have to override the URL stuff here, since local defaults in Laravel's Flysystem
// won't work, as they're not accessible via the web
if (config('filesystems.default') == 'local') {
return Storage::download($file);
if (config('filesystems.default') == 'local') { // TODO - is there any way to fix this at the StorageHelper layer?
return StorageHelper::downloader($file);
} else {
if ($download != 'true') {
\Log::debug('display the file');
if ($contents = file_get_contents(Storage::url($file))) {
if ($contents = file_get_contents(Storage::url($file))) { // TODO - this will fail on private S3 files or large public ones
return Response::make(Storage::url($file)->header('Content-Type', mime_content_type($file)));
}
return JsonResponse::create(["error" => "Failed validation: "], 500);
}
return Storage::download($file);
return StorageHelper::downloader($file);
}
}

View File

@@ -88,7 +88,7 @@ class LicensesController extends Controller
$license->name = $request->input('name');
$license->notes = $request->input('notes');
$license->order_number = $request->input('order_number');
$license->purchase_cost = $request->input('purchase_cost');
$license->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost'));
$license->purchase_date = $request->input('purchase_date');
$license->purchase_order = $request->input('purchase_order');
$license->purchase_order = $request->input('purchase_order');
@@ -165,7 +165,7 @@ class LicensesController extends Controller
$license->name = $request->input('name');
$license->notes = $request->input('notes');
$license->order_number = $request->input('order_number');
$license->purchase_cost = $request->input('purchase_cost');
$license->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost'));
$license->purchase_date = $request->input('purchase_date');
$license->purchase_order = $request->input('purchase_order');
$license->reassignable = $request->input('reassignable', 0);

View File

@@ -4,7 +4,9 @@ namespace App\Http\Controllers;
use App\Http\Requests\ImageUploadRequest;
use App\Models\Location;
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use App\Models\Asset;
use Illuminate\Support\Facades\Storage;
/**
@@ -67,7 +69,6 @@ class LocationsController extends Controller
{
$this->authorize('create', Location::class);
$location = new Location();
$location->id = null; // This is required to make Laravels different validation work, it errors if the parameter doesn't exist (maybe a bug)?
$location->name = $request->input('name');
$location->parent_id = $request->input('parent_id', null);
$location->currency = $request->input('currency', '$');
@@ -132,7 +133,6 @@ class LocationsController extends Controller
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
}
// Update the location data
$location->name = $request->input('name');
$location->parent_id = $request->input('parent_id', null);
@@ -212,5 +212,29 @@ class LocationsController extends Controller
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
}
public function print_assigned($id)
{
}
$location = Location::where('id',$id)->first();
$parent = Location::where('id',$location->parent_id)->first();
$manager = User::where('id',$location->manager_id)->first();
$users = User::where('location_id', $id)->with('company', 'department', 'location')->get();
$assets = Asset::where('assigned_to', $id)->where('assigned_type', Location::class)->with('model', 'model.category')->get();
return view('locations/print')->with('assets', $assets)->with('users',$users)->with('location', $location)->with('parent', $parent)->with('manager', $manager);
}
public function print_all_assigned($id)
{
$location = Location::where('id',$id)->first();
$parent = Location::where('id',$location->parent_id)->first();
$manager = User::where('id',$location->manager_id)->first();
$users = User::where('location_id', $id)->with('company', 'department', 'location')->get();
$assets = Asset::where('location_id', $id)->with('model', 'model.category')->get();
return view('locations/print')->with('assets', $assets)->with('users',$users)->with('location', $location)->with('parent', $parent)->with('manager', $manager);
}
}

View File

@@ -158,7 +158,7 @@ class ManufacturersController extends Controller
public function destroy($manufacturerId)
{
$this->authorize('delete', Manufacturer::class);
if (is_null($manufacturer = Manufacturer::withCount('models as models_count')->find($manufacturerId))) {
if (is_null($manufacturer = Manufacturer::withTrashed()->withCount('models as models_count')->find($manufacturerId))) {
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.not_found'));
}
@@ -174,8 +174,12 @@ class ManufacturersController extends Controller
}
}
// Delete the manufacturer
$manufacturer->delete();
// Soft delete the manufacturer if active, permanent delete if is already deleted
if($manufacturer->deleted_at === NULL) {
$manufacturer->delete();
} else {
$manufacturer->forceDelete();
}
// Redirect to the manufacturers management page
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.delete.success'));
}

View File

@@ -6,15 +6,49 @@ use App\Helpers\Helper;
class ModalController extends Controller
{
function show($type, $itemId = null) {
$view = view("modals.${type}");
if($type == "statuslabel") {
$view->with('statuslabel_types', Helper::statusTypeList());
/**
* Load the modal views after confirming they are in the allowed_types array.
* The allowed types away just prevents shithead skiddies from fuzzing the urls
* with automated scripts and junking up the logs. - snipe
*
* @version v5.3.7-pre
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
* @author [A. Gianotto] [<snipe@snipe.net]
* @return View
*/
function show ($type, $itemId = null) {
// These values should correspond to a file in resources/views/modals/
$allowed_types = [
'category',
'kit-model',
'kit-license',
'kit-consumable',
'kit-accessory',
'location',
'manufacturer',
'model',
'statuslabel',
'supplier',
'upload-file',
'user',
];
if (in_array($type, $allowed_types)) {
$view = view("modals.${type}");
if ($type == "statuslabel") {
$view->with('statuslabel_types', Helper::statusTypeList());
}
if (in_array($type, ['kit-model', 'kit-license', 'kit-consumable', 'kit-accessory'])) {
$view->with('kitId', $itemId);
}
return $view;
}
if(in_array($type, ['kit-model', 'kit-license', 'kit-consumable', 'kit-accessory'])) {
$view->with('kitId', $itemId);
}
return $view;
abort(404,'Page not found');
}
}

View File

@@ -48,10 +48,9 @@ class ProfileController extends Controller
$user->last_name = $request->input('last_name');
$user->website = $request->input('website');
$user->gravatar = $request->input('gravatar');
$user->skin = $request->input('skin');
$user->phone = $request->input('phone');
if (!config('app.lock_passwords')) {
$user->locale = $request->input('locale', 'en');
}
@@ -114,6 +113,12 @@ class ProfileController extends Controller
* @return View
*/
public function api() {
// Make sure the self.api permission has been granted
if (!Gate::allows('self.api')) {
abort(403);
}
return view('account/api');
}

View File

@@ -102,11 +102,7 @@ class ReportsController extends Controller
{
$this->authorize('reports.view');
$depreciations = Depreciation::get();
// Grab all the assets
$assets = Asset::with( 'assignedTo', 'assetstatus', 'defaultLoc', 'location', 'company', 'model.category', 'model.depreciation')
->orderBy('created_at', 'DESC')->get();
return view('reports/depreciation', compact('assets'))->with('depreciations',$depreciations);
return view('reports/depreciation')->with('depreciations',$depreciations);
}
/**
@@ -403,7 +399,7 @@ class ReportsController extends Controller
*/
public function postCustom(Request $request)
{
ini_set('max_execution_time', 12000);
ini_set('max_execution_time', env('REPORT_TIME_LIMIT', 12000)); //12000 seconds = 200 minutes
$this->authorize('reports.view');
@@ -519,6 +515,10 @@ class ReportsController extends Controller
$header[] = trans('general.department');
}
if ($request->filled('title')) {
$header[] = trans('admin/users/table.title');
}
if ($request->filled('status')) {
$header[] = trans('general.status');
}
@@ -563,7 +563,7 @@ class ReportsController extends Controller
foreach ($customfields as $customfield) {
if (e($request->input($customfield->db_column_name())) == '1') {
if ($request->input($customfield->db_column_name()) == '1') {
$header[] = $customfield->name;
}
}
@@ -632,8 +632,16 @@ class ReportsController extends Controller
if (($request->filled('expected_checkin_start')) && ($request->filled('expected_checkin_end'))) {
$assets->whereBetween('assets.expected_checkin', [$request->input('expected_checkin_start'), $request->input('expected_checkin_end')]);
}
if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) {
$assets->whereBetween('assets.last_audit_date', [$request->input('last_audit_start'), $request->input('last_audit_end')]);
}
if (($request->filled('next_audit_start')) && ($request->filled('next_audit_end'))) {
$assets->whereBetween('assets.next_audit_date', [$request->input('next_audit_start'), $request->input('next_audit_end')]);
}
$assets->orderBy('assets.created_at', 'ASC')->chunk(20, function($assets) use($handle, $customfields, $request) {
$assets->orderBy('assets.id', 'ASC')->chunk(20, function($assets) use($handle, $customfields, $request) {
$executionTime = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];
\Log::debug('Walking results: '.$executionTime);
@@ -750,7 +758,6 @@ class ReportsController extends Controller
}
}
if ($request->filled('department')) {
if ($asset->checkedOutToUser()) {
$row[] = (($asset->assignedto) && ($asset->assignedto->department)) ? $asset->assignedto->department->name : '';
@@ -759,6 +766,14 @@ class ReportsController extends Controller
}
}
if ($request->filled('title')) {
if ($asset->checkedOutToUser()) {
$row[] = ($asset->assignedto) ? $asset->assignedto->jobtitle : '';
} else {
$row[] = ''; // Empty string if unassigned
}
}
if ($request->filled('status')) {
$row[] = ($asset->assetstatus) ? $asset->assetstatus->name.' ('.$asset->present()->statusMeta.')' : '';
}

View File

@@ -21,6 +21,8 @@ use Image;
use Input;
use Redirect;
use Response;
use App\Helpers\StorageHelper;
use App\Http\Requests\SlackSettingsRequest;
/**
* This controller handles all actions related to Settings for
@@ -399,6 +401,7 @@ class SettingsController extends Controller
$setting->version_footer = $request->input('version_footer');
$setting->footer_text = $request->input('footer_text');
$setting->skin = $request->input('skin');
$setting->allow_user_skin = $request->input('allow_user_skin');
$setting->show_url_in_emails = $request->input('show_url_in_emails', '0');
$setting->logo_print_assets = $request->input('logo_print_assets', '0');
@@ -577,6 +580,7 @@ class SettingsController extends Controller
$setting->default_currency = $request->input('default_currency', '$');
$setting->date_display_format = $request->input('date_display_format');
$setting->time_display_format = $request->input('time_display_format');
$setting->digit_separator = $request->input('digit_separator');
if ($setting->save()) {
return redirect()->route('settings.index')
@@ -664,25 +668,16 @@ class SettingsController extends Controller
*
* @return View
*/
public function postSlack(Request $request)
public function postSlack(SlackSettingsRequest $request)
{
if (is_null($setting = Setting::getSettings())) {
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
}
$validatedData = $request->validate([
'slack_channel' => 'regex:/(?<!\w)#\w+/|required_with:slack_endpoint|nullable',
]);
if ($validatedData) {
$setting->slack_endpoint = $request->input('slack_endpoint');
$setting->slack_channel = $request->input('slack_channel');
$setting->slack_botname = $request->input('slack_botname');
}
$setting->slack_endpoint = $request->input('slack_endpoint');
$setting->slack_channel = $request->input('slack_channel');
$setting->slack_botname = $request->input('slack_botname');
if ($setting->save()) {
return redirect()->route('settings.index')
->with('success', trans('admin/settings/message.update.success'));
@@ -940,10 +935,18 @@ class SettingsController extends Controller
$setting->ldap_tls = $request->input('ldap_tls', '0');
$setting->ldap_pw_sync = $request->input('ldap_pw_sync', '0');
$setting->custom_forgot_pass_url = $request->input('custom_forgot_pass_url');
$setting->ldap_phone_field = $request->input('ldap_phone');
$setting->ldap_jobtitle = $request->input('ldap_jobtitle');
$setting->ldap_country = $request->input('ldap_country');
$setting->ldap_dept = $request->input('ldap_dept');
$setting->ldap_client_tls_cert = $request->input('ldap_client_tls_cert');
$setting->ldap_client_tls_key = $request->input('ldap_client_tls_key');
}
if ($setting->save()) {
$setting->update_client_side_cert_files();
return redirect()->route('settings.ldap.index')
->with('success', trans('admin/settings/message.update.success'));
}
@@ -991,6 +994,11 @@ class SettingsController extends Controller
$setting->saml_sp_x509cert = $request->input('saml_sp_x509cert');
$setting->saml_sp_privatekey = $request->input('saml_sp_privatekey');
}
if (!empty($request->input('saml_sp_x509certNew'))) {
$setting->saml_sp_x509certNew = $request->input('saml_sp_x509certNew');
} else {
$setting->saml_sp_x509certNew = "";
}
$setting->saml_custom_settings = $request->input('saml_custom_settings');
if ($setting->save()) {
@@ -1015,7 +1023,7 @@ class SettingsController extends Controller
$path = 'app/backups';
$backup_files = Storage::files($path);
$files = [];
$files_raw = [];
if (count($backup_files) > 0) {
for ($f = 0; $f < count($backup_files); ++$f) {
@@ -1023,7 +1031,7 @@ class SettingsController extends Controller
// Skip dotfiles like .gitignore and .DS_STORE
if ((substr(basename($backup_files[$f]), 0, 1) != '.')) {
$files[] = [
$files_raw[] = [
'filename' => basename($backup_files[$f]),
'filesize' => Setting::fileSizeConvert(Storage::size($backup_files[$f])),
'modified' => Storage::lastModified($backup_files[$f]),
@@ -1035,6 +1043,9 @@ class SettingsController extends Controller
}
}
// Reverse the array so it lists oldest first
$files = array_reverse($files_raw);
return view('settings/backups', compact('path', 'files'));
}
@@ -1087,7 +1098,7 @@ class SettingsController extends Controller
if (! config('app.lock_passwords')) {
if (Storage::exists($path . '/' . $filename)) {
return Storage::download($path . '/' . $filename);
return StorageHelper::downloader($path . '/' . $filename);
} else {
// Redirect to the backup page
return redirect()->route('settings.backups.index')->with('error', trans('admin/settings/message.backup.file_not_found'));
@@ -1138,6 +1149,7 @@ class SettingsController extends Controller
*/
public function getPurge()
{
\Log::warning('User ID '.Auth::user()->id.' is attempting a PURGE');
return view('settings.purge-form');
}
@@ -1154,6 +1166,8 @@ class SettingsController extends Controller
{
if (! config('app.lock_passwords')) {
if ('DELETE' == $request->input('confirm_purge')) {
\Log::warning('User ID '.Auth::user()->id.' initiated a PURGE!');
// Run a backup immediately before processing
Artisan::call('backup:run');
Artisan::call('snipeit:purge', ['--force' => 'true', '--no-interaction' => true]);
@@ -1213,4 +1227,4 @@ class SettingsController extends Controller
{
return view('settings.logins');
}
}
}

View File

@@ -184,6 +184,7 @@ class SuppliersController extends Controller
*/
public function show($supplierId = null)
{
$this->authorize('view', Supplier::class);
$supplier = Supplier::find($supplierId);
if (isset($supplier->id)) {

View File

@@ -34,7 +34,8 @@ class BulkUsersController extends Controller
// Make sure there were users selected
if (($request->filled('ids')) && (count($request->input('ids')) > 0)) {
// Get the list of affected users
$users = User::whereIn('id', array_keys(request('ids')))
$user_raw_array = request('ids');
$users = User::whereIn('id', $user_raw_array)
->with('groups', 'assets', 'licenses', 'accessories')->get();
if ($request->input('bulk_actions') == 'edit') {
@@ -174,7 +175,7 @@ class BulkUsersController extends Controller
}
$users = User::whereIn('id', $user_raw_array)->get();
$assets = Asset::whereIn('assigned_to', $user_raw_array)->get();
$assets = Asset::whereIn('assigned_to', $user_raw_array)->where('assigned_type', 'App\Models\User')->get();
$accessories = DB::table('accessories_users')->whereIn('assigned_to', $user_raw_array)->get();
$licenses = DB::table('license_seats')->whereIn('assigned_to', $user_raw_array)->get();

View File

@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use App\Services\LdapAd;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use App\Models\User; // Note that this is awful close to 'Users' the namespace above; be careful
class LDAPImportController extends Controller
{
@@ -65,6 +66,7 @@ class LDAPImportController extends Controller
*/
public function store(Request $request)
{
$this->authorize('update', User::class);
// Call Artisan LDAP import command.
$location_id = $request->input('location_id');
Artisan::call('snipeit:ldap-sync', ['--location_id' => $location_id, '--json_summary' => true]);

View File

@@ -10,6 +10,8 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use enshrined\svgSanitize\Sanitizer;
use Illuminate\Support\Facades\Storage;
class UserFilesController extends Controller
{
@@ -33,13 +35,36 @@ class UserFilesController extends Controller
$logActions = [];
$files = $request->file('file');
if (is_null($files)){
return redirect()->back()->with('error', trans('admin/users/message.upload.nofiles'));
}
foreach($files as $file) {
$extension = $file->getClientOriginalExtension();
$filename = 'user-' . $user->id . '-' . str_random(8);
$filename .= '-' . str_slug($file->getClientOriginalName()) . '.' . $extension;
if (!$file->move($destinationPath, $filename)) {
return JsonResponse::create(["error" => "Unabled to move file"], 500);
}
$file_name = 'user-'.$user->id.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$extension;
// Check for SVG and sanitize it
if ($extension == 'svg') {
\Log::debug('This is an SVG');
\Log::debug($file_name);
$sanitizer = new Sanitizer();
$dirtySVG = file_get_contents($file->getRealPath());
$cleanSVG = $sanitizer->sanitize($dirtySVG);
try {
Storage::put('private_uploads/users/'.$file_name, $cleanSVG);
} catch (\Exception $e) {
\Log::debug('Upload no workie :( ');
\Log::debug($e);
}
} else {
Storage::put('private_uploads/users/'.$file_name, file_get_contents($file));
}
//Log the uploaded file to the log
$logAction = new Actionlog();
$logAction->item_id = $user->id;
@@ -48,7 +73,7 @@ class UserFilesController extends Controller
$logAction->note = $request->input('notes');
$logAction->target_id = null;
$logAction->created_at = date("Y-m-d H:i:s");
$logAction->filename = $filename;
$logAction->filename = $file_name;
$logAction->action_type = 'uploaded';
if (!$logAction->save()) {
@@ -57,10 +82,10 @@ class UserFilesController extends Controller
}
$logActions[] = $logAction;
}
// dd($logActions);
return JsonResponse::create($logActions);
// dd($logActions);
return redirect()->back()->with('success', trans('admin/users/message.upload.success'));
}
return JsonResponse::create(["error" => "No User associated with this request"], 500);
return redirect()->back()->with('error', trans('admin/users/message.upload.nofiles'));
}
@@ -117,7 +142,7 @@ class UserFilesController extends Controller
$log = Actionlog::find($fileId);
$file = $log->get_src('users');
return Response::download($file);
return Response::download($file); //FIXME this doesn't use the new StorageHelper yet, but it's complicated...
}
// Prepare the error message
$error = trans('admin/users/message.user_not_found', ['id' => $userId]);

View File

@@ -15,6 +15,7 @@ use App\Models\User;
use App\Notifications\WelcomeNotification;
use Auth;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Facades\Password;
use Input;
use Redirect;
use Str;
@@ -483,7 +484,6 @@ class UsersController extends Controller
$user->first_name = '';
$user->last_name = '';
$user->email = substr($user->email, ($pos = strpos($user->email, '@')) !== false ? $pos : 0);
$user->id = null;
// Get this user groups
@@ -617,4 +617,31 @@ class UsersController extends Controller
->with('show_user', $show_user)
->with('settings', Setting::getSettings());
}
/**
* Send individual password reset email
*
* @author A. Gianotto
* @since [v5.0.15]
* @return \Illuminate\Http\RedirectResponse
*/
public function sendPasswordReset($id) {
if (($user = User::find($id)) && ($user->activated == '1') && ($user->email!='') && ($user->ldap_import == '0')) {
$credentials = ['email' => $user->email];
try {
\Password::sendResetLink($credentials, function (Message $message) use ($user) {
$message->subject($this->getEmailSubject());
});
return redirect()->back()->with('success', trans('admin/users/message.password_reset_sent', ['email' => $user->email]));
} catch (\Exception $e) {
return redirect()->back()->with('error', ' Error sending email. :( ');
}
}
return redirect()->back()->with('error', 'User is not activated, is LDAP synced, or does not have an email address ');
}
}

View File

@@ -179,7 +179,7 @@ class ViewAssetsController extends Controller
$logaction->logaction('request canceled');
$settings->notify(new RequestAssetCancelation($data));
return redirect()->route('requestable-assets')
->with('success')->with('success', trans('admin/hardware/message.requests.cancel-success'));
->with('success')->with('success', trans('admin/hardware/message.requests.cancel'));
}
$logaction->logaction('requested');

View File

@@ -14,6 +14,7 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middleware = [
\App\Http\Middleware\NoSessionStore::class,
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
@@ -22,6 +23,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\CheckForDebug::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\SecurityHeaders::class,
\App\Http\Middleware\PreventBackHistory::class,
];

View File

@@ -17,16 +17,41 @@ class AssetCountForSidebar
*/
public function handle($request, Closure $next)
{
$total_rtd_sidebar = Asset::RTD()->count();
$total_deployed_sidebar = Asset::Deployed()->count();
$total_archived_sidebar = Asset::Archived()->count();
$total_pending_sidebar = Asset::Pending()->count();
$total_undeployable_sidebar = Asset::Undeployable()->count();
view()->share('total_rtd_sidebar', $total_rtd_sidebar);
view()->share('total_deployed_sidebar', $total_deployed_sidebar);
view()->share('total_archived_sidebar', $total_archived_sidebar);
view()->share('total_pending_sidebar', $total_pending_sidebar);
view()->share('total_undeployable_sidebar', $total_undeployable_sidebar);
try
{
$total_rtd_sidebar = Asset::RTD()->count();
view()->share('total_rtd_sidebar', $total_rtd_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
try {
$total_deployed_sidebar = Asset::Deployed()->count();
view()->share('total_deployed_sidebar', $total_deployed_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
try {
$total_archived_sidebar = Asset::Archived()->count();
view()->share('total_archived_sidebar', $total_archived_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
try {
$total_pending_sidebar = Asset::Pending()->count();
view()->share('total_pending_sidebar', $total_pending_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
try {
$total_undeployable_sidebar = Asset::Undeployable()->count();
view()->share('total_undeployable_sidebar', $total_undeployable_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
return $next($request);
}

View File

@@ -27,7 +27,7 @@ class CheckForSetup
}
} else {
if (!($request->is('setup*')) && !($request->is('.env'))) {
if (!($request->is('setup*')) && !($request->is('.env')) && !($request->is('health'))) {
return redirect(url('/').'/setup');
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Middleware;
use Closure;
class NoSessionStore
{
protected $except = [
'health'
];
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
foreach ($this->except as $except) {
if ($request->is($except)) {
config()->set('session.driver', 'array');
}
}
return $next($request);
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Middleware;
use Closure;
class PreventBackHistory
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$headers = [
'Cache-Control' => 'no-cache, no-store, max-age=0, must-revalidate',
'Pragma' => 'no-cache',
'Expires' => 'Sun, 02 Jan 1990 00:00:00 GMT'
];
$response = $next($request);
foreach($headers as $key => $value) {
$response->headers->set($key, $value);
}
return $response;
}
}

View File

@@ -99,7 +99,7 @@ class SecurityHeaders
// We have to exclude debug mode here because debugbar pulls from a CDN or two
// and it will break things.
if ((config('app.debug')!='true') || (config('app.enable_csp')=='true')) {
if ((config('app.debug')!='true') && (config('app.enable_csp')=='true')) {
$csp_policy[] = "default-src 'self'";
$csp_policy[] = "style-src 'self' 'unsafe-inline'";
$csp_policy[] = "script-src 'self' 'unsafe-inline' 'unsafe-eval'";

View File

@@ -12,5 +12,6 @@ class VerifyCsrfToken extends BaseVerifier
* @var array
*/
protected $except = [
'health'
];
}

View File

@@ -24,7 +24,7 @@ class AssetFileRequest extends Request
{
$max_file_size = \App\Helpers\Helper::file_upload_max_size();
return [
'file.*' => 'required|mimes:png,gif,jpg,svg,jpeg,doc,docx,pdf,txt,zip,rar,xls,xlsx,lic,xml,rtf|max:'.$max_file_size,
'file.*' => 'required|mimes:png,gif,jpg,svg,jpeg,doc,docx,pdf,txt,zip,rar,xls,xlsx,lic,xml,rtf,webp|max:'.$max_file_size,
];
}
}

View File

@@ -5,10 +5,14 @@ namespace App\Http\Requests;
use App\Models\SnipeModel;
use Intervention\Image\Facades\Image;
use enshrined\svgSanitize\Sanitizer;
use App\Http\Traits\ConvertsBase64ToFiles;
use Illuminate\Http\UploadedFile;
use Storage;
class ImageUploadRequest extends Request
{
use ConvertsBase64ToFiles;
/**
* Determine if the user is authorized to make this request.
*
@@ -26,16 +30,32 @@ class ImageUploadRequest extends Request
*/
public function rules()
{
return [
'image' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml',
'avatar' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml',
];
return [
'image' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml,webp',
'avatar' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml,webp',
];
}
public function response(array $errors)
{
return $this->redirector->back()->withInput()->withErrors($errors, $this->errorBag);
}
/**
* Fields that should be traited from base64 to files
*/
protected function base64FileKeys(): array
{
/**
* image_source is here just legacy reasons. Api\AssetController
* had it once to allow encoded image uploads.
*/
return [
'image' => 'auto',
'image_source' => 'auto'
];
}
/**
* Handle and store any images attached to request
@@ -77,22 +97,30 @@ class ImageUploadRequest extends Request
\Log::debug('Form fieldname is: '.$form_fieldname);
\Log::debug('DB fieldname is: '.$use_db_field);
\Log::debug('Trying to upload to '. $path);
// ConvertBase64ToFiles just changes object type,
// as it cannot currently insert files to $this->files
if ($this->offsetGet($form_fieldname) instanceof UploadedFile) {
$image=$this->offsetGet($form_fieldname);
} else {
if ($this->hasFile($form_fieldname)) {
$image = $this->file($form_fieldname);
}
}
\Log::debug($this->file());
if ($this->hasFile($form_fieldname)) {
if (isset($image)) {
\Log::debug($image);
if (!config('app.lock_passwords')) {
$image = $this->file($form_fieldname);
$ext = $image->getClientOriginalExtension();
$file_name = $type.'-'.$form_fieldname.'-'.str_random(10).'.'.$ext;
\Log::info('File name will be: '.$file_name);
\Log::debug('File extension is: '. $ext);
if ($image->getClientOriginalExtension()!=='svg') {
\Log::debug('Not an SVG - resize');
if (($image->getClientOriginalExtension()!=='webp') && ($image->getClientOriginalExtension()!=='svg')) {
\Log::debug('Not an SVG or webp - resize');
\Log::debug('Trying to upload to: '.$path.'/'.$file_name);
$upload = Image::make($image->getRealPath())->resize(null, $w, function ($constraint) {
$constraint->aspectRatio();
@@ -102,20 +130,27 @@ class ImageUploadRequest extends Request
// This requires a string instead of an object, so we use ($string)
Storage::disk('public')->put($path.'/'.$file_name, (string)$upload->encode());
// If the file is an SVG, we need to clean it and NOT encode it
} else {
\Log::debug('This is an SVG');
$sanitizer = new Sanitizer();
$dirtySVG = file_get_contents($image->getRealPath());
$cleanSVG = $sanitizer->sanitize($dirtySVG);
// If the file is a webp, we need to just move it since webp support
// needs to be compiled into gd for resizing to be available
if ($image->getClientOriginalExtension()=='webp') {
\Log::debug('This is a webp, just move it');
Storage::disk('public')->put($path.'/'.$file_name, file_get_contents($image));
// If the file is an SVG, we need to clean it and NOT encode it
} else {
try {
\Log::debug('Trying to upload to: '.$path.'/'.$file_name);
Storage::disk('public')->put($path.'/'.$file_name, $cleanSVG);
} catch (\Exception $e) {
\Log::debug('Upload no workie :( ');
\Log::debug($e);
\Log::debug('This is an SVG');
$sanitizer = new Sanitizer();
$dirtySVG = file_get_contents($image->getRealPath());
$cleanSVG = $sanitizer->sanitize($dirtySVG);
try {
\Log::debug('Trying to upload to: '.$path.'/'.$file_name);
Storage::disk('public')->put($path.'/'.$file_name, $cleanSVG);
} catch (\Exception $e) {
\Log::debug('Upload no workie :( ');
\Log::debug($e);
}
}
}
@@ -158,4 +193,5 @@ class ImageUploadRequest extends Request
return $item;
}
}

View File

@@ -32,8 +32,9 @@ class ItemImportRequest extends FormRequest
public function import(Import $import)
{
ini_set('max_execution_time', 600); //600 seconds = 10 minutes
ini_set('memory_limit', '500M');
ini_set('max_execution_time', env('IMPORT_TIME_LIMIT', 600)); //600 seconds = 10 minutes
ini_set('memory_limit', env('IMPORT_MEMORY_LIMIT', '500M'));
$filename = config('app.private_uploads') . '/imports/' . $import->file_path;
$import->import_type = $this->input('import-type');
$class = title_case($import->import_type);

View File

@@ -8,6 +8,14 @@ abstract class Request extends FormRequest
{
protected $rules = [];
public function json($key = null, $default = null)
{
if ($this->ajax() || $this->wantsJson()) {
json_decode($this->getContent(), false, 512, JSON_THROW_ON_ERROR); // ignore output, just throw
}
return parent::json($key, $default);
}
public function rules()
{
return $this->rules;

View File

@@ -5,11 +5,13 @@ namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use OneLogin\Saml2\IdPMetadataParser as OneLogin_Saml2_IdPMetadataParser;
use OneLogin\Saml2\Utils as OneLogin_Saml2_Utils;
use App\Models\Setting;
/**
* This handles validating and cleaning SAML settings provided by the user.
*
* @author Johnson Yi <jyi.dev@outlook.com>
* @author Michael Pietsch <skywalker-11@mi-pietsch.de>
*
* @since 5.0.0
*/
@@ -55,7 +57,49 @@ class SettingsSamlRequest extends FormRequest
}
}
if ($this->input('saml_sp_regenerate_keypair') == '1' || !$this->has('saml_sp_x509cert')) {
$was_custom_x509cert = strpos(Setting::getSettings()->saml_custom_settings, 'sp_x509cert') !== false;
$custom_x509cert='';
$custom_privateKey='';
$custom_x509certNew='';
if (!empty($this->input('saml_custom_settings'))) {
$req_custom_settings = preg_split('/\r\n|\r|\n/', $this->input('saml_custom_settings'));
$custom_settings = [];
foreach ($req_custom_settings as $custom_setting) {
$split = explode('=', $custom_setting, 2);
if (count($split) == 2) {
$split[0] = trim($split[0]);
$split[1] = trim($split[1]);
if (!empty($split[0])) {
$custom_settings[] = implode('=', $split);
}
if ($split[0] == 'sp_x509cert') {
$custom_x509cert = $split[1];
} elseif ($split[0] == 'sp_privateKey') {
$custom_privateKey = $split[1];
} elseif ($split[0] == 'sp_x509certNew') {
//to prepare for Key rollover
$custom_x509certNew = $split[1];
}
}
}
$this->merge(['saml_custom_settings' => implode(PHP_EOL, $custom_settings) . PHP_EOL]);
}
$cert_updated=false;
if (!empty($custom_x509cert) && !empty($custom_privateKey)) {
// custom certificate and private key are defined
$cert_updated=true;
$x509 = openssl_x509_read($custom_x509cert);
$pkey = openssl_pkey_get_private($custom_privateKey);
} elseif ($this->input('saml_sp_regenerate_keypair') == '1' || !$this->has('saml_sp_x509cert') || $was_custom_x509cert) {
// key regeneration requested, no certificate defined yet or previous custom certicate was removed
error_log("regen");
$cert_updated=true;
$dn = [
"countryName" => "US",
"stateOrProvinceName" => "N/A",
@@ -94,24 +138,23 @@ class SettingsSamlRequest extends FormRequest
}
}
if (!empty($this->input('saml_custom_settings'))) {
$req_custom_settings = preg_split('/\r\n|\r|\n/', $this->input('saml_custom_settings'));
$custom_settings = [];
foreach ($req_custom_settings as $custom_setting) {
$split = explode('=', $custom_setting, 2);
if (count($split) == 2) {
$split[0] = trim($split[0]);
$split[1] = trim($split[1]);
if (!empty($split[0])) {
$custom_settings[] = implode('=', $split);
}
}
if ($custom_x509certNew) {
$x509New = openssl_x509_read($custom_x509certNew);
openssl_x509_export($x509New, $x509certNew);
while (($error = openssl_error_string() !== false)) {
$errors[] = $error;
}
$this->merge(['saml_custom_settings' => implode(PHP_EOL, $custom_settings) . PHP_EOL]);
if (!empty($x509certNew)) {
$this->merge([
'saml_sp_x509certNew' => $x509certNew
]);
}
} else {
$this->merge([
'saml_sp_x509certNew' => ""
]);
}
});
}

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