Compare commits

...

205 Commits

Author SHA1 Message Date
snipe ea0a0a4a69 Merge branch 'develop' 2017-10-18 02:35:43 -07:00
snipe 34442362ca Fixes bad route for new groups 2017-10-18 02:35:30 -07:00
snipe b846bb20c6 Merge branch 'develop' 2017-10-18 01:23:01 -07:00
snipe ab3f5f4f4d Bumped version 2017-10-18 01:21:50 -07:00
snipe ea63ced2bd Fixes table alias bug in complex queries for Laravel 2017-10-18 01:21:08 -07:00
snipe 6bd49bfb72 Fixes #4191 - user search 2017-10-18 01:20:50 -07:00
snipe b80d3ce50d Hopefully fixes #4218 2017-10-18 00:36:52 -07:00
snipe c069829b33 Fixes #906 - groups view 2017-10-17 21:43:57 -07:00
Geoff Young 665a113ed8 Update account history query (#4237)
This will limit the action_log records displayed when a user is viewing
their own assets and history since both target_type and target_id must
be set for a where condition to be added to the history query.
2017-10-17 20:39:49 -07:00
snipe aa7091d962 Fixes #4226 - adds log_max_files to app config and sample env 2017-10-17 20:04:07 -07:00
snipe ceff6a9617 Merge branch 'develop' 2017-10-17 19:27:31 -07:00
snipe c01850fc73 Corrected Italian to Irish in language selector 2017-10-17 19:19:46 -07:00
snipe 4c04dc7b84 Merge branch 'develop' 2017-10-17 18:55:49 -07:00
snipe c0103cd878 Bumped version 2017-10-17 18:55:30 -07:00
snipe 1f1d9d5461 Merge branch 'develop' 2017-10-17 18:53:21 -07:00
snipe c776fa4f7b Updated language strings 2017-10-17 18:52:20 -07:00
snipe dc91d10395 More possible fixes for #4210 2017-10-17 17:35:48 -07:00
snipe 4df10ad26c Merge branch 'develop' 2017-10-17 17:19:15 -07:00
snipe 668a88bc86 Add autocomplete=off to settings forms for #4210 2017-10-17 17:18:17 -07:00
snipe d6e0012818 Merge branch 'develop' 2017-10-17 17:05:38 -07:00
snipe 1d5fb52bfc Fix for LDAP where location ou is not null but blank 2017-10-17 16:59:50 -07:00
snipe 8efb02a0ee Merge branch 'develop' 2017-10-17 16:23:59 -07:00
snipe dea42db18b Reversed order of withTrashed for deleted asset QR codes 2017-10-17 16:21:50 -07:00
snipe 78d5d3947f Merge branch 'develop' 2017-10-17 16:18:14 -07:00
snipe a1f5e11517 Fix for broken QR code on deleted assets 2017-10-17 16:01:53 -07:00
snipe 99ad096a8a Added a space next to crowdin badge 2017-10-17 15:26:16 -07:00
snipe 65b4ffeed9 Higher res crowdin badge 2017-10-17 15:25:34 -07:00
snipe 0dac88816a Merge branch 'develop' of github.com:snipe/snipe-it into develop
# Conflicts:
#	README.md
2017-10-17 15:20:53 -07:00
snipe f7626404b7 Add @BlueHatbRit as a contributor 2017-10-17 15:18:27 -07:00
Elliot Blackburn 78f4b08398 Change zenhub markdown shield to higher res (#4235)
The zenhub badge was fuzzy as it was a low resolution for retina display. It's now using a new shield which falls in line with some of the others (img.shield.io).
2017-10-17 15:16:49 -07:00
snipe 160fd1c86a Added setting to let admin decide whether footer text should link back to site 2017-10-17 13:54:03 -07:00
snipe 6ce01487c5 Merge branch 'develop' 2017-10-17 13:31:43 -07:00
snipe b46cbac911 Fixes #4230 - adds model name and manufacturer to emails 2017-10-17 13:30:32 -07:00
snipe e9c3d6bfb7 Full text search fixes - addresses laravel bug :( 2017-10-17 12:48:18 -07:00
snipe 9e9a5b7a53 Changed checkin/checkout buttons to different colors for easier visibility 2017-10-17 11:32:09 -07:00
snipe e7fe91c9d4 Depreciation view 2017-10-17 11:20:05 -07:00
snipe 6d130326aa Merge branch 'develop' 2017-10-16 21:28:23 -07:00
snipe 02db0f9f9d Handle deleted assets in maintenance 2017-10-16 21:28:05 -07:00
snipe e0668b7507 Handle references to suppliers that have been deleted 2017-10-16 21:19:06 -07:00
snipe 1376f246dc Merge branch 'develop' 2017-10-16 20:38:19 -07:00
snipe 113c55d905 Hopefully fixes #4150 2017-10-16 20:34:31 -07:00
snipe 9cc25bcfd0 Hopefully fixes #4150 2017-10-16 20:34:22 -07:00
snipe 81d3f78263 Production assets 2017-10-16 20:12:42 -07:00
snipe 66596b0b09 Production assets 2017-10-16 20:12:22 -07:00
snipe 7455b1019a Hacky possible fix for subdir issues 2017-10-16 20:12:11 -07:00
snipe 37df934e97 Fixes #4220 - allow nullable for completion date 2017-10-16 18:32:48 -07:00
snipe 6517a95d45 Check if there are any custom fields before trying to loop through them 2017-10-16 15:29:19 -07:00
snipe 4b84a0c916 Tidying some of the LDAP UDN logic 2017-10-16 15:29:06 -07:00
snipe 0f0a61e477 Merge branch 'develop' 2017-10-16 10:10:29 -07:00
snipe f64382aa00 Nicer error display in LDAP tests 2017-10-16 10:10:11 -07:00
snipe 1743417ec9 Merge branch 'develop' 2017-10-16 09:38:26 -07:00
snipe c61bed52c8 Removed danger class 2017-10-16 09:38:09 -07:00
snipe edf75865dc Merge branch 'develop' 2017-10-16 09:27:01 -07:00
snipe 176a26e6c3 Bumped version 2017-10-16 09:26:44 -07:00
snipe 10a4d7e849 Merge branch 'develop' 2017-10-16 09:09:53 -07:00
snipe cbe008d52f Fix assetLoc to assetloc because reasons? 2017-10-16 09:08:08 -07:00
snipe aeb5152789 Removed extranneous class for danger text 2017-10-16 09:04:38 -07:00
snipe 938490df16 Merge branch 'develop' 2017-10-16 09:01:09 -07:00
snipe 45c2af80a3 More LDAP testing US refinements 2017-10-16 09:00:51 -07:00
snipe 892c1b04fd Merge branch 'develop' 2017-10-16 07:07:35 -07:00
snipe 1fbf3753bc More small LDAP test improvements 2017-10-16 07:07:21 -07:00
snipe 5ead5a94e3 Merge branch 'develop' 2017-10-16 06:47:01 -07:00
snipe bcf435f625 Try for better error reporting on LDAP fail
Sorry for all the commits on this - my local LDAP isn’t working and I can’t figure out why, so no easy way to test locally
2017-10-16 06:46:33 -07:00
snipe 8638c46b1d Merge branch 'develop' 2017-10-16 06:40:15 -07:00
snipe b107280b7b Slightly nicer UI for LDAP login test 2017-10-16 06:39:36 -07:00
snipe 1a60c20117 Merge branch 'develop' 2017-10-16 06:34:23 -07:00
snipe f1a6926ad9 LDAP test login 2017-10-16 06:34:04 -07:00
snipe c27a7f09bd Merge branch 'develop' 2017-10-16 05:55:27 -07:00
snipe ba7b9d8168 Removed stray foo 2017-10-16 05:54:33 -07:00
snipe 5b070ee32f Merge branch 'develop' 2017-10-16 05:52:52 -07:00
snipe 59a126c47c Small tweaks to LDAP test 2017-10-16 05:52:18 -07:00
snipe 322e62418e Merge branch 'develop' 2017-10-16 05:23:26 -07:00
snipe a98d94ccdc Pass token to LDAPtest 2017-10-16 05:22:37 -07:00
snipe 5addcb517f Merge branch 'develop' 2017-10-16 05:01:37 -07:00
snipe 56cbc005ae Fixes expected checkins name in console kernel 2017-10-16 05:01:15 -07:00
Daniel Meltzer 22e9246031 Fix more old routes. Should fix #4216 (#4217) 2017-10-15 23:32:40 -07:00
snipe c0b39701cc Fixes #4170 - asset maintenance type not showing 2017-10-14 16:17:14 -07:00
madd15 e2bac62e36 Fix #4205 (#4213)
* Fixing various UI items

* Revert css change

* Dashboard icon CSS up 4px
2017-10-14 00:14:22 -07:00
snipe c12a23b84a Merge branch 'develop' 2017-10-11 15:37:01 -07:00
snipe fa95f6d836 Another attempt for #4165 2017-10-11 15:36:47 -07:00
snipe 280e8c7ed1 Revert "Another attempt for #4165"
This reverts commit 7617fda978.
2017-10-11 15:34:30 -07:00
snipe 7617fda978 Another attempt for #4165
(This is terrible and needs to be refactored.)
2017-10-11 15:33:53 -07:00
snipe af69f7636b Merge branch 'develop' 2017-10-11 14:44:37 -07:00
snipe 6d4574130f Clearer indication of whether or not the user will be emailed a eula 2017-10-11 14:44:25 -07:00
snipe 485b6397d0 Possible (crummy temp) fix for #4165 2017-10-11 14:42:11 -07:00
snipe 93990327de Hopefully fixes #4163 2017-10-11 14:18:08 -07:00
madd15 4ee7765403 Change Save buttons to Checkout and add Cancel (#4202)
Bringing components and consumables checkout page inline with other
checkout pages
2017-10-11 13:29:22 -07:00
snipe bdbad067b4 Merge branch 'develop' 2017-10-11 13:10:46 -07:00
snipe 13a716310c Bumped hash 2017-10-11 13:10:29 -07:00
snipe d0c77c228b Merge branch 'develop' 2017-10-11 13:09:30 -07:00
snipe 36cbffa183 Fixes bug where custom fields would not store new name in custom fields table on edit 2017-10-11 13:09:10 -07:00
snipe 5edf9e143f Merge branch 'develop' 2017-10-11 12:46:42 -07:00
snipe b6a1e0d12f Call migrate before passport install 2017-10-11 12:42:31 -07:00
snipe 2fda3a2d26 Merge branch 'develop' 2017-10-11 12:29:48 -07:00
snipe f56eb16941 More specific order by clause for drilling down on order number 2017-10-11 12:29:08 -07:00
snipe c15c082fb4 Merge branch 'develop' 2017-10-11 01:31:59 -07:00
snipe 64e7ab3a12 Fixes #4182 - empty names for assets when checking out to asset 2017-10-11 01:31:37 -07:00
snipe afbd6c811b Merge branch 'develop' 2017-10-10 23:38:45 -07:00
snipe f64c02ce12 Fix for ambiguous query on models 2017-10-10 23:12:16 -07:00
snipe a0d8aa77d3 Merge branch 'develop' 2017-10-10 22:59:50 -07:00
snipe bed7b29417 Fixes group search 2017-10-10 22:59:32 -07:00
tiagom62 40ed86bfe0 Sudo isnt available on every distro. (#4194) 2017-10-10 22:02:47 -07:00
snipe 33497c9811 Merge branch 'develop' 2017-10-10 12:48:05 -07:00
snipe 52a8597813 Fixes #4136 2017-10-10 12:44:28 -07:00
snipe eeb07f73e5 Added Redis vairables to example env 2017-10-09 15:44:08 -07:00
Alex Markessinis 57422c9135 Added Redis support. (#4146)
* Fix forgotten password missing route (???)

* Fixes #4056 - check for assets before deleting user

* added predis/predis dependency to composer.json to support redis based cache/queue/session/broadcast
2017-10-09 15:39:20 -07:00
Richard Hofman adca7cb0c5 Fix LDAP location sync issue in #3993 (#4181)
* Ensure locations with the most specific OUs take precedence during user assignment.

* Save 'ldap_ou' Location attribute during creation.
2017-10-09 13:06:47 -07:00
Richard Schwab 059f8f5bc9 Remove dead macro code (#4164)
The barcode_types macro existed twice in the code, the second occurrence overriding the first one.
This commit removes the first occurrence which is essentially dead code.
2017-10-09 13:06:05 -07:00
tiagom62 c676e9d794 Fix progress spinner. (#4178) 2017-10-09 13:04:48 -07:00
Daniel Meltzer e9f10dd74e Maybe Fix #4052. Missed an absolute URL. (#4187) 2017-10-09 13:04:38 -07:00
snipe e29d878d4f Remove unused method arguments 2017-10-07 15:09:50 -07:00
snipe d4e3ea1412 Derp 2017-10-07 15:07:31 -07:00
snipe c5462c5f1f Not sure why this isn’t working… commenting it out for now 2017-10-07 14:52:00 -07:00
snipe d1328c3ba9 Merge branch 'develop' of github.com:snipe/snipe-it into develop 2017-10-07 14:49:54 -07:00
snipe 8c406e8e55 Additional auth policies 2017-10-07 14:49:47 -07:00
snipe 6e33f36595 Set snipe-logo as default 2017-10-07 14:49:36 -07:00
tiagom62 48277606de Support Debian 8 installs. Shellchecked. More cleanup. (#4174) 2017-10-07 12:45:25 -07:00
snipe d7c9fcc8df Small manufacturer display tweaks on license view to make text clearer, link phone 2017-10-07 08:27:56 -07:00
snipe 508576544b Merge branch 'develop' 2017-10-07 08:17:58 -07:00
snipe 9f2fc21649 I guess we don’t need to manually create the license seats 2017-10-07 08:17:38 -07:00
snipe 11f99a963a Removed extra comma in demo warning 2017-10-07 08:03:08 -07:00
snipe 27ab0271a1 Merge branch 'develop' 2017-10-07 08:00:11 -07:00
snipe f858b2858d Add language about the demo resetting daily to en files 2017-10-07 07:59:57 -07:00
snipe e2809f7bd0 Merge branch 'develop' 2017-10-07 07:45:58 -07:00
snipe f468b37f36 Bumped hash 2017-10-07 07:45:43 -07:00
snipe 0b3d3de30f Merge branch 'develop' 2017-10-07 07:44:30 -07:00
snipe 907b909223 Fixed language on settings page 2017-10-07 07:44:08 -07:00
snipe 9dc79f7165 Demo Settings reset artisan command
We’ll set this as a cron job to reset the language back to english
2017-10-07 07:43:57 -07:00
snipe 324d44dbac Small accessory factory tweaks 2017-10-07 07:24:15 -07:00
snipe 7a0e695ea0 Merge branch 'develop' 2017-10-07 07:17:05 -07:00
snipe a69a939034 Small barcode tweaks 2017-10-07 07:15:28 -07:00
snipe ed8efbe759 Add dateFormatter to components view 2017-10-07 06:57:02 -07:00
snipe 834c6ad8f9 Removed extra space 2017-10-07 06:56:47 -07:00
snipe 2ce48fbc7e Use components transformer in API method 2017-10-07 06:56:39 -07:00
snipe 5d18937e94 Standardized component API output 2017-10-07 06:56:18 -07:00
snipe b3186ba5ea Removed old getDataTable methods
These are no longer used because of the API
2017-10-07 06:56:02 -07:00
snipe f51dc9a1c4 Use recent date range for factory 2017-10-07 06:17:39 -07:00
snipe f3f9920bd3 Added Crucial as a manufacturer in factory 2017-10-07 06:17:18 -07:00
snipe ea6140e786 Components factory and seeder 2017-10-07 06:16:53 -07:00
snipe 05c4d6dead Make HDD into HDD/SSD for factory 2017-10-07 06:16:36 -07:00
snipe e2c6f36c70 Use recent date range for factory 2017-10-07 06:16:21 -07:00
snipe 21b1ecb6b3 Only checkout RTD assets 2017-10-07 06:16:06 -07:00
snipe a62cf358ee More realistic prices for factories 2017-10-07 05:52:44 -07:00
snipe 20c429b600 Add some archived and pending assets too 2017-10-07 05:52:26 -07:00
snipe 38e25a388c lol whoops 2017-10-07 05:34:13 -07:00
snipe 2c6cedd62c Removed unused factories 2017-10-07 05:32:59 -07:00
snipe 9b0cca4a37 Added licensed to name, email to licenses factory 2017-10-07 05:32:39 -07:00
snipe f6d198a39c Added back in some unused asset stuff for tests 2017-10-07 05:32:22 -07:00
snipe d12fc6b13c Add depreciation ID to model factories 2017-10-07 05:32:00 -07:00
snipe a12c7c83d4 Req acceptance on laptop category 2017-10-07 05:31:46 -07:00
snipe affd4035c3 Added displays to seeders 2017-10-07 05:31:32 -07:00
snipe ecfe1a5442 Depreciations factory 2017-10-07 05:30:53 -07:00
snipe e9c77198d7 Fix duplicate call to licenses seeder 2017-10-07 04:54:16 -07:00
snipe 20be670648 Fixed ids for license 2017-10-07 04:43:55 -07:00
snipe a03207e5b4 Show license notes 2017-10-07 04:42:53 -07:00
snipe 6555b3a49d No location id in licenses? 2017-10-07 04:36:23 -07:00
snipe 61a634bc1a No idea why this worked locally before, but… 2017-10-07 04:34:51 -07:00
snipe 00696a3668 Commented out slow users factories right now - will revert when finished 2017-10-07 04:26:37 -07:00
snipe e20271791b Removed unused factories for now
Need to add these back, once the correct logic is applied
2017-10-07 04:26:21 -07:00
snipe 86b9fdbffe License and actionlog seeder tweaks 2017-10-07 04:25:35 -07:00
snipe 7e728094a1 User seeders 2017-10-07 03:41:46 -07:00
snipe f865c621ef Removed commented code 2017-10-07 03:41:40 -07:00
snipe e2f4685a55 Added notes back to list view 2017-10-07 03:36:50 -07:00
snipe 2148ea94bb Additional model seeders 2017-10-07 03:19:46 -07:00
snipe 1d2787250b Reference IDs 2017-10-07 03:19:27 -07:00
snipe 7f02ff12cf Asset seeder 2017-10-07 03:19:17 -07:00
snipe 65341a5d8a Added ID reference numbers 2017-10-07 03:19:07 -07:00
snipe 1608edbb28 Added ID reference numbers 2017-10-07 03:18:57 -07:00
snipe 776da1dea4 Add Dept seeder to db seeder 2017-10-07 03:18:46 -07:00
snipe a6b3e4bbb1 Department seeder/factory 2017-10-07 03:18:36 -07:00
snipe 3b2ecda243 Consumables factory/seeder 2017-10-07 02:46:04 -07:00
snipe 57cbb5c5ce Removed unused factories 2017-10-07 02:45:54 -07:00
snipe 7b27d32121 Added ID numbers 2017-10-07 02:45:36 -07:00
snipe ccfba324ee Indenting 2017-10-07 02:45:28 -07:00
snipe 9f55a76fcf Added avery 2017-10-07 02:45:21 -07:00
snipe 8fdddc310f More rigid seeders for more realistic data 2017-10-07 02:27:02 -07:00
snipe 064a4ebe33 Ability to skip deleting/generating new users
This will behave unpredictably if there is not a user id 1
2017-10-07 00:02:37 -07:00
snipe 4981077cb1 Merge branch 'develop' 2017-10-06 22:59:01 -07:00
tiagom62 fbea1c0823 Code dedupe, general cleanup and added a verbose option for debugging. (#4173) 2017-10-06 22:58:41 -07:00
snipe a84da88114 Demo seeder 2017-10-06 22:58:00 -07:00
snipe 282b3b5b0a Remove catch-all “deployed” from pie chart 2017-10-06 18:41:10 -07:00
snipe 130a99c46f Merge branch 'develop' 2017-10-06 18:15:31 -07:00
snipe df4cb7d351 Don’t reload the page if the API returns a 500 2017-10-06 18:15:13 -07:00
snipe 1dcff8d463 Remove eager loading on pie
This was causing memory issues for large asset sets
2017-10-06 18:15:01 -07:00
snipe ae4ba6176d Merge branch 'develop' 2017-10-06 17:04:06 -07:00
snipe e461c25428 Apply model image fix to update method 2017-10-06 17:03:51 -07:00
snipe ea4bfdc51d Merge branch 'develop' 2017-10-06 16:57:51 -07:00
snipe 554ea8bb95 Fixed asset model image validation 2017-10-06 16:56:43 -07:00
Richard Hofman f2be409914 LDAP sync improvements and DB query fix. (#4148)
* Set 'ldap_ou' Location field to NULL when an empty string is submitted.

* Consolidate LDAP user import logic in LdapSync.php.
2017-10-06 16:15:14 -07:00
snipe 3fc1bbea73 Apply PR changes to master. Again? 2017-10-06 14:28:19 -07:00
snipe a97f7d2277 Merge branch 'develop' 2017-10-06 14:27:46 -07:00
snipe af70cdaeac Adds email address to CoC 2017-10-06 13:44:39 -07:00
snipe 8919c3b52a Merge branch 'develop'
# Conflicts:
#	snipeit.sh
2017-10-05 23:14:13 -07:00
snipe f580e20bc3 Fixed custom fields filter for advanced search 2017-10-05 23:09:02 -07:00
snipe a054cec7c9 Supress output if no title is given
This should never happen, but….
2017-10-05 22:51:33 -07:00
tiagom62 1ad7bbdd0c Support configuring smtp settings (#4161)
* Able to configure smtp settings. General cleanup.

* Check if sudo is available.
2017-10-05 21:27:00 -07:00
snipe cfe6759825 Merge branch 'develop' 2017-10-05 00:41:30 -07:00
snipe 10c13baf2b Add @GeoffYoung as a contributor 2017-10-05 00:40:32 -07:00
snipe 9fe4e11874 Merge branch 'develop'
# Conflicts:
#	snipeit.sh
2017-10-05 00:37:16 -07:00
snipe f6d8642799 Fix $search variable to $search_var for new filter 2017-10-05 00:35:37 -07:00
snipe adddc5324b Add @imjennyli as a contributor 2017-10-05 00:34:50 -07:00
snipe f442b70ae7 Apply PR #4133 to develop 2017-10-05 00:02:14 -07:00
madd15 7b10213b3a Small UI Tweaks to Accessories (#4149)
* Small UI Change

Changing Save button for Checkout button and adding Cancel button

* Small UI Change

Move buttons to match checkout page and remove extra save button
2017-10-04 23:28:13 -07:00
tiagom62 ddc79b9070 Support Ubuntu and Debian installs. (#4133)
* Ubuntu related fixes.

* Further cleanup.

* Support Debian 9 install. More cleanup.
2017-10-04 23:19:38 -07:00
Jenny Li 5e9b04b0f5 update broken link to contributor docs (#4123) 2017-10-04 23:19:19 -07:00
1582 changed files with 25190 additions and 17404 deletions
+27
View File
@@ -755,6 +755,33 @@
"contributions": [
"code"
]
},
{
"login": "imjennyli",
"name": "Jenny Li",
"avatar_url": "https://avatars3.githubusercontent.com/u/404729?v=4",
"profile": "https://github.com/imjennyli",
"contributions": [
"doc"
]
},
{
"login": "GeoffYoung",
"name": "Geoff Young",
"avatar_url": "https://avatars0.githubusercontent.com/u/869227?v=4",
"profile": "https://github.com/GeoffYoung",
"contributions": [
"code"
]
},
{
"login": "BlueHatbRit",
"name": "Elliot Blackburn",
"avatar_url": "https://avatars3.githubusercontent.com/u/1068477?v=4",
"profile": "http://www.elliotblackburn.com",
"contributions": [
"doc"
]
}
]
}
+8 -7
View File
@@ -8,7 +8,6 @@ APP_URL=null
APP_TIMEZONE='UTC'
APP_LOCALE=en
# --------------------------------------------
# REQUIRED: DATABASE SETTINGS
# --------------------------------------------
@@ -31,7 +30,6 @@ DB_SSL_CERT_PATH=null
DB_SSL_CA_PATH=null
DB_SSL_CIPHER=null
# --------------------------------------------
# REQUIRED: OUTGOING MAIL SERVER SETTINGS
# --------------------------------------------
@@ -46,14 +44,12 @@ MAIL_FROM_NAME='Snipe-IT'
MAIL_REPLYTO_ADDR=you@example.com
MAIL_REPLYTO_NAME='Snipe-IT'
# --------------------------------------------
# REQUIRED: IMAGE LIBRARY
# This should be gd or imagick
# --------------------------------------------
IMAGE_LIB=gd
# --------------------------------------------
# OPTIONAL: SESSION SETTINGS
# --------------------------------------------
@@ -64,14 +60,12 @@ COOKIE_NAME=snipeit_session
COOKIE_DOMAIN=null
SECURE_COOKIES=false
# --------------------------------------------
# OPTIONAL: SECURITY HEADER SETTINGS
# --------------------------------------------
REFERRER_POLICY=same-origin
ENABLE_CSP=false
# --------------------------------------------
# OPTIONAL: CACHE SETTINGS
# --------------------------------------------
@@ -79,6 +73,12 @@ CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
# --------------------------------------------
# OPTIONAL: REDIS SETTINGS
# --------------------------------------------
REDIS_HOST=null
REDIS_PASSWORD=null
REDIS_PORT-null
# --------------------------------------------
# OPTIONAL: AWS S3 SETTINGS
@@ -97,7 +97,8 @@ LOGIN_LOCKOUT_DURATION=60
# --------------------------------------------
# OPTIONAL: MISC
# --------------------------------------------
APP_LOG=single
APP_LOG=daily
APP_LOG_MAX_FILES=10
APP_LOCKED=false
FILESYSTEM_DISK=local
APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1
+1 -1
View File
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
reported by contacting the project team at abuse@snipeitapp.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
+1 -1
View File
@@ -1,6 +1,6 @@
### Contributing
Please see the documentation on [contributing and developing for Snipe-IT](https://snipe-it.readme.io/docs/contributing).
Please see the documentation on [contributing and developing for Snipe-IT](https://snipe-it.readme.io/docs/contributing-overview).
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
+3 -3
View File
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.org/snipe/snipe-it.svg?branch=develop)](https://travis-ci.org/snipe/snipe-it) [![Stories in Ready](https://badge.waffle.io/snipe/snipe-it.png?label=ready+for+dev&title=Ready+for+development)](http://waffle.io/snipe/snipe-it) [![Maintenance](https://img.shields.io/maintenance/yes/2017.svg)]() [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.png)](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/snipeyhead.svg?style=social)](https://twitter.com/snipeyhead) [![Zenhub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade)
[![All Contributors](https://img.shields.io/badge/all_contributors-81-orange.svg?style=flat-square)](#contributors)
[![Build Status](https://travis-ci.org/snipe/snipe-it.svg?branch=develop)](https://travis-ci.org/snipe/snipe-it) [![Stories in Ready](https://badge.waffle.io/snipe/snipe-it.png?label=ready+for+dev&title=Ready+for+development)](http://waffle.io/snipe/snipe-it) [![Maintenance](https://img.shields.io/maintenance/yes/2017.svg)]() [![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/snipeyhead.svg?style=social)](https://twitter.com/snipeyhead) [![Zenhub](https://img.shields.io/badge/Shipping_faster_with-ZenHub-5e60ba.svg)](https://zenhub.io) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade)
[![All Contributors](https://img.shields.io/badge/all_contributors-84-orange.svg?style=flat-square)](#contributors)
## Snipe-IT - Open Source Asset Management System
@@ -67,7 +67,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
| [<img src="https://avatars0.githubusercontent.com/u/8341172?v=3" width="110px;"/><br /><sub>Jay Richards</sub>](http://www.cordeos.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=technogenus "Code") | [<img src="https://avatars2.githubusercontent.com/u/7295127?v=3" width="110px;"/><br /><sub>Alexander Innes</sub>](https://necurity.co.uk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=leostat "Code") | [<img src="https://avatars2.githubusercontent.com/u/334485?v=3" width="110px;"/><br /><sub>Danny Garcia</sub>](https://buzzedword.codes)<br />[💻](https://github.com/snipe/snipe-it/commits?author=buzzedword "Code") | [<img src="https://avatars2.githubusercontent.com/u/366855?v=3" width="110px;"/><br /><sub>archpoint</sub>](https://github.com/archpoint)<br />[💻](https://github.com/snipe/snipe-it/commits?author=archpoint "Code") | [<img src="https://avatars1.githubusercontent.com/u/67991?v=3" width="110px;"/><br /><sub>Jake McGraw</sub>](http://www.jakemcgraw.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jakemcgraw "Code") | [<img src="https://avatars1.githubusercontent.com/u/1714374?v=3" width="110px;"/><br /><sub>FleischKarussel</sub>](https://github.com/FleischKarussel)<br />[📖](https://github.com/snipe/snipe-it/commits?author=FleischKarussel "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/319644?v=3" width="110px;"/><br /><sub>Dylan Yi</sub>](https://github.com/feeva)<br />[💻](https://github.com/snipe/snipe-it/commits?author=feeva "Code") |
| [<img src="https://avatars2.githubusercontent.com/u/857740?v=3" width="110px;"/><br /><sub>Gil Rutkowski</sub>](http://FlashingCursor.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=flashingcursor "Code") | [<img src="https://avatars3.githubusercontent.com/u/129360?v=3" width="110px;"/><br /><sub>Desmond Morris</sub>](http://www.desmondmorris.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=desmondmorris "Code") | [<img src="https://avatars2.githubusercontent.com/u/52936?v=3" width="110px;"/><br /><sub>Nick Peelman</sub>](http://peelman.us)<br />[💻](https://github.com/snipe/snipe-it/commits?author=peelman "Code") | [<img src="https://avatars0.githubusercontent.com/u/53161?v=3" width="110px;"/><br /><sub>Abraham Vegh</sub>](https://abrahamvegh.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=abrahamvegh "Code") | [<img src="https://avatars0.githubusercontent.com/u/2818680?v=3" width="110px;"/><br /><sub>Mohamed Rashid</sub>](https://github.com/rashivkp)<br />[📖](https://github.com/snipe/snipe-it/commits?author=rashivkp "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/1509456?v=3" width="110px;"/><br /><sub>Kasey</sub>](http://hinchk.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=HinchK "Code") | [<img src="https://avatars2.githubusercontent.com/u/10522541?v=3" width="110px;"/><br /><sub>Brett</sub>](https://github.com/BrettFagerlund)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=BrettFagerlund "Tests") |
| [<img src="https://avatars2.githubusercontent.com/u/16108587?v=3" width="110px;"/><br /><sub>Jason Spriggs</sub>](http://jasonspriggs.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jasonspriggs "Code") | [<img src="https://avatars2.githubusercontent.com/u/1134568?v=3" width="110px;"/><br /><sub>Nate Felton</sub>](http://n8felton.wordpress.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=n8felton "Code") | [<img src="https://avatars2.githubusercontent.com/u/14036694?v=3" width="110px;"/><br /><sub>Manasses Ferreira</sub>](http://homepages.dcc.ufmg.br/~manassesferreira)<br />[💻](https://github.com/snipe/snipe-it/commits?author=manassesferreira "Code") | [<img src="https://avatars0.githubusercontent.com/u/15913949?v=3" width="110px;"/><br /><sub>Steve</sub>](https://github.com/steveelwood)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=steveelwood "Tests") | [<img src="https://avatars1.githubusercontent.com/u/3361683?v=3" width="110px;"/><br /><sub>matc</sub>](http://twitter.com/matc)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=matc "Tests") | [<img src="https://avatars3.githubusercontent.com/u/7405702?v=3" width="110px;"/><br /><sub>Cole R. Davis</sub>](http://www.davisracingteam.com)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=VanillaNinjaD "Tests") | [<img src="https://avatars2.githubusercontent.com/u/10167681?v=3" width="110px;"/><br /><sub>gibsonjoshua55</sub>](https://github.com/gibsonjoshua55)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gibsonjoshua55 "Code") |
| [<img src="https://avatars2.githubusercontent.com/u/2809241?v=4" width="110px;"/><br /><sub>Robin Temme</sub>](https://github.com/zwerch)<br />[💻](https://github.com/snipe/snipe-it/commits?author=zwerch "Code") | [<img src="https://avatars0.githubusercontent.com/u/6961695?v=4" width="110px;"/><br /><sub>Iman</sub>](https://github.com/imanghafoori1)<br />[💻](https://github.com/snipe/snipe-it/commits?author=imanghafoori1 "Code") | [<img src="https://avatars1.githubusercontent.com/u/6551003?v=4" width="110px;"/><br /><sub>Richard Hofman</sub>](https://github.com/richardhofman6)<br />[💻](https://github.com/snipe/snipe-it/commits?author=richardhofman6 "Code") | [<img src="https://avatars0.githubusercontent.com/u/3697569?v=4" width="110px;"/><br /><sub>gizzmojr</sub>](https://github.com/gizzmojr)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gizzmojr "Code") |
| [<img src="https://avatars2.githubusercontent.com/u/2809241?v=4" width="110px;"/><br /><sub>Robin Temme</sub>](https://github.com/zwerch)<br />[💻](https://github.com/snipe/snipe-it/commits?author=zwerch "Code") | [<img src="https://avatars0.githubusercontent.com/u/6961695?v=4" width="110px;"/><br /><sub>Iman</sub>](https://github.com/imanghafoori1)<br />[💻](https://github.com/snipe/snipe-it/commits?author=imanghafoori1 "Code") | [<img src="https://avatars1.githubusercontent.com/u/6551003?v=4" width="110px;"/><br /><sub>Richard Hofman</sub>](https://github.com/richardhofman6)<br />[💻](https://github.com/snipe/snipe-it/commits?author=richardhofman6 "Code") | [<img src="https://avatars0.githubusercontent.com/u/3697569?v=4" width="110px;"/><br /><sub>gizzmojr</sub>](https://github.com/gizzmojr)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gizzmojr "Code") | [<img src="https://avatars3.githubusercontent.com/u/404729?v=4" width="110px;"/><br /><sub>Jenny Li</sub>](https://github.com/imjennyli)<br />[📖](https://github.com/snipe/snipe-it/commits?author=imjennyli "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/869227?v=4" width="110px;"/><br /><sub>Geoff Young</sub>](https://github.com/GeoffYoung)<br />[💻](https://github.com/snipe/snipe-it/commits?author=GeoffYoung "Code") | [<img src="https://avatars3.githubusercontent.com/u/1068477?v=4" width="110px;"/><br /><sub>Elliot Blackburn</sub>](http://www.elliotblackburn.com)<br />[📖](https://github.com/snipe/snipe-it/commits?author=BlueHatbRit "Documentation") |
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
+33 -20
View File
@@ -16,7 +16,7 @@ class LdapSync extends Command
*
* @var string
*/
protected $signature = 'snipeit:ldap-sync {--location=} {--location_id=} {--summary}';
protected $signature = 'snipeit:ldap-sync {--location=} {--location_id=} {--summary} {--json_summary}';
/**
* The console command description.
@@ -55,27 +55,35 @@ class LdapSync extends Command
try {
$ldapconn = Ldap::connectToLdap();
} catch (\Exception $e) {
LOG::error($e);
}
try {
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::error($e);
return [];
}
$summary = array();
$results = Ldap::findLdapUsers();
$ldap_ou_locations = Location::whereNotNull('ldap_ou')->get();
// 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 $location) {
$ldap_ou_lengths[] = strlen($location["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.');
}
$results = Ldap::findLdapUsers();
// Inject location information fields
for ($i = 0; $i < $results["count"]; $i++) {
$results[$i]["ldap_location_override"] = false;
$results[$i]["location_id"] = 0;
@@ -90,8 +98,8 @@ class LdapSync extends Command
LOG::debug('Location ID '.$this->option('location_id').' passed');
LOG::debug('Importing to '.$location->name.' ('.$location->id.')');
} else {
$location = NULL;
}
$location = NULL;
}
if (!isset($location)) {
LOG::debug('That location is invalid or a location was not provided, so no location will be assigned by default.');
@@ -99,11 +107,11 @@ class LdapSync extends Command
// Grab subsets based on location-specific DNs, and overwrite location for these users.
foreach ($ldap_ou_locations as $ldap_loc) {
$location_users = Ldap::findLdapUsers($ldap_loc->ldap_ou);
$location_users = Ldap::findLdapUsers($ldap_loc["ldap_ou"]);
$usernames = array();
for ($i = 0; $i < $location_users["count"]; $i++) {
$location_users[$i]["ldap_location_override"] = true;
$location_users[$i]["location_id"] = $ldap_loc->id;
$location_users[$i]["location_id"] = $ldap_loc["id"];
$usernames[] = $location_users[$i][$ldap_result_username][0];
}
@@ -135,6 +143,14 @@ class LdapSync extends Command
$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"]:"";
if ( array_key_exists('useraccountcontrol', $results[$i]) ) {
$enabled_accounts = [
'512', '544', '66048', '66080', '262656', '262688', '328192', '328224'
];
$item['activated'] = ( in_array($results[$i]['useraccountcontrol'][0], $enabled_accounts) ) ? 1 : 0;
} else {
$item['activated'] = 0;
}
// User exists
$item["createorupdate"] = 'updated';
@@ -145,14 +161,12 @@ class LdapSync extends Command
}
// Create the user if they don't exist.
$user->first_name = e($item["firstname"]);
$user->last_name = e($item["lastname"]);
$user->username = e($item["username"]);
$user->email = e($item["email"]);
$user->employee_num = e($item["employee_number"]);
$user->activated = 1;
$user->activated = $item['activated'];
if ($item['ldap_location_override'] == true) {
$user->location_id = $item['location_id'];
@@ -188,13 +202,12 @@ class LdapSync extends Command
} else {
$this->info('User '.$summary[$x]['firstname'].' '.$summary[$x]['lastname'].' (username: '.$summary[$x]['username'].' was '.strtoupper($summary[$x]['createorupdate']).'.');
}
}
} else if ($this->option('json_summary')) {
$json_summary = [ "error" => false, "error_message" => "", "summary" => $summary ];
$this->info(json_encode($json_summary));
} else {
return $summary;
}
}
}
@@ -0,0 +1,75 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Setting;
use App\Models\User;
class ResetDemoSettings extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'snipeit:demo-settings';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This will reset the Snipe-IT demo settings back to default. ';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->info('Resetting the demo settings.');
$settings = Setting::first();
$settings->per_page = 20;
$settings->site_name = 'Snipe-IT Asset Management Demo';
$settings->auto_increment_assets = 1;
$settings->logo = 'snipe-logo.png';
$settings->alert_email = 'service@snipe-it.io';
$settings->header_color = null;
$settings->barcode_type = 'QRCODE';
$settings->default_currency = 'USD';
$settings->brand = 3;
$settings->ldap_enabled = 0;
$settings->full_multiple_companies_support = 1;
$settings->alt_barcode = 'C128';
$settings->email_domain = 'snipeitapp.com';
$settings->email_format = 'filastname';
$settings->username_format = 'filastname';
$settings->date_display_format = 'D M d, Y';
$settings->time_display_format = 'g:iA';
$settings->thumbnail_max_h = '30';
$settings->locale = 'en';
$settings->save();
if ($user = User::where('username', '=', 'admin')->first()) {
$user->locale = 'en';
$user->save();
}
}
}
+3 -2
View File
@@ -25,7 +25,8 @@ class Kernel extends ConsoleKernel
Commands\Purge::class,
Commands\LdapSync::class,
Commands\FixDoubleEscape::class,
Commands\RecryptFromMcrypt::class
Commands\RecryptFromMcrypt::class,
Commands\ResetDemoSettings::class
];
/**
@@ -39,7 +40,7 @@ class Kernel extends ConsoleKernel
$schedule->command('snipeit:inventory-alerts')->daily();
$schedule->command('snipeit:expiring-alerts')->daily();
$schedule->command('snipeit:expected-checkins')->daily();
$schedule->command('snipeit:expected-checkin')->daily();
$schedule->command('snipeit:backup')->weekly();
$schedule->command('backup:clean')->daily();
}
@@ -369,143 +369,5 @@ class AccessoriesController extends Controller
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.checkin.error'));
}
/**
* Generates the JSON response for accessories listing view.
*
* Example:
* {
* "actions": "(links to available actions)",
* "category": "(link to category)",
* "company": "My Company",
* "location": "My Location",
* "min_amt": 2,
* "name": "(link to accessory),
* "numRemaining": 6,
* "order_number": null,
* "purchase_cost": "0.00",
* "purchase_date": null,
* "qty": 7
* },
*
* The names of the fields in the returns JSON correspond directly to the the
* names of the fields in the bootstrap-tables in the view.
*
* For debugging, see at /api/accessories/list
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @param Request $request
* @return string JSON containing accessories and their associated atrributes.
* @internal param int $accessoryId
*/
public function getDatatable(Request $request)
{
$this->authorize('index', Accessory::class);
$accessories = Company::scopeCompanyables(
Accessory::select('accessories.*')
->whereNull('accessories.deleted_at')
->with('category', 'company', 'manufacturer', 'users', 'location')
);
if (Input::has('search')) {
$accessories = $accessories->TextSearch(e(Input::get('search')));
}
$offset = request('offset', 0);
$limit = request('limit', 50);
$allowed_columns = ['name','min_amt','order_number','purchase_date','purchase_cost','company','category','model_number', 'manufacturer', 'location'];
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
switch ($sort) {
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;
default:
$accessories = $accessories->orderBy($sort, $order);
break;
}
$accessCount = $accessories->count();
$accessories = $accessories->skip($offset)->take($limit)->get();
$rows = array();
foreach ($accessories as $accessory) {
$rows[] = $accessory->present()->forDataTable();
}
$data = array('total'=>$accessCount, 'rows'=>$rows);
return $data;
}
/**
* Generates the JSON response for accessory detail view.
*
* Example:
* <code>
* {
* "rows": [
* {
* "actions": "(link to available actions)",
* "name": "(link to user)"
* }
* ],
* "total": 1
* }
* </code>
*
* The names of the fields in the returns JSON correspond directly to the the
* names of the fields in the bootstrap-tables in the view.
*
* For debugging, see at /api/accessories/$accessoryID/view
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @param int $accessoryId
* @return string JSON containing accessories and their associated atrributes.
**/
public function getDataView(Request $request, $accessoryID)
{
$accessory = Accessory::find($accessoryID);
if (!Company::isCurrentUserHasAccess($accessory)) {
return ['total' => 0, 'rows' => []];
}
$accessory_users = $accessory->users;
$count = $accessory_users->count();
$rows = array();
foreach ($accessory_users as $user) {
$actions = '';
if (Gate::allows('checkin', $accessory)) {
$actions .= Helper::generateDatatableButton('checkin', route('checkin/accessory', $user->pivot->id));
}
if (Gate::allows('view', $user)) {
$name = (string) link_to_route('users.show', e($user->present()->fullName()), [$user->id]);
} else {
$name = e($user->present()->fullName());
}
$rows[] = array(
'name' => $name,
'actions' => $actions
);
}
$data = array('total'=>$count, 'rows'=>$rows);
return $data;
}
}
+47 -6
View File
@@ -125,7 +125,11 @@ class AssetsController extends Controller
$assets->ByManufacturer($request->input('manufacturer_id'));
}
$request->has('order_number') ? $assets = $assets->where('order_number', '=', e($request->get('order_number'))) : '';
if ($request->has('depreciation_id')) {
$assets->ByDepreciationId($request->input('depreciation_id'));
}
$request->has('order_number') ? $assets = $assets->where('assets.order_number', '=', e($request->get('order_number'))) : '';
$offset = request('offset', 0);
$limit = $request->input('limit', 50);
@@ -133,28 +137,62 @@ class AssetsController extends Controller
// This is used by the sidenav, mostly
// We switched from using query scopes here because of a Laravel bug
// related to fulltext searches on complex queries.
// I am sad. :(
switch ($request->input('status')) {
case 'Deleted':
$assets->withTrashed()->Deleted();
break;
case 'Pending':
$assets->Pending();
$assets->join('status_labels AS status_alias',function ($join) {
$join->on('status_alias.id', "=", "assets.status_id")
->where('status_alias.deployable','=',0)
->where('status_alias.pending','=',1)
->where('status_alias.archived', '=', 0);
});
break;
case 'RTD':
$assets->RTD();
$assets->whereNull('assets.assigned_to')
->join('status_labels AS status_alias',function ($join) {
$join->on('status_alias.id', "=", "assets.status_id")
->where('status_alias.deployable','=',1)
->where('status_alias.pending','=',0)
->where('status_alias.archived', '=', 0);
});
break;
case 'Undeployable':
$assets->Undeployable();
break;
case 'Archived':
$assets->Archived();
$assets->join('status_labels AS status_alias',function ($join) {
$join->on('status_alias.id', "=", "assets.status_id")
->where('status_alias.deployable','=',0)
->where('status_alias.pending','=',0)
->where('status_alias.archived', '=', 1);
});
break;
case 'Requestable':
$assets->RequestableAssets();
$assets->where('assets.requestable', '=', 1)
->join('status_labels AS status_alias',function ($join) {
$join->on('status_alias.id', "=", "assets.status_id")
->where('status_alias.deployable','=',1)
->where('status_alias.pending','=',0)
->where('status_alias.archived', '=', 0);
});
break;
case 'Deployed':
$assets->Deployed();
// more sad, horrible workarounds for laravel bugs when doing full text searches
$assets->where('assets.assigned_to', '>', '0');
break;
default:
// terrible workaround for complex-query Laravel bug in fulltext
$assets->join('status_labels AS status_alias',function ($join) {
$join->on('status_alias.id', "=", "assets.status_id")
->where('status_alias.archived', '=', 0);
});
}
@@ -481,6 +519,9 @@ class AssetsController extends Controller
$data['item_tag'] = $asset->asset_tag;
$data['item_serial'] = $asset->serial;
$data['note'] = $logaction->note;
$data['manufacturer_name'] = $asset->model->manufacturer->name;
$data['model_name'] = $asset->model->name;
$data['model_number'] = $asset->model->model_number;
if ((($asset->checkin_email()=='1')) && (isset($user)) && (!config('app.lock_passwords'))) {
Mail::send('emails.checkin-asset', $data, function ($m) use ($user) {
@@ -20,9 +20,9 @@ class CategoriesController extends Controller
public function index(Request $request)
{
$this->authorize('view', Category::class);
$allowed_columns = ['id', 'name','category_type','use_default_eula','require_acceptance','checkin_email'];
$allowed_columns = ['id', 'name','category_type','use_default_eula','eula_text', 'require_acceptance','checkin_email'];
$categories = Category::select(['id', 'created_at', 'updated_at', 'name','category_type','use_default_eula','require_acceptance','checkin_email'])
$categories = Category::select(['id', 'created_at', 'updated_at', 'name','category_type','use_default_eula','eula_text', 'require_acceptance','checkin_email'])
->withCount('assets', 'accessories', 'consumables', 'components');
if ($request->has('search')) {
@@ -158,6 +158,6 @@ class ComponentsController extends Controller
$limit = $request->input('limit', 50);
$total = $assets->count();
$assets = $assets->skip($offset)->take($limit)->get();
return (new ComponentsAssetsTransformer)->transformAssets($assets, $total);
return (new ComponentsTransformer)->transformCheckedoutComponents($assets, $total);
}
}
@@ -5,6 +5,8 @@ namespace App\Http\Controllers\Api;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Ldap;
use Validator;
use App\Models\Setting;
class SettingsController extends Controller
{
@@ -75,8 +77,14 @@ class SettingsController extends Controller
//
}
public function getLdapTest()
public function ldaptest()
{
if (Setting::getSettings()->ldap_enabled!='1') {
\Log::debug('LDAP is not enabled cannot test.');
return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400);
}
\Log::debug('Preparing to test LDAP connection');
try {
@@ -98,4 +106,58 @@ class SettingsController extends Controller
}
public function ldaptestlogin(Request $request)
{
if (Setting::getSettings()->ldap_enabled!='1') {
\Log::debug('LDAP is not enabled. Cannot test.');
return response()->json(['message' => 'LDAP is not enabled, cannot test.'], 400);
}
$rules = array(
'ldaptest_user' => 'required',
'ldaptest_password' => 'required'
);
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
\Log::debug('LDAP Validation test failed.');
$validation_errors = implode(' ',$validator->errors()->all());
return response()->json(['message' => $validator->errors()->all()], 400);
}
\Log::debug('Preparing to test LDAP login');
try {
$connection = Ldap::connectToLdap();
try {
Ldap::bindAdminToLdap($connection);
\Log::debug('Attempting to bind to LDAP for LDAP test');
try {
$ldap_user = Ldap::findAndBindUserLdap($request->input('ldaptest_user'), $request->input('ldaptest_password'));
if ($ldap_user) {
\Log::debug('It worked! '. $request->input('ldaptest_user').' successfully binded to LDAP.');
return response()->json(['message' => 'It worked! '. $request->input('ldaptest_user').' successfully binded to LDAP.'], 200);
}
return response()->json(['message' => 'Login Failed. '. $request->input('ldaptest_user').' did not successfully bind to LDAP.'], 400);
} catch (\Exception $e) {
\Log::debug('LDAP login failed');
return response()->json(['message' => $e->getMessage()], 400);
}
} catch (\Exception $e) {
\Log::debug('Bind failed');
return response()->json(['message' => $e->getMessage()], 400);
//return response()->json(['message' => $e->getMessage()], 500);
}
} catch (\Exception $e) {
\Log::debug('Connection failed');
return response()->json(['message' => $e->getMessage()], 500);
}
}
}
@@ -155,7 +155,7 @@ class StatuslabelsController extends Controller
public function getAssetCountByStatuslabel()
{
$statusLabels = Statuslabel::with('assets')->get();
$statusLabels = Statuslabel::get();
$labels=[];
$points=[];
$colors=[];
@@ -168,9 +168,7 @@ class StatuslabelsController extends Controller
}
}
}
$labels[]='Deployed';
$points[]=Asset::whereNotNull('assigned_to')->count();
$colors_array = array_merge($colors, Helper::chartColors());
$result= [
+4 -1
View File
@@ -57,7 +57,6 @@ class UsersController extends Controller
$users = $users->GetDeleted();
}
if ($request->has('company_id')) {
$users = $users->where('company_id', '=', $request->input('company_id'));
}
@@ -65,6 +64,10 @@ class UsersController extends Controller
if ($request->has('location_id')) {
$users = $users->where('location_id', '=', $request->input('location_id'));
}
if ($request->has('group_id')) {
$users = $users->ByGroup($request->has('group_id'));
}
if ($request->has('department_id')) {
$users = $users->where('department_id','=',$request->input('department_id'));
+28 -57
View File
@@ -17,6 +17,7 @@ use App\Models\Company;
use Config;
use App\Helpers\Helper;
use Illuminate\Http\Request;
use App\Http\Requests\ImageUploadRequest;
use Symfony\Component\HttpFoundation\JsonResponse;
@@ -68,7 +69,7 @@ class AssetModelsController extends Controller
* @since [v1.0]
* @return Redirect
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
// Create a new asset model
@@ -90,14 +91,21 @@ class AssetModelsController extends Controller
}
if (Input::file('image')) {
$image = Input::file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/models/'.$file_name);
Image::make($image->getRealPath())->resize(500, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$file_name = str_random(25) . "." . $image->getClientOriginalExtension();
$path = public_path('uploads/models/');
if ($image->getClientOriginalExtension()!='svg') {
Image::make($image->getRealPath())->resize(500, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path.'/'.$file_name);
} else {
$image->move($path, $file_name);
}
$model->image = $file_name;
}
// Was it created?
@@ -180,7 +188,7 @@ class AssetModelsController extends Controller
* @param int $modelId
* @return Redirect
*/
public function update(Request $request, $modelId = null)
public function update(ImageUploadRequest $request, $modelId = null)
{
// Check if the model exists
if (is_null($model = AssetModel::find($modelId))) {
@@ -206,13 +214,19 @@ class AssetModelsController extends Controller
if (Input::file('image')) {
$image = Input::file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/models/'.$file_name);
Image::make($image->getRealPath())->resize(300, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$file_name = str_random(25) . "." . $image->getClientOriginalExtension();
$path = public_path('uploads/models/');
if ($image->getClientOriginalExtension()!='svg') {
Image::make($image->getRealPath())->resize(500, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path.'/'.$file_name);
} else {
$image->move($path, $file_name);
}
$model->image = $file_name;
}
if ($request->input('image_delete') == 1 && Input::file('image') == "") {
@@ -352,49 +366,6 @@ class AssetModelsController extends Controller
/**
* Get the asset information to present to the model view detail page
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v2.0]
* @param Request $request
* @param $modelID
* @return String JSON
* @internal param int $modelId
*/
public function getDataView(Request $request, $modelID)
{
$assets = Asset::where('model_id', '=', $modelID)->with('company', 'assetstatus');
if (Input::has('search')) {
$assets = $assets->TextSearch(e($request->input('search')));
}
$offset = request('offset', 0);
$limit = request('limit', 50);
$allowed_columns = ['name', 'serial','asset_tag'];
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at';
$assets = $assets->orderBy($sort, $order);
$assetsCount = $assets->count();
$assets = $assets->skip($offset)->take($limit)->get();
$rows = array();
$all_custom_fields = CustomField::all();
foreach ($assets as $asset) {
$rows[] = $asset->present()->forDataTable($all_custom_fields);
}
$data = array('total' => $assetsCount, 'rows' => $rows);
return $data;
}
/**
* Returns a view that allows the user to bulk edit model attrbutes
+7 -3
View File
@@ -432,7 +432,7 @@ class AssetsController extends Controller
// Get the dropdown of users and then pass it to the checkout view
return view('hardware/checkout', compact('asset'))
->with('users_list', Helper::usersList())
->with('assets_list', Helper::assetsList())
->with('assets_list', Helper::detailedAssetList())
->with('locations_list', Helper::locationsList());
}
@@ -558,6 +558,9 @@ class AssetsController extends Controller
$data['item_tag'] = $asset->asset_tag;
$data['item_serial'] = $asset->serial;
$data['note'] = $logaction->note;
$data['manufacturer_name'] = $asset->model->manufacturer->name;
$data['model_name'] = $asset->model->name;
$data['model_number'] = $asset->model->model_number;
if ((($asset->checkin_email()=='1')) && (isset($user)) && (!empty($user->email)) && (!config('app.lock_passwords'))) {
Mail::send('emails.checkin-asset', $data, function ($m) use ($user) {
@@ -634,7 +637,7 @@ class AssetsController extends Controller
$settings = Setting::getSettings();
if ($settings->qr_code == '1') {
$asset = Asset::find($assetId);
$asset = Asset::withTrashed()->find($assetId);
$size = Helper::barcodeDimensions($settings->barcode_type);
$qr_file = public_path().'/uploads/barcodes/qr-'.str_slug($asset->asset_tag).'-'.str_slug($asset->id).'.png';
@@ -673,7 +676,8 @@ class AssetsController extends Controller
return response()->file($barcode_file, $header);
} else {
$barcode = new \Com\Tecnick\Barcode\Barcode();
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode, $asset->asset_tag, 250, 20);
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode,$asset->asset_tag,300,50);
file_put_contents($barcode_file, $barcode_obj->getPngData());
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
}
@@ -98,10 +98,8 @@ class CategoriesController extends Controller
*/
public function edit($categoryId = null)
{
// Check if the category exists
if (is_null($item = Category::find($categoryId))) {
// Redirect to the blogs management page
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.does_not_exist'));
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.does_not_exist'));
}
$category_types= Helper::categoryTypeList();
@@ -158,22 +156,22 @@ class CategoriesController extends Controller
{
// Check if the category exists
if (is_null($category = Category::find($categoryId))) {
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.not_found'));
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.not_found'));
}
if ($category->has_models() > 0) {
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'model']));
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'model']));
} elseif ($category->accessories()->count() > 0) {
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'accessory']));
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'accessory']));
} elseif ($category->consumables()->count() > 0) {
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'consumable']));
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'consumable']));
} elseif ($category->components()->count() > 0) {
return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'component']));
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.assoc_items', ['asset_type'=>'component']));
}
$category->delete();
// Redirect to the locations management page
return redirect()->to(route('categories.index'))->with('success', trans('admin/categories/message.delete.success'));
return redirect()->route('categories.index')->with('success', trans('admin/categories/message.delete.success'));
}
@@ -288,35 +288,4 @@ class ComponentsController extends Controller
}
/**
* Return JSON data to populate the components view,
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ComponentsController::getView() method that returns the view.
* @since [v3.0]
* @param int $componentId
* @return string JSON
*/
public function getDataView($componentId)
{
if (is_null($component = Component::with('assets')->find($componentId))) {
// Redirect to the component management page with error
return redirect()->route('components.index')->with('error', trans('admin/components/message.not_found'));
}
if (!Company::isCurrentUserHasAccess($component)) {
return ['total' => 0, 'rows' => []];
}
$this->authorize('view', $component);
$rows = array();
$all_custom_fields = CustomField::all(); // Cached for table;
foreach ($component->assets as $component_assignment) {
$rows[] = $component_assignment->present()->forDataTable($all_custom_fields);
}
$componentCount = $component->assets->count();
$data = array('total' => $componentCount, 'rows' => $rows);
return $data;
}
}
+1 -1
View File
@@ -39,8 +39,8 @@ class DashboardController extends Controller
$counts['grand_total'] = $counts['asset'] + $counts['accessory'] + $counts['license'] + $counts['consumable'];
if ((!file_exists(storage_path().'/oauth-private.key')) || (!file_exists(storage_path().'/oauth-public.key'))) {
\Artisan::call('passport:install');
\Artisan::call('migrate', ['--force' => true]);
\Artisan::call('passport:install');
}
return view('dashboard')->with('asset_stats', $asset_stats)->with('counts', $counts);
+4 -13
View File
@@ -27,13 +27,11 @@ class DepartmentsController extends Controller
public function index(Request $request)
{
$this->authorize('index', Department::class);
$company = null;
if ($request->has('company_id')) {
$company = Company::find($request->input('company_id'));
} else {
$company = null;
}
return view('departments/index')->with('company',$company);
return view('departments/index')->with('company', $company);
}
@@ -53,12 +51,10 @@ class DepartmentsController extends Controller
$department->user_id = Auth::user()->id;
$department->manager_id = ($request->has('manager_id' ) ? $request->input('manager_id') : null);
if ($department->save()) {
return redirect()->route("departments.index")->with('success', trans('admin/departments/message.create.success'));
}
return redirect()->back()->withInput()->withErrors($department->getErrors());
}
/**
@@ -140,25 +136,20 @@ class DepartmentsController extends Controller
->with('location_list', Helper::locationsList())
->with('company_list', Helper::companyList());
}
public function update(Request $request, $id) {
$this->authorize('create', Department::class);
if (is_null($department = Department::find($id))) {
return redirect()->to('admin/settings/departments')->with('error', trans('admin/departments/message.does_not_exist'));
return redirect()->route('departments.index')->with('error', trans('admin/departments/message.does_not_exist'));
}
$department->fill($request->all());
$department->manager_id = ($request->has('manager_id' ) ? $request->input('manager_id') : null);
if ($department->save()) {
return redirect()->route("departments.index")->with('success', trans('admin/departments/message.update.success'));
}
return redirect()->back()->withInput()->withErrors($department->getErrors());
}
}
@@ -155,5 +155,24 @@ class DepreciationsController extends Controller
return redirect()->route('depreciations.index')->with('success', trans('admin/depreciations/message.delete.success'));
}
/**
* Returns a view that displays a form to display depreciation listing
*
* @author [A. Gianotto] [<snipe@snipe.net]
* @see DepreciationsController::postEdit()
* @param int $depreciationId
* @since [v1.0]
* @return \Illuminate\Contracts\View\View
*/
public function show($id)
{
if (is_null($depreciation = Depreciation::find($id))) {
// Redirect to the blogs management page
return redirect()->route('depreciations.index')->with('error', trans('admin/depreciations/message.does_not_exist'));
}
return view('depreciations/view', compact('depreciation'));
}
}
+29 -4
View File
@@ -87,10 +87,15 @@ class GroupsController extends Controller
public function edit($id = null)
{
$group = Group::find($id);
$permissions = config('permissions');
$groupPermissions = $group->decodePermissions();
$selected_array = Helper::selectedPermissionsArray($permissions, $groupPermissions);
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'));
if ($group) {
$permissions = config('permissions');
$groupPermissions = $group->decodePermissions();
$selected_array = Helper::selectedPermissionsArray($permissions, $groupPermissions);
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'));
}
return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
}
/**
@@ -142,4 +147,24 @@ class GroupsController extends Controller
return redirect()->route('groups.index')->with('error', trans('general.feature_disabled'));
}
/**
* Returns a view that invokes the ajax tables which actually contains
* the content for the group detail page.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @param int $locationId
* @since [v4.0.11]
* @return \Illuminate\Contracts\View\View
*/
public function show($id)
{
$group = Group::find($id);
if ($group) {
return view('groups/view', compact('group'));
}
return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
}
}
+1 -52
View File
@@ -591,61 +591,10 @@ class LicensesController extends Controller
$file = $log->get_src('licenses');
return Response::download($file);
}
// Prepare the error message
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
// Redirect to the licence management page
return redirect()->route('licenses.index')->with('error', $error);
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist', compact('id')));
}
/**
* Generates a JSON response to populate the licence index datatables.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see LicensesController::getIndex() method that provides the view
* @since [v1.0]
* @return String JSON
*/
public function getDatatable(Request $request)
{
$this->authorize('view', License::class);
$licenses = Company::scopeCompanyables(License::with('company', 'licenseSeatsRelation', 'manufacturer'));
if (Input::has('search')) {
$licenses = $licenses->TextSearch($request->input('search'));
}
$offset = request('offset', 0);
$limit = request('limit', 50);
$allowed_columns = ['id','name','purchase_cost','expiration_date','purchase_order','order_number','notes','purchase_date','serial','manufacturer','company'];
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at';
switch ($sort) {
case 'manufacturer':
$licenses = $licenses->OrderManufacturer($order);
break;
case 'company':
$licenses = $licenses->OrderCompany($order);
break;
default:
$licenses = $licenses->orderBy($sort, $order);
break;
}
$licenseCount = $licenses->count();
$licenses = $licenses->skip($offset)->take($limit)->get();
$rows = array();
foreach ($licenses as $license) {
$rows[] = $license->present()->forDataTable();
}
$data = array('total' => $licenseCount, 'rows' => $rows);
return $data;
}
/**
* Generates the next free seat ID for checkout.
+3 -4
View File
@@ -89,6 +89,7 @@ class LocationsController extends Controller
$location->state = Input::get('state');
$location->country = Input::get('country');
$location->zip = Input::get('zip');
$location->ldap_ou = Input::get('ldap_ou');
$location->manager_id = Input::get('manager_id');
$location->user_id = Auth::id();
@@ -147,7 +148,7 @@ class LocationsController extends Controller
{
// Check if the location exists
if (is_null($item = Location::find($locationId))) {
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
}
// Show the page
@@ -156,7 +157,6 @@ class LocationsController extends Controller
$location_options = Location::flattenLocationsArray($location_options_array);
$location_options = array('' => 'Top Level') + $location_options;
return view('locations/edit', compact('item'))
->with('location_options', $location_options)
->with('manager_list', Helper::managerList());
@@ -176,7 +176,7 @@ class LocationsController extends Controller
{
// Check if the location exists
if (is_null($location = Location::find($locationId))) {
return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
}
// Update the location data
@@ -217,7 +217,6 @@ class LocationsController extends Controller
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.not_found'));
}
if ($location->users->count() > 0) {
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_users'));
} elseif ($location->childLocations->count() > 0) {
@@ -212,116 +212,5 @@ class ManufacturersController extends Controller
}
protected function getDataAssetsView(Manufacturer $manufacturer, Request $request)
{
$manufacturer = $manufacturer->load('assets.model', 'assets.assignedTo', 'assets.assetstatus', 'assets.company');
$manufacturer_assets = $manufacturer->assets();
if ($request->has('search')) {
$manufacturer_assets = $manufacturer_assets->TextSearch(e($request->input('search')));
}
$offset = request('offset', 0);
$limit = request('limit', 50);
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$allowed_columns = ['id','name','serial','asset_tag'];
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';
$count = $manufacturer_assets->count();
$manufacturer_assets = $manufacturer_assets->skip($offset)->take($limit)->get();
$rows = array();
$all_custom_fields = CustomField::all(); // cached;
foreach ($manufacturer_assets as $asset) {
$rows[] = $asset->present()->forDataTable($all_custom_fields);
}
$data = array('total' => $count, 'rows' => $rows);
return $data;
}
protected function getDataLicensesView(Manufacturer $manufacturer, Request $request)
{
$manufacturer = $manufacturer->load('licenses.company', 'licenses.manufacturer', 'licenses.licenseSeatsRelation');
$licenses = $manufacturer->licenses;
if ($request->has('search')) {
$licenses = $licenses->TextSearch($request->input('search'));
}
$licenseCount = $licenses->count();
$rows = array();
foreach ($licenses as $license) {
$rows[] = $license->present()->forDataTable();
}
$data = array('total' => $licenseCount, 'rows' => $rows);
return $data;
}
public function getDataAccessoriesView(Manufacturer $manufacturer, Request $request)
{
$manufacturer = $manufacturer->load(
'accessories.location',
'accessories.company',
'accessories.category',
'accessories.manufacturer',
'accessories.users'
);
$accessories = $manufacturer->accessories();
if ($request->has('search')) {
$accessories = $accessories->TextSearch(e($request->input('search')));
}
$offset = request('offset', 0);
$limit = request('limit', 50);
$accessCount = $accessories->count();
$accessories = $accessories->skip($offset)->take($limit)->get();
$rows = array();
foreach ($accessories as $accessory) {
$rows[] = $accessory->present()->forDataTable();
}
$data = array('total'=>$accessCount, 'rows'=>$rows);
return $data;
}
public function getDataConsumablesView($manufacturer, Request $request)
{
$manufacturer = $manufacturer->load(
'consumables.location',
'consumables.company',
'consumables.category',
'consumables.manufacturer',
'consumables.users'
);
$consumables = $manufacturer->consumables();
if ($request->has('search')) {
$consumables = $consumables->TextSearch(e($request->input('search')));
}
$offset = request('offset', 0);
$limit = request('limit', 50);
$consumCount = $consumables->count();
$consumables = $consumables->skip($offset)->take($limit)->get();
$rows = array();
foreach ($consumables as $consumable) {
$rows[] = $consumable->present()->forDataTable();
}
$data = array('total' => $consumCount, 'rows' => $rows);
return $data;
}
}
+2 -1
View File
@@ -263,8 +263,8 @@ class SettingsController extends Controller
$output = Artisan::output();
if ((!file_exists(storage_path().'/oauth-private.key')) || (!file_exists(storage_path().'/oauth-public.key'))) {
Artisan::call('passport:install');
Artisan::call('migrate', ['--force' => true]);
Artisan::call('passport:install');
}
@@ -391,6 +391,7 @@ class SettingsController extends Controller
$setting->brand = $request->input('brand', '1');
$setting->header_color = $request->input('header_color');
$setting->show_url_in_emails = $request->input('show_url_in_emails', '0');
// Only allow the site name and CSS to be changed if lock_passwords is false
+12 -119
View File
@@ -33,6 +33,7 @@ use URL;
use View;
use Illuminate\Http\Request;
use Gate;
use Artisan;
/**
* This controller handles all actions related to Users for
@@ -1029,128 +1030,20 @@ class UsersController extends Controller
*/
public function postLDAP(Request $request)
{
$this->authorize('update', User::class);
ini_set('max_execution_time', 600); //600 seconds = 10 minutes
ini_set('memory_limit', '500M');
// Call Artisan LDAP import command.
$location_id = $request->input('location_id');
Artisan::call('snipeit:ldap-sync', ['--location_id' => $location_id, '--json_summary' => true]);
$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;
// Collect and parse JSON summary.
$ldap_results_json = Artisan::output();
$ldap_results = json_decode($ldap_results_json, true);
$ldap_result_active_flag = Setting::getSettings()->ldap_active_flag_field;
$ldap_result_emp_num = Setting::getSettings()->ldap_emp_num;
$ldap_result_email = Setting::getSettings()->ldap_email;
try {
$ldapconn = Ldap::connectToLdap();
} catch (\Exception $e) {
return redirect()->back()->withInput()->with('error', $e->getMessage());
// Direct user to appropriate status page.
if ($ldap_results['error']) {
return redirect()->back()->withInput()->with('error', $ldap_results['error_message']);
} else {
return redirect()->route('ldap/user')->with('success', "LDAP Import successful.")->with('summary', $ldap_results['summary']);
}
try {
Ldap::bindAdminToLdap($ldapconn);
} catch (\Exception $e) {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
$summary = array();
$ldap_ou_locations = Location::whereNotNull('ldap_ou')->get();
$results = Ldap::findLdapUsers();
// 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) {
$location_users = Ldap::findLdapUsers($ldap_loc->ldap_ou);
$usernames = array();
for ($i = 0; $i < $location_users["count"]; $i++) {
$location_users[$i]["ldap_location_override"] = true;
$location_users[$i]["location_id"] = $ldap_loc->id;
$usernames[] = $location_users[$i][$ldap_result_username][0];
}
// Delete located users from the general group.
foreach ($results as $key => $generic_entry) {
if (in_array($generic_entry[$ldap_result_username][0], $location_users)) {
unset($results[$key]);
}
}
$global_count = $results['count'];
$results = array_merge($location_users, $results);
$results['count'] = $global_count;
}
$tmp_pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
$pass = bcrypt($tmp_pass);
for ($i = 0; $i < $results["count"]; $i++) {
if (empty($ldap_result_active_flag) || $results[$i][$ldap_result_active_flag][0] == "TRUE") {
$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"]:"";
if( array_key_exists('useraccountcontrol', $results[$i]) ) {
$enabled_accounts = [
'512', '544', '66048', '66080', '262656', '262688', '328192', '328224'
];
$item['activated'] = ( in_array($results[$i]['useraccountcontrol'][0], $enabled_accounts) ) ? 1 : 0;
} else {
$item['activated'] = 0;
}
// User exists
$item["createorupdate"] = 'updated';
if (!$user = User::where('username', $item["username"])->first()) {
$user = new User;
$user->password = $pass;
$item["createorupdate"] = 'created';
}
// Create the user if they don't exist.
$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->activated = $item['activated'];
if ($item['ldap_location_override'] == true) {
$user->location_id = $item['location_id'];
} else if ($request->input('location_id')!='') {
$user->location_id = e($request->input('location_id'));
}
$user->notes = 'Imported from LDAP';
$user->ldap_import = 1;
$errors = '';
if ($user->save()) {
$item["note"] = $item["createorupdate"];
$item["status"]='success';
} else {
foreach ($user->getErrors()->getMessages() as $key => $err) {
$errors .='<li>'.$err[0];
}
$item["note"] = $errors;
$item["status"]='error';
}
array_push($summary, $item);
}
}
return redirect()->route('ldap/user')->with('success', "LDAP Import successful.")->with('summary', $summary);
}
@@ -79,8 +79,6 @@ class AccessoriesTransformer
}
return (new DatatablesTransformer)->transformDatatables($array, $total);
}
+3 -3
View File
@@ -54,9 +54,9 @@ class AssetsTransformer
'id' => (int) $asset->company->id,
'name'=> e($asset->company->name)
] : null,
'location' => ($asset->assetLoc) ? [
'id' => (int) $asset->assetLoc->id,
'name'=> e($asset->assetLoc->name)
'location' => ($asset->assetloc) ? [
'id' => (int) $asset->assetloc->id,
'name'=> e($asset->assetloc->name)
] : null,
'rtd_location' => ($asset->defaultLoc) ? [
'id' => (int) $asset->defaultLoc->id,
@@ -26,7 +26,7 @@ class CategoriesTransformer
'id' => (int) $category->id,
'name' => e($category->name),
'type' => e($category->category_type),
'use_default_eula' => ($category->use_default_eula =='1') ? true : false,
'eula' => ($category->getEula()) ? true : false,
'checkin_email' => ($category->checkin_email =='1') ? true : false,
'require_acceptance' => ($category->require_acceptance =='1') ? true : false,
'assets_count' => $category->assets_count,
@@ -58,12 +58,22 @@ class ComponentsTransformer
}
public function transformCheckedoutComponents(Collection $components_users, $total)
public function transformCheckedoutComponents(Collection $components_assets, $total)
{
$array = array();
foreach ($components_users as $user) {
$array[] = (new UsersTransformer)->transformUser($user);
foreach ($components_assets as $asset) {
$array[] = [
'assigned_pivot_id' => $asset->pivot->id,
'id' => (int) $asset->id,
'name' => e($asset->model->present()->name) .' '.e($asset->present()->name),
'qty' => $asset->pivot->assigned_qty,
'type' => 'asset',
'created_at' => Helper::getFormattedDateObject($asset->pivot->created_at, 'datetime'),
'available_actions' => ['checkin' => true]
];
}
return (new DatatablesTransformer)->transformDatatables($array, $total);
}
}
@@ -42,6 +42,7 @@ class UsersTransformer
'id' => (int) $user->userloc->id,
'name'=> e($user->userloc->name)
] : null,
'notes'=> e($user->notes),
'permissions' => $user->decodePermissions(),
'activated' => ($user->activated =='1') ? true : false,
'two_factor_activated' => ($user->two_factor_active()) ? true : false,
+9 -5
View File
@@ -23,14 +23,18 @@ class AssetImporter extends ItemImporter
// ItemImporter handles the general fetching.
parent::handle($row);
foreach ($this->customFields as $customField) {
$customFieldValue = $this->array_smart_custom_field_fetch($row, $customField);
if ($customFieldValue) {
$this->item['custom_fields'][$customField->db_column_name()] = $customFieldValue;
$this->log('Custom Field '. $customField->name.': '.$customFieldValue);
if ($this->customFields) {
foreach ($this->customFields as $customField) {
$customFieldValue = $this->array_smart_custom_field_fetch($row, $customField);
if ($customFieldValue) {
$this->item['custom_fields'][$customField->db_column_name()] = $customFieldValue;
$this->log('Custom Field '. $customField->name.': '.$customFieldValue);
}
}
}
$this->createAssetIfNotExists($row);
}
+29 -13
View File
@@ -487,7 +487,7 @@ class Asset extends Depreciable
} elseif ($this->model->category->use_default_eula == '1') {
return $Parsedown->text(e(Setting::getSettings()->default_eula_text));
} else {
return null;
return false;
}
}
@@ -781,14 +781,11 @@ class Asset extends Depreciable
$query->where('locations.name', 'LIKE', '%'.$search.'%');
});
})->orWhere(function ($query) use ($search) {
$query->whereHas('assignedTo', function ($query) use ($search) {
$query->where('users.first_name', 'LIKE', '%'.$search.'%')
->orWhere('users.last_name', 'LIKE', '%'.$search.'%')
->orWhere('users.username', 'LIKE', '%'.$search.'%')
->orWhere('locations.name', 'LIKE', '%'.$search.'%')
->orWhere('assigned_assets.name', 'LIKE', '%'.$search.'%');
});
})->orWhere('assets.name', 'LIKE', '%'.$search.'%')
->orWhere('assets.asset_tag', 'LIKE', '%'.$search.'%')
->orWhere('assets.serial', 'LIKE', '%'.$search.'%')
@@ -815,6 +812,7 @@ class Asset extends Depreciable
{
return $query->where(function ($query) use ($filter) {
foreach ($filter as $key => $search_val) {
if ($key =='asset_tag') {
$query->where('assets.asset_tag', 'LIKE', '%'.$search_val.'%');
}
@@ -856,10 +854,10 @@ class Asset extends Depreciable
}
if ($key =='checkedout_to') {
$query->whereHas('assigneduser', function ($query) use ($search) {
$query->where(function ($query) use ($search) {
$query->where('users.first_name', 'LIKE', '%' . $search . '%')
->orWhere('users.last_name', 'LIKE', '%' . $search . '%');
$query->whereHas('assigneduser', function ($query) use ($search_val) {
$query->where(function ($query) use ($search_val) {
$query->where('users.first_name', 'LIKE', '%' . $search_val . '%')
->orWhere('users.last_name', 'LIKE', '%' . $search_val . '%');
});
});
}
@@ -876,8 +874,8 @@ class Asset extends Depreciable
}
if ($key =='category') {
$query->whereHas('model', function ($query) use ($search) {
$query->whereHas('category', function ($query) use ($search) {
$query->whereHas('model', function ($query) use ($search_val) {
$query->whereHas('category', function ($query) use ($search_val) {
$query->where(function ($query) use ($search_val) {
$query->where('categories.name', 'LIKE', '%' . $search_val . '%')
->orWhere('models.name', 'LIKE', '%' . $search_val . '%')
@@ -914,11 +912,13 @@ class Asset extends Depreciable
}
foreach (CustomField::all() as $field) {
if (array_key_exists($field->db_column_name(), $filter)) {
$query->orWhere($field->db_column_name(), 'LIKE', "%$search_val%");
}
if (array_key_exists('custom_fields.'.$field->db_column_name(), $filter)) {
$query->orWhere($field->db_column_name(), 'LIKE', '%' . $search_val . '%');
}
}
});
}
@@ -1103,4 +1103,20 @@ class Asset extends Depreciable
}
/**
* Query builder scope to search on location ID
*
* @param \Illuminate\Database\Query\Builder $query Query builder instance
* @param text $search Search term
*
* @return \Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeByDepreciationId($query, $search)
{
return $query->join('models', 'assets.model_id', '=', 'models.id')
->join('depreciations', 'models.depreciation_id', '=', 'depreciations.id')->where('models.depreciation_id', '=', $search);
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ class AssetMaintenance extends Model implements ICompanyableChild
'title' => 'required|max:100',
'is_warranty' => 'boolean',
'start_date' => 'required|date_format:"Y-m-d"',
'completion_date' => 'date_format:"Y-m-d"',
'completion_date' => 'nullable|date_format:"Y-m-d"',
'notes' => 'string|nullable',
'cost' => 'numeric|nullable'
];
+3 -3
View File
@@ -153,17 +153,17 @@ class AssetModel extends SnipeModel
->orWhere('model_number', 'LIKE', "%$search%")
->orWhere(function ($query) use ($search) {
$query->whereHas('depreciation', function ($query) use ($search) {
$query->where('name', 'LIKE', '%'.$search.'%');
$query->where('depreciations.name', 'LIKE', '%'.$search.'%');
});
})
->orWhere(function ($query) use ($search) {
$query->whereHas('category', function ($query) use ($search) {
$query->where('name', 'LIKE', '%'.$search.'%');
$query->where('categories.name', 'LIKE', '%'.$search.'%');
});
})
->orWhere(function ($query) use ($search) {
$query->whereHas('manufacturer', function ($query) use ($search) {
$query->where('name', 'LIKE', '%'.$search.'%');
$query->where('manufacturers.name', 'LIKE', '%'.$search.'%');
});
});
+1 -1
View File
@@ -64,7 +64,7 @@ class Component extends SnipeModel
public function assets()
{
return $this->belongsToMany('\App\Models\Asset', 'components_assets')->withPivot('assigned_qty', 'created_at', 'user_id');
return $this->belongsToMany('\App\Models\Asset', 'components_assets')->withPivot('id', 'assigned_qty', 'created_at', 'user_id');
}
public function admin()
+10 -1
View File
@@ -62,9 +62,18 @@ class CustomField extends Model
return true;
}
return Schema::table(CustomField::$table_name, function ($table) use ($custom_field) {
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');
Schema::table(CustomField::$table_name, function ($table) use ($custom_field) {
$table->renameColumn($custom_field->convertUnicodeDbSlug($custom_field->getOriginal("name")), $custom_field->convertUnicodeDbSlug());
});
$custom_field->db_column = $custom_field->convertUnicodeDbSlug();
$custom_field->save();
return true;
}
return true;
});
+17
View File
@@ -36,4 +36,21 @@ class Group extends SnipeModel
{
return json_decode($this->permissions, true);
}
/**
* Query builder scope to search on text
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
* @param text $search Search term
*
* @return Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeTextSearch($query, $search)
{
return $query->where(function ($query) use ($search) {
$query->where('name', 'LIKE', '%'.$search.'%');
});
}
}
+5 -8
View File
@@ -77,25 +77,22 @@ class Ldap extends Model
$connection = Ldap::connectToLdap();
$ldap_username_field = $settings->ldap_username_field;
$baseDn = $settings->ldap_basedn;
$userDn = $ldap_username_field.'='.$username.','.$settings->ldap_basedn;
if ($settings->is_ad =='1') {
// Check if they are using the userprincipalname for the username field.
// Check if they are using the userprincipalname for the username field.
// If they are, we can skip building the UPN to authenticate against AD
if ($ldap_username_field=='userprincipalname') {
$userDn = $username;
} else {
// In case they haven't added an AD domain
if ($settings->ad_domain == '') {
$userDn = $username.'@'.$settings->email_domain;
} else {
$userDn = $username.'@'.$settings->ad_domain;
}
$userDn = ($settings->ad_domain != '') ? $username.'@'.$settings->ad_domain : $username.'@'.$settings->email_domain;
}
} else {
$userDn = $ldap_username_field.'='.$username.','.$settings->ldap_basedn;
}
\Log::debug('Attempting to login using distinguished name:'.$userDn);
$filterQuery = $settings->ldap_auth_filter_query . $username;
+5
View File
@@ -83,6 +83,11 @@ class Location extends SnipeModel
// return $this->hasMany('\App\Models\Asset', 'assigned_to')->withTrashed();
}
public function setLdapOuAttribute($ldap_ou)
{
return $this->attributes['ldap_ou'] = empty($ldap_ou) ? null : $ldap_ou;
}
public static function getLocationHierarchy($locations, $parent_id = null)
{
+8
View File
@@ -378,6 +378,14 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
return json_decode($this->permissions, true);
}
public function scopeByGroup($query, $id) {
return $query->whereHas('groups', function ($query) use ($id) {
$query->where('id', '=', $id);
});
}
/**
* Query builder scope to search on text
*
+17 -9
View File
@@ -45,13 +45,12 @@ class CheckoutNotification extends Notification
$item = $this->params['item'];
if (class_basename(get_class($this->params['item']))=='Asset') {
$notifyBy[] = 'mail';
if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance() == '1'))
|| (method_exists($item, 'getEula') && ($item->getEula()))
) {
$notifyBy[] = 'mail';
}
}
// if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance()=='1'))
// || (method_exists($item, 'getEula') && ($item->getEula()))
// ) {
// $notifyBy[] = 'mail';
// }
return $notifyBy;
}
@@ -83,6 +82,7 @@ class CheckoutNotification extends Notification
*/
public function toMail($notifiable)
{
if (class_basename(get_class($this->params['item']))=='Asset') {
//TODO: Expand for non assets.
$item = $this->params['item'];
@@ -99,11 +99,19 @@ class CheckoutNotification extends Notification
'item_serial' => $item->serial,
'require_acceptance' => method_exists($item, 'requireAcceptance') ? $item->requireAcceptance() : '',
'log_id' => $this->params['log_id'],
'manufacturer_name' => $item->model->manufacturer->name,
'model_name' => $item->model->name,
'model_number' => $item->model->model_number,
];
return (new MailMessage)
->view('emails.accept-asset', $data)
->subject(trans('mail.Confirm_asset_delivery'));
if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance() == '1'))
|| (method_exists($item, 'getEula') && ($item->getEula()))
) {
return (new MailMessage)
->view('emails.accept-asset', $data)
->subject(trans('mail.Confirm_asset_delivery'));
}
}
+99
View File
@@ -0,0 +1,99 @@
<?php
namespace App\Policies;
use App\Models\Company;
use App\Models\Category;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class CategoryPolicy
{
use HandlesAuthorization;
public function before(User $user, $category)
{
// Lets move all company related checks here.
if ($category instanceof \App\Models\Category && !Company::isCurrentUserHasAccess($category)) {
return false;
}
// If an admin, they can do all asset related tasks.
if ($user->hasAccess('admin')) {
return true;
}
}
/**
* Determine whether the user can view the category.
*
* @param \App\Models\User $user
* @param \App\Category $category
* @return mixed
*/
public function view(User $user)
{
return $user->hasAccess('categories.view');
}
/**
* Determine whether the user can create categories.
*
* @param \App\Models\User $user
* @return mixed
*/
public function create(User $user)
{
return $user->hasAccess('categories.create');
}
/**
* Determine whether the user can update the category.
*
* @param \App\Models\User $user
* @param \App\Category $category
* @return mixed
*/
public function update(User $user)
{
//
return $user->hasAccess('categories.edit');
}
/**
* Determine whether the user can delete the category.
*
* @param \App\Models\User $user
* @param \App\Category $category
* @return mixed
*/
public function delete(User $user)
{
//
return $user->hasAccess('categories.delete');
}
/**
* Determine whether the user can view the category index.
*
* @param \App\Models\User $user
* @param \App\Models\Category $category
* @return mixed
*/
public function index(User $user)
{
return $user->hasAccess('categories.view');
}
/**
* Determine whether the user can manage the category.
*
* @param \App\Models\User $user
* @param \App\Models\Category $category
* @return mixed
*/
public function manage(User $user)
{
return $user->hasAccess('categories.edit');
}
}
+99
View File
@@ -0,0 +1,99 @@
<?php
namespace App\Policies;
use App\Models\Company;
use App\Models\Location;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class LocationPolicy
{
use HandlesAuthorization;
public function before(User $user, $location)
{
// Lets move all company related checks here.
if ($location instanceof \App\Models\Location && !Company::isCurrentUserHasAccess($location)) {
return false;
}
// If an admin, they can do all asset related tasks.
if ($user->hasAccess('admin')) {
return true;
}
}
/**
* Determine whether the user can view the location.
*
* @param \App\Models\User $user
* @param \App\Models\Location $location
* @return mixed
*/
public function view(User $user)
{
return $user->hasAccess('locations.view');
}
/**
* Determine whether the user can create locations.
*
* @param \App\Models\\User $user
* @return mixed
*/
public function create(User $user)
{
return $user->hasAccess('locations.create');
}
/**
* Determine whether the user can update the location.
*
* @param \App\Models\User $user
* @param \App\Models\Location $location
* @return mixed
*/
public function update(User $user)
{
//
return $user->hasAccess('locations.edit');
}
/**
* Determine whether the user can delete the location.
*
* @param \App\Models\User $user
* @param \App\Models\Location $location
* @return mixed
*/
public function delete(User $user)
{
//
return $user->hasAccess('locations.delete');
}
/**
* Determine whether the user can view the location index.
*
* @param \App\Models\User $user
* @param \App\Models\Accessory $location
* @return mixed
*/
public function index(User $user)
{
return $user->hasAccess('locations.view');
}
/**
* Determine whether the user can manage the location.
*
* @param \App\Models\User $user
* @param \App\Models\Location $location
* @return mixed
*/
public function manage(User $user)
{
return $user->hasAccess('locations.edit');
}
}
-49
View File
@@ -122,55 +122,6 @@ class AccessoryPresenter extends Presenter
return json_encode($layout);
}
/**
* JSON representation of Accessory for datatable.
* @return array
*/
public function forDataTable()
{
$actions = '<nobr>';
if (Gate::allows('checkout', $this->model)) {
$actions .= Helper::generateDatatableButton(
'checkout',
route('checkout/accessory', $this->id),
$this->numRemaining() > 0
);
}
if (Gate::allows('update', $this->model)) {
$actions .= Helper::generateDatatableButton('edit', route('accessories.edit', $this->id));
}
if (Gate::allows('delete', $this->model)) {
$actions .= Helper::generateDatatableButton(
'delete',
route('accessories.destroy', $this->id),
true, /*enabled*/
trans('admin/accessories/message.delete.confirm'),
$this->name
);
}
$actions .= '</nobr>';
$results = [];
$results['name'] = $this->nameUrl();
$results['category'] = '';
if ($this->model->category) {
$results['category'] = $this->model->category->present()->nameUrl();
}
$results['model_number'] = $this->model_number;
$results['qty'] = $this->qty;
$results['order_number'] = $this->order_number;
$results['min_amt'] = $this->min_amt;
$results['location'] = $this->model->location ? $this->model->location->present()->nameUrl() : '';
$results['purchase_date'] = $this->purchase_date;
$results['purchase_cost'] = Helper::formatCurrencyOutput($this->purchase_cost);
$results['numRemaining'] = $this->numRemaining();
$results['companyName'] = $this->model->company ? $this->model->company->present()->nameUrl() : '';
$results['manufacturer'] = $this->model->manufacturer ? $this->model->manufacturer->present()->nameUrl() : '';
$results['actions'] = $actions;
return $results;
}
/**
* Pregenerated link to this accessories view page.
+4 -3
View File
@@ -63,20 +63,21 @@ class CategoryPresenter extends Presenter
"title" => trans('general.components'),
"visible" => true
], [
"field" => "use_default_eula",
"field" => "eula",
"searchable" => false,
"sortable" => false,
"title" => trans('admin/categories/table.eula_text'),
"visible" => false,
"formatter" => 'trueFalseFormatter',
], [
], [
"field" => "require_acceptance",
"searchable" => false,
"sortable" => false,
"title" => trans('admin/categories/table.require_acceptance'),
"visible" => true,
"formatter" => 'trueFalseFormatter',
], [
],
[
"field" => "actions",
"searchable" => false,
"sortable" => false,
+9
View File
@@ -120,5 +120,14 @@ class ComponentPresenter extends Presenter
return (string) link_to_route('consumables.show', e($this->name), $this->id);
}
/**
* Url to view this item.
* @return string
*/
public function viewUrl()
{
return route('accessories.show', $this->id);
}
}
+6
View File
@@ -110,6 +110,12 @@ class LicensePresenter extends Presenter
"sortable" => true,
"visible" => false,
"title" => trans('general.order_number'),
], [
"field" => "notes",
"searchable" => true,
"sortable" => true,
"visible" => false,
"title" => trans('general.notes'),
]
];
+2 -2
View File
@@ -98,8 +98,8 @@ class AppServiceProvider extends ServiceProvider
if (config('app.debug')) {
$log_level = 'debug';
} else {
if (config('log-level')) {
$log_level = config('log-level');
if (config('app.log_level')) {
$log_level = config('app.log_level');
} else {
$log_level = 'error';
}
+6
View File
@@ -5,7 +5,9 @@ namespace App\Providers;
use App\Models\Accessory;
use Carbon\Carbon;
use App\Models\Asset;
use App\Models\Location;
use App\Models\Component;
use App\Models\Category;
use App\Models\Consumable;
use App\Models\License;
use App\Models\User;
@@ -14,6 +16,8 @@ use App\Policies\AssetPolicy;
use App\Policies\ComponentPolicy;
use App\Policies\ConsumablePolicy;
use App\Policies\LicensePolicy;
use App\Policies\LocationPolicy;
use App\Policies\CategoryPolicy;
use App\Policies\UserPolicy;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
@@ -33,6 +37,8 @@ class AuthServiceProvider extends ServiceProvider
Consumable::class => ConsumablePolicy::class,
License::class => LicensePolicy::class,
User::class => UserPolicy::class,
Location::class => LocationPolicy::class,
Category::class => CategoryPolicy::class,
];
/**
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"css/AdminLTE.css","sources":[],"mappings":";;;;;;A","sourceRoot":""}
{"version":3,"file":"css/AdminLTE.css","sources":[],"mappings":";;;;;;","sourceRoot":""}
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"css/app.css","sources":[],"mappings":";;;;;;;;A","sourceRoot":""}
{"version":3,"file":"css/app.css","sources":[],"mappings":";;;;;;;;","sourceRoot":""}
File diff suppressed because one or more lines are too long
+21 -10
View File
@@ -1,12 +1,23 @@
{
"/vue.js": "/vue.js",
"/css/AdminLTE.css": "/css/AdminLTE.css",
"/css/app.css": "/css/app.css",
"/css/overrides.css": "/css/overrides.css",
"/vue.js.map": "/vue.js.map",
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map",
"/css/app.css.map": "/css/app.css.map",
"/css/overrides.css.map": "/css/overrides.css.map",
"/public/css/dist/all.css": "/public/css/dist/all.css",
"/public/js/dist/all.js": "/public/js/dist/all.js"
"/build/vue.js": "/build/vue.js",
"/mix.js": "/mix.js",
"/build/app.css": "/build/app.535d8af1016a2377e449920c617f0197.css",
"/build/AdminLTE.css": "/build/AdminLTE.3d8a2b2e33baa060b1b324363ad5e1c2.css",
"/build/overrides.css": "/build/overrides.617623c6a96be3e0cbd11c5d4039ec10.css",
"/css/all.css": "/css/all.css",
"/js/all.js": "/js/all.js",
"/css/app.css": "/css/app.css",
"/css/dist/all.css": "/css/dist/all.css",
"/js/dist/all.js": "/js/dist/all.js",
"/css/AdminLTE.css": "/css/AdminLTE.css",
"/css/overrides.css": "/css/overrides.css",
"/css/skin-blue.css": "/css/skin-blue.css",
"/vue.js": "/vue.js",
"/vue.js.map": "/vue.js.map",
"/mix.js.map": "/mix.js.map",
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map",
"/css/app.css.map": "/css/app.css.map",
"/css/overrides.css.map": "/css/overrides.css.map",
"public/css/dist/all.css": "public/css/dist/all.css",
"public/js/dist/all.js": "public/js/dist/all.js"
}
+63 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -29,6 +29,7 @@
"phpdocumentor/reflection-docblock": "3.2.2",
"phpspec/prophecy": "1.6.2",
"pragmarx/google2fa": "^1.0",
"predis/predis": "^1.1",
"schuppo/password-strength": "~1.5",
"spatie/laravel-backup": "^3.0.0",
"tecnickcom/tc-lib-barcode": "^1.15",
Generated
+162 -111
View File
@@ -4,7 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "0806112cf7a9396f0a7d89649ea7060b",
"hash": "abe6a702f2383ae1fd4c9bbfb06c47ee",
"content-hash": "7659dd61c86bb042a246c2fa313d79a6",
"packages": [
{
"name": "aws/aws-sdk-php",
@@ -84,7 +85,7 @@
"s3",
"sdk"
],
"time": "2017-09-29T19:46:41+00:00"
"time": "2017-09-29 19:46:41"
},
{
"name": "aws/aws-sdk-php-laravel",
@@ -140,7 +141,7 @@
"s3",
"sdk"
],
"time": "2016-01-18T06:57:07+00:00"
"time": "2016-01-18 06:57:07"
},
{
"name": "barryvdh/laravel-debugbar",
@@ -189,7 +190,7 @@
"profiler",
"webprofiler"
],
"time": "2017-07-21T11:56:48+00:00"
"time": "2017-07-21 11:56:48"
},
{
"name": "christian-riesen/base32",
@@ -243,7 +244,7 @@
"encode",
"rfc4648"
],
"time": "2016-05-05T11:49:03+00:00"
"time": "2016-05-05 11:49:03"
},
{
"name": "defuse/php-encryption",
@@ -306,7 +307,7 @@
"security",
"symmetric key cryptography"
],
"time": "2017-05-18T21:28:48+00:00"
"time": "2017-05-18 21:28:48"
},
{
"name": "dnoegel/php-xdg-base-dir",
@@ -339,7 +340,7 @@
"MIT"
],
"description": "implementation of xdg base directory specification for php",
"time": "2014-10-24T07:27:01+00:00"
"time": "2014-10-24 07:27:01"
},
{
"name": "doctrine/annotations",
@@ -407,7 +408,7 @@
"docblock",
"parser"
],
"time": "2017-02-24T16:22:25+00:00"
"time": "2017-02-24 16:22:25"
},
{
"name": "doctrine/cache",
@@ -477,7 +478,7 @@
"cache",
"caching"
],
"time": "2017-07-22T12:49:21+00:00"
"time": "2017-07-22 12:49:21"
},
{
"name": "doctrine/collections",
@@ -544,7 +545,7 @@
"collections",
"iterator"
],
"time": "2017-01-03T10:49:41+00:00"
"time": "2017-01-03 10:49:41"
},
{
"name": "doctrine/common",
@@ -617,7 +618,7 @@
"persistence",
"spl"
],
"time": "2017-07-22T08:35:12+00:00"
"time": "2017-07-22 08:35:12"
},
{
"name": "doctrine/dbal",
@@ -688,7 +689,7 @@
"persistence",
"queryobject"
],
"time": "2017-07-22T20:44:48+00:00"
"time": "2017-07-22 20:44:48"
},
{
"name": "doctrine/inflector",
@@ -755,7 +756,7 @@
"singularize",
"string"
],
"time": "2015-11-06T14:35:42+00:00"
"time": "2015-11-06 14:35:42"
},
{
"name": "doctrine/instantiator",
@@ -809,7 +810,7 @@
"constructor",
"instantiate"
],
"time": "2015-06-14T21:17:01+00:00"
"time": "2015-06-14 21:17:01"
},
{
"name": "doctrine/lexer",
@@ -863,7 +864,7 @@
"lexer",
"parser"
],
"time": "2014-09-09T13:34:57+00:00"
"time": "2014-09-09 13:34:57"
},
{
"name": "erusev/parsedown",
@@ -905,7 +906,7 @@
"markdown",
"parser"
],
"time": "2017-05-14T14:47:48+00:00"
"time": "2017-05-14 14:47:48"
},
{
"name": "fideloper/proxy",
@@ -962,7 +963,7 @@
"proxy",
"trusted proxy"
],
"time": "2017-06-15T17:19:42+00:00"
"time": "2017-06-15 17:19:42"
},
{
"name": "firebase/php-jwt",
@@ -1005,7 +1006,7 @@
],
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
"homepage": "https://github.com/firebase/php-jwt",
"time": "2016-07-18T04:51:16+00:00"
"time": "2016-07-18 04:51:16"
},
{
"name": "guzzlehttp/guzzle",
@@ -1070,7 +1071,7 @@
"rest",
"web service"
],
"time": "2017-06-22T18:50:49+00:00"
"time": "2017-06-22 18:50:49"
},
{
"name": "guzzlehttp/promises",
@@ -1121,7 +1122,7 @@
"keywords": [
"promise"
],
"time": "2016-12-20T10:07:11+00:00"
"time": "2016-12-20 10:07:11"
},
{
"name": "guzzlehttp/psr7",
@@ -1186,7 +1187,7 @@
"uri",
"url"
],
"time": "2017-03-20T17:10:46+00:00"
"time": "2017-03-20 17:10:46"
},
{
"name": "intervention/image",
@@ -1256,7 +1257,7 @@
"thumbnail",
"watermark"
],
"time": "2017-09-21T16:29:17+00:00"
"time": "2017-09-21 16:29:17"
},
{
"name": "jakub-onderka/php-console-color",
@@ -1299,7 +1300,7 @@
"homepage": "http://www.acci.cz"
}
],
"time": "2014-04-08T15:00:19+00:00"
"time": "2014-04-08 15:00:19"
},
{
"name": "jakub-onderka/php-console-highlighter",
@@ -1343,7 +1344,7 @@
"homepage": "http://www.acci.cz/"
}
],
"time": "2015-04-20T18:58:01+00:00"
"time": "2015-04-20 18:58:01"
},
{
"name": "javiereguiluz/easyslugger",
@@ -1373,7 +1374,7 @@
"MIT"
],
"description": "A fast and easy to use slugger with full UTF-8 support.",
"time": "2015-04-12T19:57:10+00:00"
"time": "2015-04-12 19:57:10"
},
{
"name": "jenssegers/rollbar",
@@ -1425,7 +1426,7 @@
"monitoring",
"rollbar"
],
"time": "2017-01-25T08:34:12+00:00"
"time": "2017-01-25 08:34:12"
},
{
"name": "laravel/framework",
@@ -1554,7 +1555,7 @@
"framework",
"laravel"
],
"time": "2017-08-30T09:26:16+00:00"
"time": "2017-08-30 09:26:16"
},
{
"name": "laravel/passport",
@@ -1618,7 +1619,7 @@
"oauth",
"passport"
],
"time": "2017-07-12T20:03:53+00:00"
"time": "2017-07-12 20:03:53"
},
{
"name": "laravel/tinker",
@@ -1681,7 +1682,7 @@
"laravel",
"psysh"
],
"time": "2017-07-13T13:11:05+00:00"
"time": "2017-07-13 13:11:05"
},
{
"name": "laravelcollective/html",
@@ -1735,7 +1736,7 @@
],
"description": "HTML and Form Builders for the Laravel Framework",
"homepage": "http://laravelcollective.com",
"time": "2017-08-12T15:52:38+00:00"
"time": "2017-08-12 15:52:38"
},
{
"name": "lcobucci/jwt",
@@ -1793,7 +1794,7 @@
"JWS",
"jwt"
],
"time": "2017-09-01T08:23:26+00:00"
"time": "2017-09-01 08:23:26"
},
{
"name": "league/csv",
@@ -1850,7 +1851,7 @@
"read",
"write"
],
"time": "2017-07-12T07:18:20+00:00"
"time": "2017-07-12 07:18:20"
},
{
"name": "league/event",
@@ -1900,7 +1901,7 @@
"event",
"listener"
],
"time": "2015-05-21T12:24:47+00:00"
"time": "2015-05-21 12:24:47"
},
{
"name": "league/flysystem",
@@ -1983,7 +1984,7 @@
"sftp",
"storage"
],
"time": "2017-08-06T17:41:04+00:00"
"time": "2017-08-06 17:41:04"
},
{
"name": "league/oauth2-server",
@@ -2060,7 +2061,7 @@
"secure",
"server"
],
"time": "2017-07-11T06:31:36+00:00"
"time": "2017-07-11 06:31:36"
},
{
"name": "maknz/slack",
@@ -2109,7 +2110,7 @@
"laravel",
"slack"
],
"time": "2015-06-03T03:35:16+00:00"
"time": "2015-06-03 03:35:16"
},
{
"name": "maximebf/debugbar",
@@ -2170,7 +2171,7 @@
"debug",
"debugbar"
],
"time": "2017-01-05T08:46:19+00:00"
"time": "2017-01-05 08:46:19"
},
{
"name": "monolog/monolog",
@@ -2248,7 +2249,7 @@
"logging",
"psr-3"
],
"time": "2017-06-19T01:22:40+00:00"
"time": "2017-06-19 01:22:40"
},
{
"name": "mtdowling/cron-expression",
@@ -2292,7 +2293,7 @@
"cron",
"schedule"
],
"time": "2017-01-23T04:29:33+00:00"
"time": "2017-01-23 04:29:33"
},
{
"name": "mtdowling/jmespath.php",
@@ -2347,7 +2348,7 @@
"json",
"jsonpath"
],
"time": "2016-12-03T22:08:25+00:00"
"time": "2016-12-03 22:08:25"
},
{
"name": "neitanod/forceutf8",
@@ -2381,7 +2382,7 @@
],
"description": "PHP Class Encoding featuring popular Encoding::toUTF8() function --formerly known as forceUTF8()-- that fixes mixed encoded strings.",
"homepage": "https://github.com/neitanod/forceutf8",
"time": "2017-05-22T18:50:57+00:00"
"time": "2017-05-22 18:50:57"
},
{
"name": "nesbot/carbon",
@@ -2434,7 +2435,7 @@
"datetime",
"time"
],
"time": "2017-01-16T07:55:07+00:00"
"time": "2017-01-16 07:55:07"
},
{
"name": "nikic/php-parser",
@@ -2485,7 +2486,7 @@
"parser",
"php"
],
"time": "2017-09-02T17:10:46+00:00"
"time": "2017-09-02 17:10:46"
},
{
"name": "paragonie/random_compat",
@@ -2533,7 +2534,7 @@
"pseudorandom",
"random"
],
"time": "2017-09-27T21:40:39+00:00"
"time": "2017-09-27 21:40:39"
},
{
"name": "patchwork/utf8",
@@ -2592,7 +2593,7 @@
"utf-8",
"utf8"
],
"time": "2016-05-18T13:57:10+00:00"
"time": "2016-05-18 13:57:10"
},
{
"name": "phpdocumentor/reflection-common",
@@ -2646,7 +2647,7 @@
"reflection",
"static analysis"
],
"time": "2017-09-11T18:02:19+00:00"
"time": "2017-09-11 18:02:19"
},
{
"name": "phpdocumentor/reflection-docblock",
@@ -2691,7 +2692,7 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2017-08-08T06:39:58+00:00"
"time": "2017-08-08 06:39:58"
},
{
"name": "phpdocumentor/type-resolver",
@@ -2738,7 +2739,7 @@
"email": "me@mikevanriel.com"
}
],
"time": "2017-06-03T08:32:36+00:00"
"time": "2017-06-03 08:32:36"
},
{
"name": "phpseclib/phpseclib",
@@ -2830,7 +2831,7 @@
"x.509",
"x509"
],
"time": "2017-06-05T06:31:10+00:00"
"time": "2017-06-05 06:31:10"
},
{
"name": "phpspec/prophecy",
@@ -2893,7 +2894,7 @@
"spy",
"stub"
],
"time": "2016-11-21T14:58:47+00:00"
"time": "2016-11-21 14:58:47"
},
{
"name": "pragmarx/google2fa",
@@ -2954,7 +2955,57 @@
"google2fa",
"laravel"
],
"time": "2016-07-18T20:25:04+00:00"
"time": "2016-07-18 20:25:04"
},
{
"name": "predis/predis",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/nrk/predis.git",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"suggest": {
"ext-curl": "Allows access to Webdis when paired with phpiredis",
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol"
},
"type": "library",
"autoload": {
"psr-4": {
"Predis\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniele Alessandri",
"email": "suppakilla@gmail.com",
"homepage": "http://clorophilla.net"
}
],
"description": "Flexible and feature-complete Redis client for PHP and HHVM",
"homepage": "http://github.com/nrk/predis",
"keywords": [
"nosql",
"predis",
"redis"
],
"time": "2016-06-16 16:22:20"
},
{
"name": "psr/http-message",
@@ -3004,7 +3055,7 @@
"request",
"response"
],
"time": "2016-08-06T14:39:51+00:00"
"time": "2016-08-06 14:39:51"
},
{
"name": "psr/log",
@@ -3051,7 +3102,7 @@
"psr",
"psr-3"
],
"time": "2016-10-10T12:19:37+00:00"
"time": "2016-10-10 12:19:37"
},
{
"name": "psy/psysh",
@@ -3124,7 +3175,7 @@
"interactive",
"shell"
],
"time": "2017-07-29T19:30:02+00:00"
"time": "2017-07-29 19:30:02"
},
{
"name": "ramsey/uuid",
@@ -3206,7 +3257,7 @@
"identifier",
"uuid"
],
"time": "2017-09-22T20:46:04+00:00"
"time": "2017-09-22 20:46:04"
},
{
"name": "rollbar/rollbar",
@@ -3256,7 +3307,7 @@
"logging",
"monitoring"
],
"time": "2016-07-05T15:50:29+00:00"
"time": "2016-07-05 15:50:29"
},
{
"name": "schuppo/password-strength",
@@ -3306,7 +3357,7 @@
"password strength",
"validation"
],
"time": "2016-10-05T09:57:59+00:00"
"time": "2016-10-05 09:57:59"
},
{
"name": "sebastian/comparator",
@@ -3370,7 +3421,7 @@
"compare",
"equality"
],
"time": "2017-01-29T09:50:25+00:00"
"time": "2017-01-29 09:50:25"
},
{
"name": "sebastian/diff",
@@ -3422,7 +3473,7 @@
"keywords": [
"diff"
],
"time": "2017-05-22T07:24:03+00:00"
"time": "2017-05-22 07:24:03"
},
{
"name": "sebastian/exporter",
@@ -3489,7 +3540,7 @@
"export",
"exporter"
],
"time": "2016-11-19T08:54:04+00:00"
"time": "2016-11-19 08:54:04"
},
{
"name": "sebastian/recursion-context",
@@ -3542,7 +3593,7 @@
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2016-11-19T07:33:16+00:00"
"time": "2016-11-19 07:33:16"
},
{
"name": "spatie/db-dumper",
@@ -3592,7 +3643,7 @@
"mysqldump",
"spatie"
],
"time": "2016-06-14T13:23:01+00:00"
"time": "2016-06-14 13:23:01"
},
{
"name": "spatie/laravel-backup",
@@ -3655,7 +3706,7 @@
"laravel-backup",
"spatie"
],
"time": "2017-02-18T09:54:12+00:00"
"time": "2017-02-18 09:54:12"
},
{
"name": "swiftmailer/swiftmailer",
@@ -3709,7 +3760,7 @@
"mail",
"mailer"
],
"time": "2017-05-01T15:54:03+00:00"
"time": "2017-05-01 15:54:03"
},
{
"name": "symfony/console",
@@ -3777,7 +3828,7 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2017-09-06T16:40:18+00:00"
"time": "2017-09-06 16:40:18"
},
{
"name": "symfony/css-selector",
@@ -3830,7 +3881,7 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2017-01-02T20:31:54+00:00"
"time": "2017-01-02 20:31:54"
},
{
"name": "symfony/debug",
@@ -3886,7 +3937,7 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2017-09-01T13:23:39+00:00"
"time": "2017-09-01 13:23:39"
},
{
"name": "symfony/event-dispatcher",
@@ -3949,7 +4000,7 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-07-29 21:54:42"
},
{
"name": "symfony/finder",
@@ -3998,7 +4049,7 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-07-29 21:54:42"
},
{
"name": "symfony/http-foundation",
@@ -4051,7 +4102,7 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2017-09-06T17:07:39+00:00"
"time": "2017-09-06 17:07:39"
},
{
"name": "symfony/http-kernel",
@@ -4137,7 +4188,7 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com",
"time": "2017-09-11T16:13:23+00:00"
"time": "2017-09-11 16:13:23"
},
{
"name": "symfony/polyfill-mbstring",
@@ -4196,7 +4247,7 @@
"portable",
"shim"
],
"time": "2017-06-14T15:44:48+00:00"
"time": "2017-06-14 15:44:48"
},
{
"name": "symfony/polyfill-php56",
@@ -4252,7 +4303,7 @@
"portable",
"shim"
],
"time": "2017-06-14T15:44:48+00:00"
"time": "2017-06-14 15:44:48"
},
{
"name": "symfony/polyfill-util",
@@ -4304,7 +4355,7 @@
"polyfill",
"shim"
],
"time": "2017-07-05T15:09:33+00:00"
"time": "2017-07-05 15:09:33"
},
{
"name": "symfony/process",
@@ -4353,7 +4404,7 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-07-29 21:54:42"
},
{
"name": "symfony/psr-http-message-bridge",
@@ -4413,7 +4464,7 @@
"http-message",
"psr-7"
],
"time": "2016-09-14T18:37:20+00:00"
"time": "2016-09-14 18:37:20"
},
{
"name": "symfony/routing",
@@ -4491,7 +4542,7 @@
"uri",
"url"
],
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-07-29 21:54:42"
},
{
"name": "symfony/translation",
@@ -4556,7 +4607,7 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-07-29 21:54:42"
},
{
"name": "symfony/var-dumper",
@@ -4624,7 +4675,7 @@
"debug",
"dump"
],
"time": "2017-08-27T14:52:21+00:00"
"time": "2017-08-27 14:52:21"
},
{
"name": "tecnickcom/tc-lib-barcode",
@@ -4714,7 +4765,7 @@
"tc-lib-barcode",
"upc"
],
"time": "2017-02-12T13:51:39+00:00"
"time": "2017-02-12 13:51:39"
},
{
"name": "tecnickcom/tc-lib-color",
@@ -4777,7 +4828,7 @@
"tc-lib-color",
"web"
],
"time": "2017-02-12T12:07:38+00:00"
"time": "2017-02-12 12:07:38"
},
{
"name": "tightenco/ziggy",
@@ -4827,7 +4878,7 @@
}
],
"description": "Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.",
"time": "2017-08-23T11:48:08+00:00"
"time": "2017-08-23 11:48:08"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
@@ -4874,7 +4925,7 @@
],
"description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.",
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
"time": "2016-09-20T12:50:39+00:00"
"time": "2016-09-20 12:50:39"
},
{
"name": "unicodeveloper/laravel-password",
@@ -4929,7 +4980,7 @@
"security",
"unicodeveloper"
],
"time": "2017-04-27T07:35:00+00:00"
"time": "2017-04-27 07:35:00"
},
{
"name": "vlucas/phpdotenv",
@@ -4979,7 +5030,7 @@
"env",
"environment"
],
"time": "2016-09-01T10:05:43+00:00"
"time": "2016-09-01 10:05:43"
},
{
"name": "watson/validating",
@@ -5029,7 +5080,7 @@
"laravel",
"validation"
],
"time": "2017-08-25T02:12:38+00:00"
"time": "2017-08-25 02:12:38"
},
{
"name": "webmozart/assert",
@@ -5079,7 +5130,7 @@
"check",
"validate"
],
"time": "2016-11-23T20:04:58+00:00"
"time": "2016-11-23 20:04:58"
},
{
"name": "zendframework/zend-diactoros",
@@ -5131,7 +5182,7 @@
"psr",
"psr-7"
],
"time": "2017-09-13T14:47:08+00:00"
"time": "2017-09-13 14:47:08"
}
],
"packages-dev": [
@@ -5192,7 +5243,7 @@
"gherkin",
"parser"
],
"time": "2016-10-30T11:50:56+00:00"
"time": "2016-10-30 11:50:56"
},
{
"name": "codeception/codeception",
@@ -5286,7 +5337,7 @@
"functional testing",
"unit testing"
],
"time": "2017-09-28T23:19:49+00:00"
"time": "2017-09-28 23:19:49"
},
{
"name": "facebook/webdriver",
@@ -5338,7 +5389,7 @@
"selenium",
"webdriver"
],
"time": "2017-04-28T14:54:49+00:00"
"time": "2017-04-28 14:54:49"
},
{
"name": "fzaninotto/faker",
@@ -5388,7 +5439,7 @@
"faker",
"fixtures"
],
"time": "2017-08-15T16:48:10+00:00"
"time": "2017-08-15 16:48:10"
},
{
"name": "myclabs/deep-copy",
@@ -5430,7 +5481,7 @@
"object",
"object graph"
],
"time": "2017-04-12T18:52:22+00:00"
"time": "2017-04-12 18:52:22"
},
{
"name": "phpunit/php-code-coverage",
@@ -5493,7 +5544,7 @@
"testing",
"xunit"
],
"time": "2017-04-02T07:44:40+00:00"
"time": "2017-04-02 07:44:40"
},
{
"name": "phpunit/php-file-iterator",
@@ -5540,7 +5591,7 @@
"filesystem",
"iterator"
],
"time": "2016-10-03T07:40:28+00:00"
"time": "2016-10-03 07:40:28"
},
{
"name": "phpunit/php-text-template",
@@ -5581,7 +5632,7 @@
"keywords": [
"template"
],
"time": "2015-06-21T13:50:34+00:00"
"time": "2015-06-21 13:50:34"
},
{
"name": "phpunit/php-timer",
@@ -5630,7 +5681,7 @@
"keywords": [
"timer"
],
"time": "2017-02-26T11:10:40+00:00"
"time": "2017-02-26 11:10:40"
},
{
"name": "phpunit/php-token-stream",
@@ -5679,7 +5730,7 @@
"keywords": [
"tokenizer"
],
"time": "2017-02-27T10:12:30+00:00"
"time": "2017-02-27 10:12:30"
},
{
"name": "phpunit/phpunit",
@@ -5761,7 +5812,7 @@
"testing",
"xunit"
],
"time": "2017-09-24T07:23:38+00:00"
"time": "2017-09-24 07:23:38"
},
{
"name": "phpunit/phpunit-mock-objects",
@@ -5820,7 +5871,7 @@
"mock",
"xunit"
],
"time": "2017-06-30T09:13:00+00:00"
"time": "2017-06-30 09:13:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@@ -5865,7 +5916,7 @@
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"time": "2017-03-04T06:30:41+00:00"
"time": "2017-03-04 06:30:41"
},
{
"name": "sebastian/environment",
@@ -5915,7 +5966,7 @@
"environment",
"hhvm"
],
"time": "2016-11-26T07:53:53+00:00"
"time": "2016-11-26 07:53:53"
},
{
"name": "sebastian/global-state",
@@ -5966,7 +6017,7 @@
"keywords": [
"global state"
],
"time": "2015-10-12T03:26:01+00:00"
"time": "2015-10-12 03:26:01"
},
{
"name": "sebastian/object-enumerator",
@@ -6012,7 +6063,7 @@
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"time": "2017-02-18T15:18:39+00:00"
"time": "2017-02-18 15:18:39"
},
{
"name": "sebastian/resource-operations",
@@ -6054,7 +6105,7 @@
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"time": "2015-07-28T20:34:47+00:00"
"time": "2015-07-28 20:34:47"
},
{
"name": "sebastian/version",
@@ -6097,7 +6148,7 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2016-10-03T07:35:21+00:00"
"time": "2016-10-03 07:35:21"
},
{
"name": "squizlabs/php_codesniffer",
@@ -6148,7 +6199,7 @@
"phpcs",
"standards"
],
"time": "2017-09-19T22:47:14+00:00"
"time": "2017-09-19 22:47:14"
},
{
"name": "stecman/symfony-console-completion",
@@ -6193,7 +6244,7 @@
}
],
"description": "Automatic BASH completion for Symfony Console Component based applications.",
"time": "2016-02-24T05:08:54+00:00"
"time": "2016-02-24 05:08:54"
},
{
"name": "symfony/browser-kit",
@@ -6250,7 +6301,7 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-07-29 21:54:42"
},
{
"name": "symfony/dom-crawler",
@@ -6306,7 +6357,7 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"time": "2017-01-21T17:13:55+00:00"
"time": "2017-01-21 17:13:55"
},
{
"name": "symfony/yaml",
@@ -6361,7 +6412,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-07-29 21:54:42"
}
],
"aliases": [],
+35 -2
View File
@@ -121,8 +121,41 @@ return [
|
*/
'log' => env('APP_LOG', 'single'),
'log-level' => env('APP_LOG_LEVEL', 'error'),
'log' => env('APP_LOG', 'daily'),
/*
|--------------------------------------------------------------------------
| Logging Max Files
|--------------------------------------------------------------------------
|
| When using the daily log mode, Laravel will only retain 5
| days of log files by default.
|
| To change this, set the APP_LOG_MAX_FILES option in your .env.
|
*/
'log_max_files' => env('APP_LOG_MAX_FILES', 5),
/*
|--------------------------------------------------------------------------
| Logging Detail
|--------------------------------------------------------------------------
|
| By default, Laravel writes all log levels to storage. However, in your
| production environment, you may wish to configure the minimum severity that
| should be logged by editing your APP_LOG_LEVEL env config.
|
| Laravel will log all levels greater than or equal to the specified severity.
| For example, a default log_level of error will log error, critical, alert,
| and emergency messages.
|
| APP_LOG_LEVEL options are:
| "debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"
|
*/
'log_level' => env('APP_LOG_LEVEL', 'error'),
/*
+4 -4
View File
@@ -1,7 +1,7 @@
<?php
return array (
'app_version' => 'v4.0.9',
'build_version' => '120',
'hash_version' => 'gf66e222',
'full_hash' => 'v4.0.9-120-gf66e222',
'app_version' => 'v4.0.13',
'build_version' => '273',
'hash_version' => 'gab3f5f4',
'full_hash' => 'v4.0.13-273-gab3f5f4',
);
+67
View File
@@ -0,0 +1,67 @@
<?php
/*
|--------------------------------------------------------------------------
| Asset Model Factories
|--------------------------------------------------------------------------
|
| Factories related exclusively to creating models ..
|
*/
$factory->define(App\Models\Accessory::class, function (Faker\Generator $faker) {
return [
'user_id' => 1,
'model_number' => $faker->numberBetween(1000000, 50000000),
'location_id' => rand(1,5),
];
});
$factory->state(App\Models\Accessory::class, 'apple-bt-keyboard', function ($faker) {
return [
'name' => 'Bluetooth Keyboard',
'category_id' => 8,
'manufacturer_id' => 1,
'qty' => 10,
'min_amt' => 2
];
});
$factory->state(App\Models\Accessory::class, 'apple-usb-keyboard', function ($faker) {
return [
'name' => 'USB Keyboard',
'category_id' => 8,
'manufacturer_id' => 1,
'qty' => 15,
'min_amt' => 2
];
});
$factory->state(App\Models\Accessory::class, 'apple-mouse', function ($faker) {
return [
'name' => 'Magic Mouse',
'category_id' => 9,
'manufacturer_id' => 1,
'qty' => 13,
'min_amt' => 2
];
});
$factory->state(App\Models\Accessory::class, 'microsoft-mouse', function ($faker) {
return [
'name' => 'Sculpt Comfort Mouse\'',
'category_id' => 9,
'manufacturer_id' => 2,
'qty' => 13,
'min_amt' => 2
];
});
+61 -36
View File
@@ -1,76 +1,101 @@
<?php
use App\Models\Actionlog;
use App\Models\Company;
use App\Models\User;
use App\Models\Location;
use App\Models\Asset;
$factory->defineAs(App\Models\Actionlog::class, 'asset-upload', function ($faker) {
$asset = factory(App\Models\Asset::class)->create();
$factory->define(Actionlog::class, function (Faker\Generator $faker) {
return [
'item_type' => get_class($asset),
'item_id' => $asset->id,
'user_id' => function () {
return factory(App\Models\User::class)->create()->id;
},
'filename' => $faker->word,
'action_type' => 'uploaded'
'note' => 'Sample checkout from DB seeder!',
];
});
$factory->defineAs(Actionlog::class, 'asset-checkout', function (Faker\Generator $faker) {
$company = factory(App\Models\Company::class)->create();
$user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
$target = factory(App\Models\User::class)->create(['company_id' => $company->id]);
do {
$item = factory(App\Models\Asset::class)->create(['company_id' => $company->id]);
} while (!$item->isValid());
// dd($item);
$factory->defineAs(Actionlog::class, 'asset-checkout-user', function (Faker\Generator $faker) {
$target = User::inRandomOrder()->first();
$item = Asset::inRandomOrder()->RTD()->first();
$user_id = rand(1,2); // keep it simple - make it one of the two superadmins
$asset = App\Models\Asset::where('id', $item->id)
->update(
[
'assigned_to' => $target->id,
'assigned_type' => App\Models\User::class
]
);
return [
'user_id' => $user->id,
'created_at' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
'user_id' => $user_id,
'action_type' => 'checkout',
'item_id' => $item->id,
'item_type' => App\Models\Asset::class,
'target_id' => $target->id,
'target_type' => get_class($target),
'created_at' => $faker->dateTime(),
'note' => $faker->sentence,
'company_id' => $company->id
];
});
$factory->defineAs(Actionlog::class, 'license-checkout-asset', function (Faker\Generator $faker) {
$company = factory(App\Models\Company::class)->create();
$user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
$target = factory(App\Models\Asset::class)->create(['company_id' => $company->id]);
$item = factory(App\Models\License::class)->create(['company_id' => $company->id]);
$factory->defineAs(Actionlog::class, 'asset-checkout-location', function (Faker\Generator $faker) {
$target = Location::inRandomOrder()->first();
$item = Asset::inRandomOrder()->RTD()->first();
$user_id = rand(1,2); // keep it simple - make it one of the two superadmins
$asset = App\Models\Asset::where('id', $item->id)
->update(
[
'assigned_to' => $target->id,
'assigned_type' => App\Models\Location::class
]
);
return [
'user_id' => $user->id,
'created_at' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
'user_id' => $user_id,
'action_type' => 'checkout',
'item_id' => $item->id,
'item_type' => App\Models\Asset::class,
'target_id' => $target->id,
'target_type' => get_class($target),
];
});
// This doesn't work - we need to assign a seat
$factory->defineAs(Actionlog::class, 'license-checkout-asset', function (Faker\Generator $faker) {
$target = Asset::inRandomOrder()->RTD()->first();
$item = License::inRandomOrder()->first();
$user_id = rand(1,2); // keep it simple - make it one of the two superadmins
return [
'user_id' => $user_id,
'action_type' => 'checkout',
'item_id' => $item->id,
'item_type' => get_class($item),
'target_id' => $target->id,
'target_type' => get_class($target),
'created_at' => $faker->dateTime(),
'note' => $faker->sentence,
'company_id' => $company->id
'note' => $faker->sentence
];
});
$factory->defineAs(Actionlog::class, 'accessory-checkout', function (Faker\Generator $faker) {
$company = factory(App\Models\Company::class)->create();
$user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
$target = factory(App\Models\User::class)->create(['company_id' => $company->id]);
$item = factory(App\Models\Accessory::class)->create(['company_id' => $company->id]);
$target = Asset::inRandomOrder()->RTD()->first();
$item = Accessory::inRandomOrder()->first();
$user_id = rand(1,2); // keep it simple - make it one of the two superadmins
return [
'user_id' => $user->id,
'user_id' => $user_id,
'action_type' => 'checkout',
'item_id' => $item->id,
'item_type' => get_class($item),
'target_id' => $target->id,
'target_type' => get_class($target),
'created_at' => $faker->dateTime(),
'note' => $faker->sentence,
'company_id' => $company->id
'note' => $faker->sentence
];
});
+141 -44
View File
@@ -15,89 +15,186 @@ use App\Models\Category;
$factory->define(Asset::class, function (Faker\Generator $faker) {
return [
'name' => $faker->catchPhrase,
'model_id' => function () {
return factory(App\Models\AssetModel::class)->create()->id;
},
'rtd_location_id' => function () {
return factory(App\Models\Location::class)->create()->id;
},
'name' => null,
'rtd_location_id' => 1,
'serial' => $faker->uuid,
'status_id' => function () {
return factory(App\Models\Statuslabel::class)->states('rtd')->create()->id;
},
'user_id' => function () {
return factory(App\Models\User::class)->create()->id;
},
'status_id' => 1,
'user_id' => 1,
'asset_tag' => $faker->unixTime('now'),
'notes' => $faker->sentence,
'purchase_date' => $faker->dateTime(),
'purchase_cost' => $faker->randomFloat(2),
'notes' => 'Created by DB seeder',
'purchase_date' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
'purchase_cost' => $faker->randomFloat(2, '299.99', '2999.99'),
'order_number' => $faker->numberBetween(1000000, 50000000),
'supplier_id' => function () {
return factory(App\Models\Supplier::class)->create()->id;
},
'company_id' => function () {
return factory(App\Models\Company::class)->create()->id;
},
'supplier_id' => 1,
'requestable' => $faker->boolean()
];
});
$factory->state(Asset::class, 'deleted', function ($faker) {
$factory->state(Asset::class, 'laptop-mbp', function ($faker) {
return [
'deleted_at' => $faker->dateTime(),
'model_id' => 1
];
});
$factory->state(Asset::class, 'laptop-mbp-pending', function ($faker) {
return [
'model_id' => 1,
'status_id' => 2,
];
});
$factory->state(Asset::class, 'laptop-mbp-archived', function ($faker) {
return [
'model_id' => 1,
'status_id' => 3,
];
});
$factory->state(Asset::class, 'laptop-air', function ($faker) {
return [
'model_id' => 2
];
});
$factory->state(Asset::class, 'laptop-surface', function ($faker) {
return [
'model_id' => 3
];
});
$factory->state(Asset::class, 'laptop-xps', function ($faker) {
return [
'model_id' => 4
];
});
$factory->state(Asset::class, 'laptop-spectre', function ($faker) {
return [
'model_id' => 5
];
});
$factory->state(Asset::class, 'laptop-zenbook', function ($faker) {
return [
'model_id' => 6
];
});
$factory->state(Asset::class, 'laptop-yoga', function ($faker) {
return [
'model_id' => 7
];
});
$factory->state(Asset::class, 'desktop-macpro', function ($faker) {
return [
'model_id' => 8
];
});
$factory->state(Asset::class, 'desktop-lenovo-i5', function ($faker) {
return [
'model_id' => 9
];
});
$factory->state(Asset::class, 'desktop-optiplex', function ($faker) {
return [
'model_id' => 10
];
});
$factory->state(Asset::class, 'conf-polycom', function ($faker) {
return [
'model_id' => 11
];
});
$factory->state(Asset::class, 'conf-polycomcx', function ($faker) {
return [
'model_id' => 12
];
});
$factory->state(Asset::class, 'tablet-ipad', function ($faker) {
return [
'model_id' => 13
];
});
$factory->state(Asset::class, 'tablet-tab3', function ($faker) {
return [
'model_id' => 14
];
});
$factory->state(Asset::class, 'phone-iphone6s', function ($faker) {
return [
'model_id' => 15
];
});
$factory->state(Asset::class, 'phone-iphone7', function ($faker) {
return [
'model_id' => 16
];
});
$factory->state(Asset::class, 'ultrafine', function ($faker) {
return [
'model_id' => 17
];
});
$factory->state(Asset::class, 'ultrasharp', function ($faker) {
return [
'model_id' => 18
];
});
// These are just for unit tests, not to generate data
$factory->state(Asset::class, 'assigned-to-user', function ($faker) {
return [
'model_id' => 1,
'assigned_to' => factory(App\Models\User::class)->create()->id,
'assigned_type' => App\Models\User::class,
];
});
$factory->state(Asset::class, 'assigned-to-location', function ($faker) {
return [
'model_id' => 1,
'assigned_to' => factory(App\Models\Location::class)->create()->id,
'assigned_type' => App\Models\Location::class,
];
});
$factory->state(Asset::class, 'assigned-to-asset', function ($faker) {
return [
'model_id' => 1,
'assigned_to' => factory(App\Models\Asset::class)->create()->id,
'assigned_type' => App\Models\Asset::class,
];
});
$factory->state(Asset::class, 'requires-acceptance', function ($faker) {
$cat = factory(Category::class)->states('asset-category', 'requires-acceptance')->create();
$model = factory(AssetModel::class)->create(['category_id' => $cat->id]);
return [
'model_id' => $model->id
'model_id' => 1,
];
});
$factory->define(App\Models\AssetModel::class, function (Faker\Generator $faker) {
$factory->state(Asset::class, 'deleted', function ($faker) {
return [
'name' => $faker->catchPhrase,
'manufacturer_id' => function () {
return factory(App\Models\Manufacturer::class)->create()->id;
},
'category_id' => function () {
return factory(App\Models\Category::class)->states('asset-category')->create()->id;
},
'model_number' => $faker->numberBetween(1000000, 50000000),
'eol' => 1,
'notes' => $faker->paragraph(),
'requestable' => $faker->boolean(),
'depreciation_id' => function () {
return factory(App\Models\Depreciation::class)->create()->id;
},
'model_id' => 1,
'deleted_at' => $faker->dateTime()
];
});
$factory->define(App\Models\AssetMaintenance::class, function (Faker\Generator $faker) {
return [
'asset_id' => function () {
+255
View File
@@ -0,0 +1,255 @@
<?php
/*
|--------------------------------------------------------------------------
| Asset Model Factories
|--------------------------------------------------------------------------
|
| Factories related exclusively to creating models ..
|
*/
/*
|--------------------------------------------------------------------------
| Laptops
|--------------------------------------------------------------------------
*/
$factory->define(App\Models\AssetModel::class, function (Faker\Generator $faker) {
return [
'user_id' => 1,
'model_number' => $faker->creditCardNumber(),
'notes' => 'Created by demo seeder',
];
});
// 1
$factory->state(App\Models\AssetModel::class, 'mbp-13-model', function ($faker) {
return [
'name' => 'Macbook Pro 13"',
'category_id' => 1,
'manufacturer_id' => 1,
'eol' => '36',
'depreciation_id' => 1,
];
});
// 2
$factory->state(App\Models\AssetModel::class, 'mbp-air-model', function ($faker) {
return [
'name' => 'Macbook Air',
'category_id' => 1,
'manufacturer_id' => 1,
'eol' => '36',
'depreciation_id' => 1,
];
});
// 3
$factory->state(App\Models\AssetModel::class, 'surface-model', function ($faker) {
return [
'name' => 'Surface',
'category_id' => 1,
'manufacturer_id' => 2,
'eol' => '36',
'depreciation_id' => 1,
];
});
// 4
$factory->state(App\Models\AssetModel::class, 'xps13-model', function ($faker) {
return [
'name' => 'XPS 13',
'category_id' => 1,
'manufacturer_id' => 3,
'eol' => '36',
'depreciation_id' => 1,
];
});
// 5
$factory->state(App\Models\AssetModel::class, 'zenbook-model', function ($faker) {
return [
'name' => 'ZenBook UX310',
'category_id' => 1,
'manufacturer_id' => 4,
'eol' => '36',
'depreciation_id' => 1,
];
});
// 6
$factory->state(App\Models\AssetModel::class, 'spectre-model', function ($faker) {
return [
'name' => 'Spectre',
'category_id' => 1,
'manufacturer_id' => 5,
'eol' => '36',
'depreciation_id' => 1,
];
});
// 7
$factory->state(App\Models\AssetModel::class, 'yoga-model', function ($faker) {
return [
'name' => 'Yoga 910',
'category_id' => 1,
'manufacturer_id' => 6,
'eol' => '36',
'depreciation_id' => 1,
];
});
/*
|--------------------------------------------------------------------------
| Desktops
|--------------------------------------------------------------------------
*/
$factory->state(App\Models\AssetModel::class, 'macpro-model', function ($faker) {
return [
'name' => 'iMac Pro',
'category_id' => 2,
'manufacturer_id' => 1,
'eol' => '24',
'depreciation_id' => 1,
];
});
$factory->state(App\Models\AssetModel::class, 'lenovo-i5-model', function ($faker) {
return [
'name' => 'Lenovo Intel Core i5',
'category_id' => 2,
'manufacturer_id' => 6,
'eol' => '24',
'depreciation_id' => 1,
];
});
$factory->state(App\Models\AssetModel::class, 'optiplex-model', function ($faker) {
return [
'name' => 'OptiPlex',
'category_id' => 2,
'manufacturer_id' => 3,
'model_number' => '5040 (MRR81)',
'eol' => '24',
'depreciation_id' => 1,
];
});
/*
|--------------------------------------------------------------------------
| Conference Phones
|--------------------------------------------------------------------------
*/
$factory->state(App\Models\AssetModel::class, 'polycom-model', function ($faker) {
return [
'name' => 'SoundStation 2',
'category_id' => 6,
'manufacturer_id' => 8,
'eol' => '12',
'depreciation_id' => 1,
];
});
$factory->state(App\Models\AssetModel::class, 'polycomcx-model', function ($faker) {
return [
'name' => 'Polycom CX3000 IP Conference Phone',
'category_id' => 6,
'manufacturer_id' => 8,
'eol' => '12',
'depreciation_id' => 1,
];
});
/*
|--------------------------------------------------------------------------
| Tablets
|--------------------------------------------------------------------------
*/
$factory->state(App\Models\AssetModel::class, 'ipad-model', function ($faker) {
return [
'name' => 'iPad Pro',
'category_id' => 3,
'manufacturer_id' => 1,
'eol' => '12',
'depreciation_id' => 1,
];
});
$factory->state(App\Models\AssetModel::class, 'tab3-model', function ($faker) {
return [
'name' => 'Tab3',
'category_id' => 3,
'manufacturer_id' => 6,
'eol' => '12',
'depreciation_id' => 1,
];
});
/*
|--------------------------------------------------------------------------
| Mobile Phones
|--------------------------------------------------------------------------
*/
$factory->state(App\Models\AssetModel::class, 'iphone6s-model', function ($faker) {
return [
'name' => 'iPhone 6s',
'category_id' => 4,
'manufacturer_id' => 1,
'eol' => '12',
'depreciation_id' => 3,
];
});
$factory->state(App\Models\AssetModel::class, 'iphone7-model', function ($faker) {
return [
'name' => 'iPhone 7',
'category_id' => 4,
'manufacturer_id' => 1,
'eol' => '12',
'depreciation_id' => 1,
];
});
/*
|--------------------------------------------------------------------------
| Displays
|--------------------------------------------------------------------------
*/
$factory->state(App\Models\AssetModel::class, 'ultrafine', function ($faker) {
return [
'name' => 'Ultrafine 4k',
'category_id' => 5,
'manufacturer_id' => 7,
'eol' => '12',
'depreciation_id' => 2,
];
});
$factory->state(App\Models\AssetModel::class, 'ultrasharp', function ($faker) {
return [
'name' => 'Ultrasharp U2415',
'category_id' => 5,
'manufacturer_id' => 3,
'eol' => '12',
'depreciation_id' => 2,
];
});
+76 -12
View File
@@ -12,41 +12,105 @@
$factory->define(App\Models\Category::class, function (Faker\Generator $faker) {
return [
'name' => $faker->text(20),
'category_type' => $faker->randomElement(['asset', 'accessory', 'component', 'consumable']),
'eula_text' => $faker->paragraph(),
'require_acceptance' => false,
'use_default_eula' => $faker->boolean(),
'checkin_email' => $faker->boolean()
'user_id' => 1,
'eula_text' => $faker->paragraph(),
'require_acceptance' => false,
'use_default_eula' => $faker->boolean(),
'checkin_email' => $faker->boolean()
];
});
$factory->state(App\Models\Category::class, 'asset-laptop-category', function ($faker) {
return [
'name' => 'Laptops',
'category_type' => 'asset',
'require_acceptance' => true,
];
});
$factory->state(App\Models\Category::class, 'asset-category', function ($faker) {
$factory->state(App\Models\Category::class, 'asset-desktop-category', function ($faker) {
return [
'name' => 'Desktops',
'category_type' => 'asset',
];
});
$factory->state(App\Models\Category::class, 'accessory-category', function ($faker) {
$factory->state(App\Models\Category::class, 'asset-display-category', function ($faker) {
return [
'name' => 'Displays',
'category_type' => 'asset',
];
});
$factory->state(App\Models\Category::class, 'asset-tablet-category', function ($faker) {
return [
'name' => 'Tablets',
'category_type' => 'asset',
];
});
$factory->state(App\Models\Category::class, 'asset-mobile-category', function ($faker) {
return [
'name' => 'Mobile Phones',
'category_type' => 'asset',
];
});
$factory->state(App\Models\Category::class, 'asset-conference-category', function ($faker) {
return [
'name' => 'Conference Phones',
'category_type' => 'asset',
];
});
$factory->state(App\Models\Category::class, 'asset-voip-category', function ($faker) {
return [
'name' => 'VOIP Phones',
'category_type' => 'asset',
];
});
$factory->state(App\Models\Category::class, 'accessory-keyboard-category', function ($faker) {
return [
'name' => 'Keyboards',
'category_type' => 'accessory',
];
});
$factory->state(App\Models\Category::class, 'component-category', function ($faker) {
$factory->state(App\Models\Category::class, 'accessory-mouse-category', function ($faker) {
return [
'name' => 'Mouse',
'category_type' => 'accessory',
];
});
$factory->state(App\Models\Category::class, 'component-hdd-category', function ($faker) {
return [
'name' => 'HDD/SSD',
'category_type' => 'component',
];
});
$factory->state(App\Models\Category::class, 'consumable-category', function ($faker) {
$factory->state(App\Models\Category::class, 'component-ram-category', function ($faker) {
return [
'name' => 'RAM',
'category_type' => 'component',
];
});
$factory->state(App\Models\Category::class, 'consumable-paper-category', function ($faker) {
return [
'name' => 'Printer Paper',
'category_type' => 'consumable',
];
});
$factory->state(App\Models\Category::class, 'requires-acceptance', function ($faker) {
$factory->state(App\Models\Category::class, 'consumable-ink-category', function ($faker) {
return [
'require_acceptance' => true,
'name' => 'Printer Ink',
'category_type' => 'consumable',
];
});
+64
View File
@@ -0,0 +1,64 @@
<?php
/*
|--------------------------------------------------------------------------
| Components Factories
|--------------------------------------------------------------------------
|
| Factories related exclusively to creating components ..
|
*/
$factory->define(App\Models\Component::class, function (Faker\Generator $faker) {
return [
'user_id' => 1,
'order_number' => $faker->numberBetween(1000000, 50000000),
'purchase_date' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
'purchase_cost' => $faker->randomFloat(2, 1, 50),
'qty' => $faker->numberBetween(5, 10),
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
];
});
$factory->state(App\Models\Component::class, 'ram-crucial4', function ($faker) {
return [
'name' => 'Crucial 4GB DDR3L-1600 SODIMM',
'category_id' => 13,
'qty' => 10,
'min_amt' => 2
];
});
$factory->state(App\Models\Component::class, 'ram-crucial8', function ($faker) {
return [
'name' => 'Crucial 8GB DDR3L-1600 SODIMM Memory for Mac',
'category_id' => 13,
'qty' => 10,
'min_amt' => 2
];
});
$factory->state(App\Models\Component::class, 'ssd-crucial120', function ($faker) {
return [
'name' => 'Crucial BX300 120GB SATA Internal SSD',
'category_id' => 12,
'qty' => 10,
'min_amt' => 2
];
});
$factory->state(App\Models\Component::class, 'ssd-crucial240', function ($faker) {
return [
'name' => 'Crucial BX300 240GB SATA Internal SSD',
'category_id' => 12,
'qty' => 10,
'min_amt' => 2
];
});
+58
View File
@@ -0,0 +1,58 @@
<?php
/*
|--------------------------------------------------------------------------
| Consumables Factories
|--------------------------------------------------------------------------
|
| Factories related exclusively to creating consumables ..
|
*/
$factory->define(App\Models\Consumable::class, function (Faker\Generator $faker) {
return [
'user_id' => 1,
'item_no' => $faker->numberBetween(1000000, 50000000),
'order_number' => $faker->numberBetween(1000000, 50000000),
'purchase_date' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
'purchase_cost' => $faker->randomFloat(2, 1, 50),
'qty' => $faker->numberBetween(5, 10),
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
];
});
$factory->state(App\Models\Consumable::class, 'cardstock', function ($faker) {
return [
'name' => 'Cardstock (White)',
'category_id' => 10,
'manufacturer_id' => 10,
'qty' => 10,
'min_amt' => 2
];
});
$factory->state(App\Models\Consumable::class, 'paper', function ($faker) {
return [
'name' => 'Laserjet Paper (Ream)',
'category_id' => 10,
'manufacturer_id' => 10,
'qty' => 20,
'min_amt' => 2
];
});
$factory->state(App\Models\Consumable::class, 'ink', function ($faker) {
return [
'name' => 'Laserjet Toner (black)',
'category_id' => 11,
'manufacturer_id' => 5,
'qty' => 20,
'min_amt' => 2
];
});
+62
View File
@@ -0,0 +1,62 @@
<?php
/*
|--------------------------------------------------------------------------
| Asset Model Factories
|--------------------------------------------------------------------------
|
| Factories related exclusively to creating models ..
|
*/
$factory->define(App\Models\Department::class, function (Faker\Generator $faker) {
return [
'user_id' => 1,
'location_id' => rand(1,5),
];
});
$factory->state(App\Models\Department::class, 'hr', function ($faker) {
return [
'name' => 'Human Resources',
];
});
$factory->state(App\Models\Department::class, 'engineering', function ($faker) {
return [
'name' => 'Engineering',
];
});
$factory->state(App\Models\Department::class, 'marketing', function ($faker) {
return [
'name' => 'Marketing',
];
});
$factory->state(App\Models\Department::class, 'client', function ($faker) {
return [
'name' => 'Client Services',
];
});
$factory->state(App\Models\Department::class, 'design', function ($faker) {
return [
'name' => 'Graphic Design',
];
});
$factory->state(App\Models\Department::class, 'product', function ($faker) {
return [
'name' => 'Product Management',
];
});
$factory->state(App\Models\Department::class, 'silly', function ($faker) {
return [
'name' => 'Dept of Silly Walks',
];
});
@@ -0,0 +1,41 @@
<?php
/*
|--------------------------------------------------------------------------
| Asset Model Factories
|--------------------------------------------------------------------------
|
| Factories related exclusively to creating models ..
|
*/
$factory->define(App\Models\Depreciation::class, function (Faker\Generator $faker) {
return [
'user_id' => 1,
];
});
$factory->state(App\Models\Depreciation::class, 'computer', function ($faker) {
return [
'name' => 'Computer Depreciation',
'months' => 36,
];
});
$factory->state(App\Models\Depreciation::class, 'display', function ($faker) {
return [
'name' => 'Display Depreciation',
'months' => 12,
];
});
$factory->state(App\Models\Depreciation::class, 'mobile-phones', function ($faker) {
return [
'name' => 'Mobile Phone Depreciation',
'months' => 24,
];
});
+79
View File
@@ -0,0 +1,79 @@
<?php
/*
|--------------------------------------------------------------------------
| Asset Model Factories
|--------------------------------------------------------------------------
|
| Factories related exclusively to creating models ..
|
*/
$factory->define(App\Models\License::class, function (Faker\Generator $faker) {
return [
'user_id' => 1,
'license_name' => $faker->name,
'license_email' => $faker->safeEmail,
'serial' => $faker->uuid,
'notes' => 'Created by DB seeder',
'purchase_date' => $faker->dateTimeBetween('-1 years','now', date_default_timezone_get()),
'order_number' => $faker->numberBetween(1000000, 50000000),
];
});
// 1
$factory->state(App\Models\License::class, 'photoshop', function ($faker) {
$data = [
'name' => 'Photoshop',
'manufacturer_id' => 9,
'purchase_cost' => '299.99',
'seats' => 10,
];
return $data;
});
// 2
$factory->state(App\Models\License::class, 'acrobat', function ($faker) {
$data = [
'name' => 'Acrobat',
'manufacturer_id' => 9,
'purchase_cost' => '29.99',
'seats' => 10,
];
return $data;
});
// 3
$factory->state(App\Models\License::class, 'indesign', function ($faker) {
$data = [
'name' => 'InDesign',
'manufacturer_id' => 9,
'purchase_cost' => '199.99',
'seats' => 10,
];
return $data;
});
// 4
$factory->state(App\Models\License::class, 'office', function ($faker) {
$data = [
'name' => 'Office',
'manufacturer_id' => 2,
'purchase_cost' => '49.99',
'seats' => 20,
];
return $data;
});
+123
View File
@@ -0,0 +1,123 @@
<?php
/*
|--------------------------------------------------------------------------
| Asset Model Factories
|--------------------------------------------------------------------------
|
| Factories related exclusively to creating models ..
|
*/
$factory->define(App\Models\Manufacturer::class, function (Faker\Generator $faker) {
return [
'user_id' => 1,
'support_phone' => $faker->phoneNumber(),
'url' => $faker->url(),
'support_email' => $faker->safeEmail(),
];
});
// 1
$factory->state(App\Models\Manufacturer::class, 'apple', function ($faker) {
return [
'name' => 'Apple',
'url' => 'https://apple.com',
'support_url' => 'https://support.apple.com'
];
});
// 2
$factory->state(App\Models\Manufacturer::class, 'microsoft', function ($faker) {
return [
'name' => 'Microsoft',
'url' => 'https://microsoft.com',
'support_url' => 'https://support.microsoft.com'
];
});
// 3
$factory->state(App\Models\Manufacturer::class, 'dell', function ($faker) {
return [
'name' => 'Dell',
'url' => 'https://dell.com',
'support_url' => 'https://support.dell.com'
];
});
// 4
$factory->state(App\Models\Manufacturer::class, 'asus', function ($faker) {
return [
'name' => 'Asus',
'url' => 'https://asus.com',
'support_url' => 'https://support.asus.com'
];
});
// 5
$factory->state(App\Models\Manufacturer::class, 'hp', function ($faker) {
return [
'name' => 'HP',
'url' => 'https://hp.com',
'support_url' => 'https://support.hp.com'
];
});
// 6
$factory->state(App\Models\Manufacturer::class, 'lenovo', function ($faker) {
return [
'name' => 'Lenovo',
'url' => 'https://lenovo.com',
'support_url' => 'https://support.lenovo.com'
];
});
// 7
$factory->state(App\Models\Manufacturer::class, 'lg', function ($faker) {
return [
'name' => 'LG',
'url' => 'https://lg.com',
'support_url' => 'https://support.lg.com'
];
});
// 8
$factory->state(App\Models\Manufacturer::class, 'polycom', function ($faker) {
return [
'name' => 'Polycom',
'url' => 'https://polycom.com',
'support_url' => 'https://support.polycom.com'
];
});
// 9
$factory->state(App\Models\Manufacturer::class, 'adobe', function ($faker) {
return [
'name' => 'Adobe',
'url' => 'https://adobe.com',
'support_url' => 'https://support.adobe.com'
];
});
// 10
$factory->state(App\Models\Manufacturer::class, 'avery', function ($faker) {
return [
'name' => 'Avery',
'url' => 'https://avery.com',
'support_url' => 'https://support.avery.com'
];
});
// 11
$factory->state(App\Models\Manufacturer::class, 'crucial', function ($faker) {
return [
'name' => 'Crucial',
'url' => 'https://crucial.com',
'support_url' => 'https://support.crucial.com'
];
});
+2 -115
View File
@@ -19,28 +19,6 @@ use App\Models\Manufacturer;
use App\Models\Statuslabel;
use App\Models\Supplier;
$factory->define(App\Models\Accessory::class, function (Faker\Generator $faker) {
return [
'company_id' => function () {
return factory(App\Models\Company::class)->create()->id;
},
'name' => $faker->text(20),
'category_id' => function () {
return factory(App\Models\Category::class)->states('accessory-category')->create()->id;
},
'manufacturer_id' => function () {
return factory(App\Models\Manufacturer::class)->create()->id;
},
'location_id' => function () {
return factory(App\Models\Location::class)->create()->id;
},
'order_number' => $faker->numberBetween(1000000, 50000000),
'purchase_date' => $faker->dateTime(),
'purchase_cost' => $faker->randomFloat(2),
'qty' => $faker->numberBetween(5, 10),
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
];
});
$factory->define(App\Models\Company::class, function (Faker\Generator $faker) {
return [
@@ -54,9 +32,7 @@ $factory->define(App\Models\Component::class, function (Faker\Generator $faker)
'category_id' => function () {
return factory(App\Models\Category::class)->create()->id;
},
'location_id' => function () {
return factory(App\Models\Location::class)->create()->id;
},
'location_id' => 1,
'serial' => $faker->uuid,
'qty' => $faker->numberBetween(3, 10),
'order_number' => $faker->numberBetween(1000000, 50000000),
@@ -69,94 +45,10 @@ $factory->define(App\Models\Component::class, function (Faker\Generator $faker)
];
});
$factory->define(App\Models\Consumable::class, function (Faker\Generator $faker) {
return [
'name' => $faker->text(20),
'company_id' => function () {
return factory(App\Models\Company::class)->create()->id;
},
'category_id' => function () {
return factory(App\Models\Category::class)->create()->id;
},
'location_id' => function () {
return factory(App\Models\Location::class)->create()->id;
},
'manufacturer_id' => function () {
return factory(App\Models\Manufacturer::class)->create()->id;
},
'user_id' => function () {
return factory(App\Models\User::class)->create()->id;
},
'model_number' => $faker->numberBetween(1000000, 50000000),
'item_no' => $faker->numberBetween(1000000, 50000000),
'order_number' => $faker->numberBetween(1000000, 50000000),
'purchase_date' => $faker->dateTime(),
'purchase_cost' => $faker->randomFloat(2),
'qty' => $faker->numberBetween(5, 10),
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
];
});
$factory->define(App\Models\Department::class, function (Faker\Generator $faker) {
return [
'name' => $faker->catchPhrase,
'user_id' => '1',
'location_id' => function () {
return factory(App\Models\Location::class)->create()->id;
},
'company_id' => function () {
return factory(App\Models\Company::class)->create()->id;
},
'manager_id' => function () {
return factory(App\Models\User::class)->create()->id;
},
];
});
$factory->define(App\Models\Depreciation::class, function (Faker\Generator $faker) {
return [
'name' => $faker->text(20),
'months' => $faker->numberBetween(1, 10),
];
});
$factory->define(App\Models\License::class, function (Faker\Generator $faker) {
return [
'name' => $faker->catchPhrase,
'serial' => $faker->uuid,
'seats' => $faker->numberBetween(1, 10),
'license_email' => $faker->safeEmail,
'license_name' => $faker->name,
'order_number' => $faker->numberBetween(1500, 13250),
'purchase_order' => $faker->numberBetween(1500, 13250),
'purchase_date' => $faker->dateTime(),
'purchase_cost' => $faker->randomFloat(2),
'notes' => $faker->sentence,
'supplier_id' => function () {
return factory(App\Models\Supplier::class)->create()->id;
},
'company_id' =>function () {
return factory(App\Models\Company::class)->create()->id;
},
];
});
$factory->define(App\Models\LicenseSeat::class, function (Faker\Generator $faker) {
return [
'license_id' => function () {
return factory(App\Models\License::class)->create()->id;
},
'created_at' => $faker->dateTime(),
'updated_at' => $faker->dateTime(),
'notes' => $faker->sentence,
'user_id' => '1',
];
});
$factory->define(App\Models\Location::class, function (Faker\Generator $faker) {
return [
'name' => $faker->catchPhrase,
'name' => $faker->city,
'address' => $faker->streetAddress,
'address2' => $faker->secondaryAddress,
'city' => $faker->city,
@@ -167,11 +59,6 @@ $factory->define(App\Models\Location::class, function (Faker\Generator $faker) {
];
});
$factory->define(App\Models\Manufacturer::class, function (Faker\Generator $faker) {
return [
'name' => $faker->company,
];
});
$factory->define(App\Models\Supplier::class, function (Faker\Generator $faker) {
return [
+31 -6
View File
@@ -2,12 +2,14 @@
use App\Models\Company;
$factory->define(App\Models\User::class, function (Faker\Generator $faker) {
return [
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'username' => $faker->username,
'password' => $faker->password,
'password' => bcrypt('password'),
'permissions' => '{"user":"0"}',
'email' => $faker->safeEmail,
'company_id' => function () {
@@ -15,14 +17,36 @@ $factory->define(App\Models\User::class, function (Faker\Generator $faker) {
},
'locale' => $faker->locale,
'employee_num' => $faker->numberBetween(3500, 35050),
'jobtitle' => $faker->word,
'jobtitle' => $faker->jobTitle,
'department_id' => rand(1,6),
'phone' => $faker->phoneNumber,
'notes' => $faker->sentence,
'location_id' => function () {
return factory(App\Models\Location::class)->create()->id;
},
'notes' => 'Created by DB seeder',
'location_id' => rand(1,5),
'activated' => 1,
];
});
$factory->state(App\Models\User::class, 'first-admin', function ($faker) {
return [
'first_name' => 'Admin',
'last_name' => 'User',
'username' => 'admin',
'permissions' => '{"superuser":"1"}',
];
});
$factory->state(App\Models\User::class, 'snipe-admin', function ($faker) {
return [
'first_name' => 'Snipe E.',
'last_name' => 'Head',
'username' => 'snipe',
'email' => 'snipe@snipe.net',
'permissions' => '{"superuser":"1"}',
];
});
// USER GLOBAL PERMISSION STATES
$factory->state(App\Models\User::class, 'superuser', function ($faker) {
return [
@@ -33,6 +57,7 @@ $factory->state(App\Models\User::class, 'superuser', function ($faker) {
$factory->state(App\Models\User::class, 'admin', function ($faker) {
return [
'permissions' => '{"admin":"1"}',
'manager_id' => rand(1,2),
];
});
// USER ASSET PERMISSION STATES
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AllowNullableDepreciationIdInModels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('models', function (Blueprint $table) {
$table->integer('depreciation_id')->nullable()->default(null)->change();
});
Schema::table('licenses', function (Blueprint $table) {
$table->integer('depreciation_id')->nullable()->default(null)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddDisplayUrlToSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->boolean('show_url_in_emails')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('show_url_in_emails');
});
}
}
+7 -2
View File
@@ -2,11 +2,16 @@
use Illuminate\Database\Seeder;
use App\Models\Accessory;
class AccessorySeeder extends Seeder
{
public function run()
{
Accessory::truncate();
factory(Accessory::class,15)->create();
Accessory::truncate();
DB::table('accessories_users')->truncate();
factory(Accessory::class, 1)->states('apple-usb-keyboard')->create();
factory(Accessory::class, 1)->states('apple-bt-keyboard')->create();
factory(Accessory::class, 1)->states('apple-mouse')->create();
factory(Accessory::class, 1)->states('microsoft-mouse')->create();
}
}
+2 -5
View File
@@ -7,10 +7,7 @@ class ActionlogSeeder extends Seeder
public function run()
{
Actionlog::truncate();
factory(Actionlog::class, 'asset-checkout',25)->create();
// factory(Actionlog::class, 'accessory-checkout',15)->create();
// factory(Actionlog::class, 'consumable-checkout', 15)->create();
// factory(Actionlog::class, 'component-checkout', 15)->create();
// factory(Actionlog::class, 'license-checkout-asset', 15)->create();
factory(Actionlog::class, 'asset-checkout-user',5)->create();
factory(Actionlog::class, 'asset-checkout-location',5)->create();
}
}
+32 -1
View File
@@ -8,7 +8,38 @@ class AssetModelSeeder extends Seeder
public function run()
{
AssetModel::truncate();
factory(AssetModel::class,5)->create();
// Laptops
factory(AssetModel::class, 1)->states('mbp-13-model')->create(); // 1
factory(AssetModel::class, 1)->states('mbp-air-model')->create(); // 2
factory(AssetModel::class, 1)->states('surface-model')->create(); // 3
factory(AssetModel::class, 1)->states('xps13-model')->create(); // 4
factory(AssetModel::class, 1)->states('spectre-model')->create(); // 5
factory(AssetModel::class, 1)->states('zenbook-model')->create(); // 6
factory(AssetModel::class, 1)->states('yoga-model')->create(); // 7
// Desktops
factory(AssetModel::class, 1)->states('macpro-model')->create(); // 8
factory(AssetModel::class, 1)->states('lenovo-i5-model')->create(); // 9
factory(AssetModel::class, 1)->states('optiplex-model')->create(); // 10
// Conference Phones
factory(AssetModel::class, 1)->states('polycom-model')->create(); // 11
factory(AssetModel::class, 1)->states('polycomcx-model')->create(); // 12
// Tablets
factory(AssetModel::class, 1)->states('ipad-model')->create(); // 13
factory(AssetModel::class, 1)->states('tab3-model')->create(); // 14
// Phones
factory(AssetModel::class, 1)->states('iphone6s-model')->create(); // 15
factory(AssetModel::class, 1)->states('iphone7-model')->create(); // 16
// Displays
factory(AssetModel::class, 1)->states('ultrafine')->create(); // 17
factory(AssetModel::class, 1)->states('ultrasharp')->create(); // 18
}
}
+27 -1
View File
@@ -8,6 +8,32 @@ class AssetSeeder extends Seeder
public function run()
{
Asset::truncate();
factory(Asset::class, 100)->create();
factory(Asset::class, 10)->states('laptop-mbp')->create();
factory(Asset::class, 5)->states('laptop-mbp-pending')->create();
factory(Asset::class, 5)->states('laptop-mbp-archived')->create();
factory(Asset::class, 10)->states('laptop-air')->create();
factory(Asset::class, 5)->states('laptop-surface')->create();
factory(Asset::class, 5)->states('laptop-xps')->create();
factory(Asset::class, 5)->states('laptop-spectre')->create();
factory(Asset::class, 5)->states('laptop-zenbook')->create();
factory(Asset::class, 3)->states('laptop-yoga')->create();
factory(Asset::class, 3)->states('desktop-macpro')->create();
factory(Asset::class, 3)->states('desktop-lenovo-i5')->create();
factory(Asset::class, 10)->states('desktop-optiplex')->create();
factory(Asset::class, 5)->states('conf-polycom')->create();
factory(Asset::class, 2)->states('conf-polycomcx')->create();
factory(Asset::class, 12)->states('tablet-ipad')->create();
factory(Asset::class, 4)->states('tablet-tab3')->create();
factory(Asset::class, 27)->states('phone-iphone6s')->create();
factory(Asset::class, 40)->states('phone-iphone7')->create();
factory(Asset::class, 10)->states('ultrafine')->create();
factory(Asset::class, 10)->states('ultrasharp')->create();
}
}
+14 -4
View File
@@ -7,10 +7,20 @@ class CategorySeeder extends Seeder
public function run()
{
Category::truncate();
factory(Category::class, 10)->states('asset-category')->create();
factory(Category::class, 10)->states('accessory-category')->create();
factory(Category::class, 10)->states('component-category')->create();
factory(Category::class, 10)->states('consumable-category')->create();
factory(Category::class, 1)->states('asset-laptop-category')->create(); // 1
factory(Category::class, 1)->states('asset-desktop-category')->create(); // 2
factory(Category::class, 1)->states('asset-tablet-category')->create(); // 3
factory(Category::class, 1)->states('asset-mobile-category')->create(); // 4
factory(Category::class, 1)->states('asset-display-category')->create(); // 5
factory(Category::class, 1)->states('asset-voip-category')->create(); // 6
factory(Category::class, 1)->states('asset-conference-category')->create(); // 7
factory(Category::class, 1)->states('accessory-keyboard-category')->create(); // 8
factory(Category::class, 1)->states('accessory-mouse-category')->create(); // 9
factory(Category::class, 1)->states('consumable-paper-category')->create(); // 10
factory(Category::class, 1)->states('consumable-ink-category')->create(); // 11
factory(Category::class, 1)->states('component-hdd-category')->create(); // 12
factory(Category::class, 1)->states('component-ram-category')->create(); // 13
}
}
+4 -1
View File
@@ -8,6 +8,9 @@ class ComponentSeeder extends Seeder
{
Component::truncate();
DB::table('components_assets')->truncate();
factory(Component::class, 10)->create();
factory(Component::class, 1)->states('ram-crucial4')->create(); // 1
factory(Component::class, 1)->states('ram-crucial8')->create(); // 1
factory(Component::class, 1)->states('ssd-crucial120')->create(); // 1
factory(Component::class, 1)->states('ssd-crucial240')->create(); // 1
}
}
+4 -1
View File
@@ -7,6 +7,9 @@ class ConsumableSeeder extends Seeder
public function run()
{
Consumable::truncate();
factory(Consumable::class, 25)->create();
DB::table('consumables_users')->truncate();
factory(Consumable::class, 1)->states('cardstock')->create(); // 1
factory(Consumable::class, 1)->states('paper')->create(); // 2
factory(Consumable::class, 1)->states('ink')->create(); // 3
}
}
+1 -1
View File
@@ -18,6 +18,7 @@ class DatabaseSeeder extends Seeder
$this->call(CategorySeeder::class);
$this->call(UserSeeder::class);
$this->call(DepreciationSeeder::class);
$this->call(DepartmentSeeder::class);
$this->call(ManufacturerSeeder::class);
$this->call(LocationSeeder::class);
$this->call(SupplierSeeder::class);
@@ -29,7 +30,6 @@ class DatabaseSeeder extends Seeder
$this->call(LicenseSeeder::class);
$this->call(ComponentSeeder::class);
$this->call(ConsumableSeeder::class);
$this->call(LicenseSeeder::class);
$this->call(ActionlogSeeder::class);
$this->call(CustomFieldSeeder::class);
+17
View File
@@ -0,0 +1,17 @@
<?php
use Illuminate\Database\Seeder;
use App\Models\Department;
class DepartmentSeeder extends Seeder
{
public function run()
{
Department::truncate();
factory(Department::class, 1)->states('hr')->create(); // 1
factory(Department::class, 1)->states('engineering')->create(); // 2
factory(Department::class, 1)->states('marketing')->create(); // 3
factory(Department::class, 1)->states('client')->create(); // 4
factory(Department::class, 1)->states('product')->create(); // 5
factory(Department::class, 1)->states('silly')->create(); // 6
}
}
+3 -1
View File
@@ -7,6 +7,8 @@ class DepreciationSeeder extends Seeder
public function run()
{
Depreciation::truncate();
factory(Depreciation::class, 5)->create();
factory(Depreciation::class, 1)->states('computer')->create(); // 1
factory(Depreciation::class, 1)->states('display')->create(); // 2
factory(Depreciation::class, 1)->states('mobile-phones')->create(); // 3
}
}
+4 -3
View File
@@ -8,9 +8,10 @@ class LicenseSeeder extends Seeder
public function run()
{
License::truncate();
factory(License::class, 10)->create();
LicenseSeat::truncate();
factory(LicenseSeat::class, 10)->create();
factory(License::class, 1)->states('photoshop')->create();
factory(License::class, 1)->states('acrobat')->create();
factory(License::class, 1)->states('indesign')->create();
factory(License::class, 1)->states('office')->create();
}
}
+11 -1
View File
@@ -7,6 +7,16 @@ class ManufacturerSeeder extends Seeder
public function run()
{
Manufacturer::truncate();
factory(Manufacturer::class, 10)->create();
factory(Manufacturer::class, 1)->states('apple')->create(); // 1
factory(Manufacturer::class, 1)->states('microsoft')->create(); // 2
factory(Manufacturer::class, 1)->states('dell')->create(); // 3
factory(Manufacturer::class, 1)->states('asus')->create(); // 4
factory(Manufacturer::class, 1)->states('hp')->create(); // 5
factory(Manufacturer::class, 1)->states('lenovo')->create(); // 6
factory(Manufacturer::class, 1)->states('lg')->create(); // 7
factory(Manufacturer::class, 1)->states('polycom')->create(); // 8
factory(Manufacturer::class, 1)->states('adobe')->create(); // 9
factory(Manufacturer::class, 1)->states('avery')->create(); // 10
}
}
+40 -2
View File
@@ -12,7 +12,45 @@ class UserSeeder extends Seeder
*/
public function run()
{
// Don't truncate the user column, that might suck.
factory(User::class, 10)->create();
User::truncate();
factory(User::class, 1)->states('first-admin')->create();
factory(User::class, 1)->states('snipe-admin')->create();
factory(User::class, 3)->states('superuser')->create();
factory(User::class, 3)->states('admin')->create();
factory(User::class, 1)->states('view-assets')->create();
// factory(User::class, 1)->states('create-assets')->create();
// factory(User::class, 1)->states('edit-assets')->create();
// factory(User::class, 1)->states('delete-assets')->create();
// factory(User::class, 1)->states('checkin-assets')->create();
// factory(User::class, 1)->states('checkout-assets')->create();
// factory(User::class, 1)->states('view-requestable-assets')->create();
// factory(User::class, 1)->states('view-accessories')->create();
// factory(User::class, 1)->states('create-accessories')->create();
// factory(User::class, 1)->states('view-accessories')->create();
// factory(User::class, 1)->states('delete-accessories')->create();
// factory(User::class, 1)->states('edit-accessories')->create();
// factory(User::class, 1)->states('checkout-accessories')->create();
// factory(User::class, 1)->states('checkin-accessories')->create();
// factory(User::class, 1)->states('view-consumables')->create();
// factory(User::class, 1)->states('create-consumables')->create();
// factory(User::class, 1)->states('edit-consumables')->create();
// factory(User::class, 1)->states('delete-consumables')->create();
// factory(User::class, 1)->states('checkout-consumables')->create();
// factory(User::class, 1)->states('view-licenses')->create();
// factory(User::class, 1)->states('edit-licenses')->create();
// factory(User::class, 1)->states('delete-licenses')->create();
// factory(User::class, 1)->states('create-licenses')->create();
// factory(User::class, 1)->states('checkout-licenses')->create();
// factory(User::class, 1)->states('view-keys-licenses')->create();
// factory(User::class, 1)->states('view-components')->create();
// factory(User::class, 1)->states('edit-components')->create();
// factory(User::class, 1)->states('create-components')->create();
// factory(User::class, 1)->states('delete-components')->create();
// factory(User::class, 1)->states('checkout-components')->create();
// factory(User::class, 1)->states('checkin-components')->create();
// factory(User::class, 1)->states('view-users')->create();
// factory(User::class, 1)->states('edit-users')->create();
// factory(User::class, 1)->states('delete-users')->create();
// factory(User::class, 1)->states('create-users')->create();
}
}
+8 -2
View File
@@ -1,7 +1,13 @@
# ensure running as root
if [ "$(id -u)" != "0" ]; then
exec sudo "$0" "$@"
#Debian doesnt have sudo if root has a password.
if ! hash sudo 2>/dev/null; then
exec su -c "$0" "$@"
else
exec sudo "$0" "$@"
fi
fi
wget https://raw.githubusercontent.com/snipe/snipe-it/master/snipeit.sh
chmod 744 snipeit.sh
sudo ./snipeit.sh 2>&1 | sudo tee -a /var/log/snipeit-install.log
./snipeit.sh 2>&1 | tee -a /var/log/snipeit-install.log
+6 -4
View File
File diff suppressed because one or more lines are too long
+26 -26
View File
File diff suppressed because one or more lines are too long
+7 -12
View File
@@ -18,8 +18,7 @@
data-toggle="modal" - required for Bootstrap Modals
data-target="#createModal" - fixed ID for the modal, do not change
data-dependency="user" - which Snipe-IT model you're going to be creating.
data-select="assigned_to" - What is the *ID* of the select-dropdown that you're going to be adding to, if the modal-create was a
success? Be on the lookout for duplicate ID's, it will confuse this library!
data-select="assigned_to" - What is the *ID* of the select-dropdown that you're going to be adding to, if the modal-create was a success? Be on the lookout for duplicate ID's, it will confuse this library!
class="btn btn-sm btn-default" - makes it look button-ey, feel free to change :)
*/
@@ -37,8 +36,6 @@
var link = $(event.relatedTarget);
model = link.data("dependency");
select = link.data("select");
// console.warn("Uh, href is: "+link.attr('href'));
// console.dir(link);
$('#createModal').load(link.attr('href'),function () {
//do we need to re-select2 this, after load? Probably.
$('#createModal').find('select.select2').select2();
@@ -47,11 +44,9 @@
$('#createModal').on('click','#modal-save', function () {
console.warn("MODAL SAVE CALLED FOR MODAL!");
var data = {};
console.warn("We are about to SAVE!!! for model: "+model+" and select ID: "+select);
$('.modal-body input:visible').each(function (index, elem) {
console.warn("["+index+"]: "+elem.id+" = "+$(elem).val());
var bits = elem.id.split("-");
if (bits[0] === "modal") {
data[bits[1]] = $(elem).val();
@@ -64,11 +59,11 @@
});
data._token = Laravel.csrfToken;
console.log(data);
//console.log(data);
$.ajax({
type: 'POST',
url: "/api/v1/" + model + "s",
url: "../api/v1/" + model + "s",
headers: {
"X-Requested-With": 'XMLHttpRequest',
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
@@ -100,15 +95,15 @@
// this code adds the newly created object to that select
var selector = document.getElementById(select);
if(!selector) {
console.error("Could not find original <select> element with an id of: "+select);
// console.error("Could not find original <select> element with an id of: "+select);
return false;
}
//console.log(document.getElementById(select));
console.dir(selector);
// console.dir(selector);
selector.options[selector.length] = new Option(name, id);
selector.selectedIndex = selector.length - 1;
$(selector).trigger("change");
if(fetchCustomFields) {
if(window.fetchCustomFields) {
fetchCustomFields();
}
@@ -124,4 +119,4 @@
});
});
});
});
+15 -15
View File
@@ -1,22 +1,22 @@
<?php
return array(
'about_accessories_title' => 'About Accessories',
'about_accessories_text' => 'Accessories are anything you issue to users but that do not have a serial number (or you do not care about tracking them uniquely). For example, computer mice or keyboards.',
'accessory_category' => 'Accessory Category',
'accessory_name' => 'Accessory Name',
'about_accessories_title' => 'Oor Toebehore',
'about_accessories_text' => 'Toebehore is enigiets wat jy aan gebruikers uitreik, maar dit het nie \'n reeksnommer (of jy gee nie om om hulle unieke te volg nie). Byvoorbeeld, rekenaarmuise of sleutelborde.',
'accessory_category' => 'Toebehore Kategorie',
'accessory_name' => 'Toebehore Naam',
'checkout' => 'Checkout Accessory',
'checkin' => 'Checkin Accessory',
'create' => 'Create Accessory',
'edit' => 'Edit Accessory',
'eula_text' => 'Category EULA',
'eula_text_help' => 'This field allows you to customize your EULAs for specific types of assets. If you only have one EULA for all of your assets, you can check the box below to use the primary default.',
'require_acceptance' => 'Require users to confirm acceptance of assets in this category.',
'no_default_eula' => 'No primary default EULA found. Add one in Settings.',
'total' => 'Total',
'remaining' => 'Avail',
'update' => 'Update Accessory',
'use_default_eula' => 'Use the <a href="#" data-toggle="modal" data-target="#eulaModal">primary default EULA</a> instead.',
'use_default_eula_disabled' => '<del>Use the primary default EULA instead.</del> No primary default EULA is set. Please add one in Settings.',
'create' => 'Skep bykomstighede',
'edit' => 'Wysig bykomstighede',
'eula_text' => 'Kategorie EULA',
'eula_text_help' => 'Hierdie veld laat u toe om u EULA\'s vir spesifieke soorte bates aan te pas. As u slegs een EULA vir al u bates het, kan u die onderstaande boks selekteer om die primêre standaard te gebruik.',
'require_acceptance' => 'Vereis gebruikers om die aanvaarding van bates in hierdie kategorie te bevestig.',
'no_default_eula' => 'Geen primêre standaard EULA gevind nie. Voeg een by Instellings.',
'total' => 'totale',
'remaining' => 'opgelewer',
'update' => 'Opdatering bywerk',
'use_default_eula' => 'Gebruik eerder die <a href="#" data-toggle="modal" data-target="#eulaModal">primary standaard EULA</a>.',
'use_default_eula_disabled' => '<del>Gebruik die primêre standaardverlof in plaas daarvan.</del> Geen primêre standaard EULA is ingestel nie. Voeg asseblief een by Instellings.',
);
+15 -15
View File
@@ -2,35 +2,35 @@
return array(
'does_not_exist' => 'The accessory does not exist.',
'assoc_users' => 'This accessory currently has :count items checked out to users. Please check in the accessories and and try again. ',
'does_not_exist' => 'Die accessoire bestaan nie.',
'assoc_users' => 'Hierdie bykomstige het tans: tel items wat uitgekontroleer is aan gebruikers. Kontroleer asseblief die bykomstighede en en probeer weer.',
'create' => array(
'error' => 'The accessory was not created, please try again.',
'success' => 'The accessory was successfully created.'
'error' => 'Die bykomstigheid is nie geskep nie, probeer asseblief weer.',
'success' => 'Die bykomstigheid is suksesvol geskep.'
),
'update' => array(
'error' => 'The accessory was not updated, please try again',
'success' => 'The accessory was updated successfully.'
'error' => 'Die bykomstigheid is nie opgedateer nie, probeer asseblief weer',
'success' => 'Die bykomstigheid is suksesvol opgedateer.'
),
'delete' => array(
'confirm' => 'Are you sure you wish to delete this accessory?',
'error' => 'There was an issue deleting the accessory. Please try again.',
'success' => 'The accessory was deleted successfully.'
'confirm' => 'Is jy seker jy wil hierdie toebehore uitvee?',
'error' => 'Daar was \'n probleem met die verwydering van die bykomstigheid. Probeer asseblief weer.',
'success' => 'Die bykomstigheid is suksesvol verwyder.'
),
'checkout' => array(
'error' => 'Accessory was not checked out, please try again',
'success' => 'Accessory checked out successfully.',
'user_does_not_exist' => 'That user is invalid. Please try again.'
'error' => 'Toebehore is nie nagegaan nie, probeer asseblief weer',
'success' => 'Toebehore suksesvol nagegaan.',
'user_does_not_exist' => 'Die gebruiker is ongeldig. Probeer asseblief weer.'
),
'checkin' => array(
'error' => 'Accessory was not checked in, please try again',
'success' => 'Accessory checked in successfully.',
'user_does_not_exist' => 'That user is invalid. Please try again.'
'error' => 'Toebehore is nie nagegaan nie, probeer asseblief weer',
'success' => 'Toebehore is suksesvol nagegaan.',
'user_does_not_exist' => 'Die gebruiker is ongeldig. Probeer asseblief weer.'
)
@@ -1,11 +1,11 @@
<?php
return array(
'dl_csv' => 'Download CSV',
'dl_csv' => 'Laai CSV af',
'eula_text' => 'EULA',
'id' => 'ID',
'require_acceptance' => 'Acceptance',
'title' => 'Accessory Name',
'require_acceptance' => 'aanvaarding',
'title' => 'Toebehore Naam',
);
@@ -1,14 +1,14 @@
<?php
return [
'asset_maintenance_type' => 'Maintenance Type',
'title' => 'Title',
'start_date' => 'Started',
'completion_date' => 'Completed',
'cost' => 'Cost',
'is_warranty' => 'Warranty Improvement',
'asset_maintenance_time' => 'Days',
'notes' => 'Notes',
'update' => 'Update',
'create' => 'Create'
'asset_maintenance_type' => 'Onderhoudstipe',
'title' => 'Titel',
'start_date' => 'begin',
'completion_date' => 'voltooi',
'cost' => 'koste',
'is_warranty' => 'Garantieverbetering',
'asset_maintenance_time' => 'dae',
'notes' => 'notas',
'update' => 'Opdateer',
'create' => 'Skep'
];

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