mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Merge pull request #2052 from dmeltzer/remove-sentry-from-importer
Get Rid of sentry code in importer
This commit is contained in:
commit
486d74fa64
|
@ -249,7 +249,7 @@ class ObjectImportCommand extends Command {
|
||||||
return $category;
|
return $category;
|
||||||
} else {
|
} else {
|
||||||
$this->comment('Something went wrong! Category ' . $asset_category . ' was NOT created');
|
$this->comment('Something went wrong! Category ' . $asset_category . ' was NOT created');
|
||||||
dd($asset_category);
|
dd($category);
|
||||||
return $category;
|
return $category;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -440,26 +440,28 @@ class ObjectImportCommand extends Command {
|
||||||
|
|
||||||
// A number was given instead of a name
|
// A number was given instead of a name
|
||||||
if (is_numeric($user_name)) {
|
if (is_numeric($user_name)) {
|
||||||
$this->comment('User ' . $user_name . ' is a number - Assuming UID - hopefully this user already exists');
|
$this->comment('User '.$user_name.' is not a name - assume this user already exists');
|
||||||
$user_username = '';
|
$user_username = '';
|
||||||
|
$first_name = '';
|
||||||
|
$last_name = '';
|
||||||
|
|
||||||
// No name was given
|
// No name was given
|
||||||
} elseif (empty($user_name)) {
|
} elseif (empty($user_name)) {
|
||||||
$this->comment('No user data provided - skipping user creation, just adding asset');
|
$this->comment('No user data provided - skipping user creation, just adding asset');
|
||||||
$first_name = '';
|
$first_name = '';
|
||||||
$last_name = '';
|
$last_name = '';
|
||||||
|
//$user_username = '';
|
||||||
} else {
|
} else {
|
||||||
$user_email_array = User::generateFormattedNameFromFullName($this->option('email_format'), $user_name);
|
$user_email_array = User::generateFormattedNameFromFullName($this->option('email_format'), $user_name);
|
||||||
$first_name = $user_email_array['first_name'];
|
$first_name = $user_email_array['first_name'];
|
||||||
$last_name = $user_email_array['last_name'];
|
$last_name = $user_email_array['last_name'];
|
||||||
|
|
||||||
if (empty($user_email)) {
|
if ($user_email=='') {
|
||||||
$user_email = $user_email_array['username'] . '@' . Config::get('app.domain');
|
$user_email = $user_email_array['username'].'@'.config('app.domain');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($user_username)) {
|
if ($user_username=='') {
|
||||||
if ($this->option('username_format') == 'email') {
|
if ($this->option('username_format')=='email') {
|
||||||
$user_username = $user_email;
|
$user_username = $user_email;
|
||||||
} else {
|
} else {
|
||||||
$user_name_array = User::generateFormattedNameFromFullName($this->option('username_format'), $user_name);
|
$user_name_array = User::generateFormattedNameFromFullName($this->option('username_format'), $user_name);
|
||||||
|
@ -479,40 +481,33 @@ class ObjectImportCommand extends Command {
|
||||||
|
|
||||||
if($this->option('testrun'))
|
if($this->option('testrun'))
|
||||||
return new User;
|
return new User;
|
||||||
|
|
||||||
if (!empty($user_username)) {
|
if (!empty($user_username)) {
|
||||||
if ($user = User::MatchEmailOrUsername($user_username, $user_email)
|
if ($user = User::MatchEmailOrUsername($user_username, $user_email)
|
||||||
->whereNotNull('username')->first()
|
->whereNotNull('username')->first()) {
|
||||||
) {
|
$this->comment('User '.$user_username.' already exists');
|
||||||
$this->comment('User ' . $user_username . ' already exists');
|
|
||||||
return $user;
|
|
||||||
} else {
|
} else {
|
||||||
// Create the user
|
$user = new \App\Models\User;
|
||||||
$user = Sentry::createUser(array(
|
$password = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
|
||||||
'first_name' => $first_name,
|
|
||||||
'last_name' => $last_name,
|
|
||||||
'email' => $user_email,
|
|
||||||
'username' => $user_username,
|
|
||||||
'password' => substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 12),
|
|
||||||
'activated' => true,
|
|
||||||
'permissions' => array(
|
|
||||||
'admin' => 0,
|
|
||||||
'user' => 1,
|
|
||||||
),
|
|
||||||
'notes' => 'User imported through asset importer'
|
|
||||||
));
|
|
||||||
|
|
||||||
// Find the group using the group id
|
$user->first_name = $first_name;
|
||||||
$userGroup = Sentry::findGroupById(3);
|
$user->last_name = $last_name;
|
||||||
|
$user->username = $user_username;
|
||||||
|
$user->email = $user_email;
|
||||||
|
$user->password = bcrypt($password);
|
||||||
|
$user->activated = 1;
|
||||||
|
if ($user->save()) {
|
||||||
|
$this->comment('User '.$first_name.' created');
|
||||||
|
} else {
|
||||||
|
$this->error('ERROR CREATING User '.$first_name.' '.$last_name);
|
||||||
|
$this->error($user->getErrors());
|
||||||
|
}
|
||||||
|
|
||||||
// Assign the group to the user
|
|
||||||
$user->addGroup($userGroup);
|
|
||||||
$this->comment('User ' . $first_name . ' created');
|
|
||||||
return $user;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$user = new User;
|
$user = new User;
|
||||||
return $user;
|
|
||||||
}
|
}
|
||||||
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
private $assets;
|
private $assets;
|
||||||
|
|
51
public/sample.csv
Normal file
51
public/sample.csv
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
Item Type,Name,Email,User Name,Item Name,Category,Model Name,Manufacturer,Model Number,Serial Number,Asset Tag,Location,Notes,Purchase Date,Purchase Cost
|
||||||
|
Asset,William Dixon,miranda@selfware.ch,,Bleghjgd,Malesuada,Et,Nisi,5,4D47A5B7-007D-47F3-B1F2-28C33D3F2C54,58SG1MLI,"Tanzania, United Republic of",Accumsan condimentum sed purus ante mauris tincidunt aliquam libero tempor arcu posuere curabitur sodales imperdiet.,2/16/13,892.46
|
||||||
|
Asset,Debbie Mullins,jesper@madefeed.cf,,KJhkjfhk,At,Platea,Torquent,9,6DEC0B69-32DB-4801-81FA-07C58E5386CC,FIM4P54T,Isle of Man,Sodales enim duis egestas turpis arcu justo aliquam ipsum erat in cursus iaculis taciti nullam.,4/12/10,961.03
|
||||||
|
Asset,Wolfgang Mitchell,kirk@tagbase.kp,,Test Item 6,Id,Vel,Eu,5,D4017718-D68C-40EC-8669-52745A34B048,SY4NFU7S,Cook Islands,Ac platea nunc nibh in nibh eu arcu eu felis congue nibh aenean morbi quis scelerisque.,4/29/14,771.68
|
||||||
|
Asset,Anne-Marie Wallace,le@tidything.ac,,Test Item 7,Morbi,Sociosqu,Nisl,5,56CC5079-F44B-4D62-BC45-1A4CA4FB8C9F,SK6VTSTG,Uruguay,Nostra ut mauris consectetuer donec scelerisque est per pellentesque nec id urna magna.,8/18/14,325.22
|
||||||
|
Asset,Shane Booker,alain@quitsource.pa,,Test Item 8,Fusce,Fermentum,Sagittis,7,ED248E82-046B-4046-84DA-E4F4A0B55D0E,DBEUH6H2,Cura¥Ë__ao,Sed magna inceptos fames ultrices per ut eleifend tellus in class.,10/12/12,951.21
|
||||||
|
Asset,Olivier Walter,margaret@quitbot.tf,,Test Item 9,Malesuada,Et,Nisi,6,FC741D83-3F19-4259-94EC-FFAB3C15C747,40SI9NUR,El Salvador,Orci tortor sed vestibulum nec imperdiet vivamus ridiculus feugiat neque ut pellentesque felis.,8/14/11,368.9
|
||||||
|
Asset,Adrian Montgomery,welch@busybeat.kp,,Test Item 10,Malesuada,Et,Nisi,6,E8E3709B-377E-4FC7-B1B7-1DE0EE60798B,LUXLI88S,Bosnia and Herzegovina,Dapibus scelerisque tempor nisl nascetur dictum vulputate mi.,9/2/13,276.77
|
||||||
|
Asset,Joan Merrill,massey@jetwords.at,,Test Item 11,Malesuada,Et,Nisi,6,3D862DC2-74B5-4744-8D8B-41A757927EB8,ENAZFLV3,Tonga,Malesuada felis accumsan gravida sagittis lacinia pede orci nulla magna litora augue orci.,8/31/14,123.23
|
||||||
|
Asset,Stella Gilmore,wright@quitsource.jp,,Test Item 12,Malesuada,Et,Nisi,5,1E420152-929A-4363-8864-7DE01D38BDE0,8JS4P5P2,Uruguay,Magna in interdum consectetuer consequat tristique dapibus class nulla quis massa dictumst ipsum imperdiet.,4/22/12,333.44
|
||||||
|
Asset,Georgina Wiley,rivera@lowwerk.lv,,Test Item 13,Urna,Et,Integer,10,6E668691-2560-4E3D-89D4-1CDB7404BB8F,J3KHF9EK,Georgia,Consequat non per viverra porta torquent in non et suspendisse bibendum scelerisque sapien mi elit nostra imperdiet.,12/16/14,588.07
|
||||||
|
Asset,Barry Hudson,jane@tagbot.tc,,Test Item 14,Nam,Vivamus,Nibh,5,26825937-9579-4B57-9678-0659A2BB75D7,1V1WQAZA,Poland,Molestie tortor posuere duis lacus feugiat nibh mollis pellentesque nibh mollis tincidunt nisl ut inceptos ac pretium.,4/7/13,839.61
|
||||||
|
Asset,Leigh Stewart,jim.douglas@quitpower.si,,Test Item 15,In,Mauris,Et,9,F5A3666A-951B-46FD-84AF-C0B36BE34243,8PU2UCVH,Uzbekistan,Praesent lectus amet fusce a aliquet pellentesque justo etiam vulputate nec.,3/17/14,724.88
|
||||||
|
Asset,Travis Flynn,nigel.blackburn@gigabase.md,,Test Item 16,Nonummy,Mattis,Justo,7,008A88C0-355D-40F9-B601-7478901147E4,8O77P76Z,Hungary,Massa suscipit porta sapien purus quis metus quis vivamus curae; suspendisse ut imperdiet dapibus.,4/3/12,625.79
|
||||||
|
Asset,Edward Park,sanders@madeclicks.travel,,Test Item 17,Nonummy,Mattis,Justo,9,228F09D4-F8A4-4453-BD7F-6FDB4FCFCE0A,FNKJCPIY,Uzbekistan,Neque eu non a felis enim turpis eget mauris lorem.,6/22/12,122.28
|
||||||
|
Asset,Stig Molina,lester@getdesk.at,,Test Item 18,Nonummy,Mattis,Justo,9,BA720380-E958-4D09-8EF2-D5B6FDF0736C,C4DXBUKJ,Georgia,Mollis ut sapien in id pede gravida ante eu nisl aenean ullamcorper potenti nulla parturient nam quisque.,7/10/13,178.12
|
||||||
|
Asset,Bruce Watts,ali.hobbs@gigawerk.gu,,Test Item 19,Nonummy,Mattis,Justo,7,2AF6BE26-EB5F-4745-8822-D54B3536EF9E,W9PO94OR,Finland,Ante facilisis ullamcorper eleifend enim quam justo vestibulum.,8/26/15,583.97
|
||||||
|
Asset,Lincoln Soto,michelle.daniel@presssource.sk,,Test Item 20,Nonummy,Mattis,Justo,5,913AEF6D-547C-41DD-9128-2A6FEF5E5118,9DOEWENU,Benin,Sociis aptent ipsum leo sodales mattis leo sociosqu at amet ligula.,6/22/11,581.01
|
||||||
|
Asset,Camilla Morrison,charles@chatspace.th,,Test Item 21,Ad,Elit,Ullamcorper,7,2ACA4B3C-A619-48AF-9530-8B581E5F9DBA,2AF7QYGX,Uzbekistan,Molestie quis placerat magna turpis iaculis eget nam massa sit congue erat hac habitant lacinia nibh.,2/28/15,492.81
|
||||||
|
Asset,Josie English,stafford@rollthing.nf,,Test Item 22,Eu,Aliquam,Enim,7,34302A6E-CB8F-4691-9D9B-845887D0F5B2,Q7ALASVU,Botswana,Rhoncus hymenaeos sed torquent vestibulum nec mauris id nulla nibh purus purus donec vel nibh morbi.,7/15/13,441.14
|
||||||
|
Asset,Alia Salazar,johan.cook@pressbit.ai,,Test Item 23,Ipsum,Velit,Magna,9,E429BE64-8E1B-4C8F-BB31-C4B2F2754C3C,HKZ2HG9E,New Caledonia,Sed praesent sed rutrum massa suscipit magna mauris interdum massa.,3/28/13,384.99
|
||||||
|
Asset,Beth Sweeney,coral.le@chatsource.dj,,Test Item 24,Ipsum,Velit,Magna,8,3FC9CF5F-EBCC-4482-8F0D-7F99EE2911A4,UM5HO5SD,Vanuatu,Aliquet porttitor elit sagittis mauris nibh rutrum tristique nunc erat mauris per integer nostra imperdiet.,9/2/15,575.23
|
||||||
|
Asset,Stig Bender,lydia@rollsimple.tp,,Test Item 25,Ipsum,Velit,Magna,9,A39EB068-99C6-4377-AB3F-CACC83E083D1,NHYLZ75J,Burundi,Lobortis morbi massa praesent eu ac ad ut nunc aliquam neque scelerisque est fermentum eget elit aenean.,11/29/09,277.87
|
||||||
|
Asset,Angelique Lindsay,villarreal@selfserv.sg,,Test Item 26,Ipsum,Velit,Magna,6,EA864247-21AF-44C9-96CC-D6900C599740,PZ9MMXYD,Lithuania,Id eu molestie adipiscing phasellus duis imperdiet aliquam conubia ligula eget morbi.,8/14/14,552.75
|
||||||
|
Asset,Guillermo Black,raimonds@gigadesk.bd,,Test Item 27,Id,Class,Laoreet,5,543C547F-91CD-4AFD-AFBF-2E2B68FD514D,M3VRKBBJ,Equatorial Guinea,Egestas pretium sollicitudin suspendisse erat sem massa adipiscing eu tempor libero sollicitudin a curabitur mauris.,1/1/14,582.02
|
||||||
|
Asset,Christof Castaneda,campos@fuelserv.bg,,Test Item 28,Eget,Congue,Nisi,6,CAB3E433-8409-475C-8EA0-2801C22B2C2B,B0CGYUG7,Syrian Arab Republic,Feugiat facilisis consequat sociosqu ac consequat lacinia consectetuer tellus leo.,12/2/14,487.02
|
||||||
|
Asset,Chloe Chen,antony@busybase.eu,,Test Item 29,Quis,Tincidunt,Aliquam,7,E3862315-B49C-4EF6-B465-A93FF320A3EC,BTEBYEBS,Greenland,Et suscipit lectus nec morbi tristique mi in nunc tincidunt.,12/26/09,366.24
|
||||||
|
Asset,Andreas McCann,bjorn@jetwerk.hn,,Test Item 30,Non,Ultrices,Congue,10,6F3B60E9-29B0-4421-8EF1-864C8318D20A,JPV00X2A,Estonia,Quis morbi eu sit mollis ad purus consectetuer consectetuer aliquam.,7/15/15,591.28
|
||||||
|
Asset,Owen Buckley,dragan.graves@quitdesk.cg,,Test Item 31,Aliquam,Lacinia,Phasellus,6,52D97856-9714-4A13-9C64-A7E3028F3D64,HWH8ZXSN,"Saint Helena, Ascension and Tristan Da Cunha",Aliquam semper hac sit suspendisse mollis ligula volutpat sociosqu mi conubia porta lorem velit.,4/11/13,837.92
|
||||||
|
Asset,Damian Serrano,arnold.henderson@earlybeat.cz,,Test Item 32,Aliquam,Lacinia,Phasellus,8,0D2E368D-83D4-4FCC-B583-F4F3750E8594,ICRKS93T,Hong Kong,Aliquet ante dui nec tempus a semper nisi non porttitor nisi magna cursus tellus facilisis cras massa.,11/30/10,856.89
|
||||||
|
Asset,Vicky Petty,tobias@tagbase.hk,,Test Item 33,Accumsan,Lacinia,Enim,9,0A3AF79E-C848-4B7D-9B3E-AAD853908643,MC7RH905,Bahrain,Metus imperdiet suspendisse velit integer consectetuer purus per quisque.,11/19/15,285.9
|
||||||
|
Asset,Reginald Wong,adrian@fuellive.hu,,Test Item 34,Et,In,Non,5,DAC224E4-858F-4824-9AB4-B32F8CAAD4B5,VRNKD7KV,Nicaragua,Class vulputate amet semper duis taciti libero morbi etiam tortor primis.,8/15/12,287.21
|
||||||
|
Asset,Belinda Gillespie,claudio.potts@rollblog.nz,,Test Item 35,A,Consectetuer,Hac,10,699E97C0-9631-4207-9123-51990D860E54,ABWLPV48,Albania,Hac sociosqu ad lacinia bibendum sed rutrum sodales diam nisl mauris et quisque.,2/20/11,141.62
|
||||||
|
Asset,Isidro Kelly,guillermo@madewerk.ca,,Test Item 36,Tristique,Sit,Mollis,10,B2E06E00-E797-4082-878F-0A584B583267,ORVTFDS1,Japan,Quis leo porta dui mi mattis enim ligula lectus tincidunt scelerisque dolor a quis libero venenatis class.,4/2/15,936.24
|
||||||
|
Asset,Kris Carlson,ballard@getserv.nr,,Test Item 37,Elit,Quam,Magna,5,3D3B156A-C8E5-4F44-8271-231E5647234A,WYPZ7TL0,Cuba,Diam eu tellus curabitur augue mollis volutpat dictumst tellus non tempor non ultrices nostra egestas.,1/8/12,945.01
|
||||||
|
Asset,Ivo May,ilia.dunlap@rollsource.af,,Test Item 38,Gravida,Mauris,Vivamus,9,033374F0-E202-4DD4-8909-3A376E94AAE3,AIMB2QVF,Paraguay,Ornare sem purus ad sapien egestas vulputate nec.,11/16/15,735.17
|
||||||
|
Asset,Valery Bailey,jenkins@tagclicks.gt,,Test Item 39,Magna,Ante,Erat,8,8405FCDC-423C-4780-85A2-763B76F8E3E6,MTKQNQQ1,United States,Pellentesque sit curabitur cras felis eu ipsum sapien mattis suspendisse taciti tellus bibendum nulla nec.,9/20/14,871.22
|
||||||
|
Asset,Edna Hunt,huynh@busybase.sh,,Test Item 40,Aliquam,Lacinia,Phasellus,9,CDD32EE0-5C1B-43E0-AD2C-AC70A7E49A5F,6PLCX7HA,Israel,Magna interdum lectus lacus ac pede duis class donec auctor tristique pulvinar aliquam adipiscing.,6/22/13,579.79
|
||||||
|
Asset,Debbie Padilla,anderson@fussbit.do,,Test Item 41,Aliquam,Lacinia,Phasellus,6,1AE18842-F09E-4080-B269-B2222E265A07,L9JOMH1V,Pitcairn,Elementum nibh arcu mauris lacus nisl magnis nibh sollicitudin ligula proin.,4/12/14,821.68
|
||||||
|
Asset,Michael Carlson,russell.blake@tagserv.tt,,Test Item 42,Dui,Justo,Vitae,8,184393AC-818C-411F-9835-382556AF6699,A2I31GTM,Canada,Sollicitudin id massa consectetuer at mauris ipsum amet sapien.,5/23/15,654.99
|
||||||
|
Asset,Jay Marsh,jorgen@putbase.mz,,Test Item 43,Curae,Mollis,Elit,6,869A8F25-968F-4D02-A19F-765FE6AE8C84,0Z95CGIA,"Tanzania, United Republic of",Varius lacinia in nunc sit placerat posuere inceptos nibh.,11/27/15,694.94
|
||||||
|
,Lawrence Golden,clay@jetlive.ms,,Test Item 44,Consequat,Nibh,Nisi,8,178AEFF6-3CC9-4696-A819-2EDFBEF029D4,KL16BDUD,Afghanistan,Lorem a nisi nibh est tempor a etiam gravida neque pellentesque pharetra condimentum metus suspendisse at.,1/16/13,923.12
|
||||||
|
,Jean Paul Mayer,salazar@shutsphere.fo,,Test Item 45,Sit,Aliquam,Nunc,10,6D3F66BE-5AA1-4433-B6A9-340D84EAB6A9,V44K0F6X,Chile,Duis eu aliquam massa lorem aptent ligula eleifend vivamus mollis malesuada ac fusce est massa nostra non.,3/18/12,433.79
|
||||||
|
,Kieran McIntyre,daisy.dunlap@selfware.ca,,Test Item 46,Proin,Cursus,Justo,9,745D1136-623A-4AEE-A884-4689614CD977,4Y0JJQTL,French Southern Territories,Nibh sodales nulla adipiscing congue turpis facilisis eu quis libero cursus.,1/11/15,671.09
|
||||||
|
,Amy Singleton,almir.carson@putunit.gn,,Test Item 47,Litora,Quis,Nulla,10,FA7D5D32-9815-4073-93A3-50F1E82967B5,FLS5TGG8,Trinidad and Tobago,Mus elit in posuere nibh tincidunt sociis aliquet tristique morbi at imperdiet turpis.,11/20/10,794.63
|
||||||
|
,Justine Buck,sharon@tidyware.nf,,Test Item 48,Bibendum,Nunc,Massa,10,963FF749-90F2-4801-AB9C-C3B7D8331175,HKWWK3Z6,Niue,Mauris nibh sed et suspendisse mauris ante vestibulum a ullamcorper elit quis.,5/21/15,398.93
|
||||||
|
,Clifton Watkins,jane.montoya@fuelblog.my,,Test Item 49,Id,Duis,Viverra,5,419B9D22-5C4E-47CF-B390-C42A8BC95C1C,ZF8AA2X0,"Virgin Islands, British",Suscipit nec consequat tortor a nonummy commodo lacus cras nisi.,10/9/10,772.13
|
||||||
|
,Javier Goodman,debbie@rollclicks.in,,Test Item 50,Egestas,Mauris,Accumsan,6,AADE6BB0-0BEE-42FB-B8F7-C882C42830CD,OCT4I7OC,"Bolivia, Plurinational State of",Mi est arcu aliquet feugiat mi torquent magna massa at et vel hymenaeos in accumsan.,1/12/14,238.17
|
||||||
|
,Andreas Cross,sarah@mybit.edu,,Test Item 51,Lacinia,Ullamcorper,Torquent,9,FFD22AD7-3A9C-499F-AB28-7595CD0B91FB,7OSLH34U,Mauritius,Aptent bibendum ultrices scelerisque interdum ad ut tempor rhoncus pellentesque mi vulputate velit ligula sem.,7/22/11,837.99
|
||||||
|
,Michael Hudson,brett@getblog.ga,,Test Item 52,Iaculis,Consectetuer,Duis,6,7ED1518C-FD51-4535-A0EA-61A317B329B2,BQRCDS5G,Antigua and Barbuda,Lorem egestas malesuada non tellus eu felis et id eget.,10/25/10,898.36
|
||||||
|
,Travis Sullivan,ayala@earlywerk.bo,,Test Item 53,Sapien,Et,Ipsum,8,6C770379-4788-4D52-9A22-9C13B5E382C6,00Z8ZH9Q,Montserrat,Quam condimentum imperdiet massa eu cras senectus et elit et pharetra sem donec lectus.,10/7/10,642.34
|
|
Loading…
Reference in a new issue