diff --git a/automate.php b/automate.php new file mode 100644 index 0000000..afbb932 --- /dev/null +++ b/automate.php @@ -0,0 +1,86 @@ + TRUE si aucune erreur, sinon FALSE + * + */ + function insertUsersFromJSON(){ + $json = manager\ResourcesDispatcher::getRessource('/f/json/generated_users/conf'); + $json = json_decode( $json, true ); + + // Pour chaque entree + foreach( $json as $user ){ + + $insertRequest = manager\Database::getPDO()->prepare("INSERT INTO user(id_user, code, username, firstname, lastname, mail, password, status) + VALUES( + DEFAULT, + :code, + :username, + :firstname, + :lastname, + :mail, + :password, + :status + )"); + + $status = $insertRequest->execute(array( + ':code' => $user['code'], + ':username' => $user['username'], + ':firstname' => $user['firstname'], + ':lastname' => $user['lastname'], + ':mail' => $user['email'], + ':password' => $user['password'], + ':status' => $user['status'] + )); + + var_dump( $status ); + } + + return true; + + }// insertUsersFromJSON(); + + + + + + + + + /* TEST DU DISPATCHER DES MANAGERS + * + * @return nomRetour Description du retour + + */ + function testModuleDispatcher(){ + + $req1 = new manager\ModuleRequest('firstModule/a', array('id_user' => 10) ); + $req2 = manager\ModuleRequest::fromString('{"path": "firstModule/a", "data": [{"id_user":10}]}'); + + + + + $instance = new manager\ModuleDispatcher($req1); + var_dump( $instance ); + + return true; + + }testModuleDispatcher(); + + +?> \ No newline at end of file diff --git a/config/generated_users.json b/config/generated_users.json new file mode 100644 index 0000000..f2a1508 --- /dev/null +++ b/config/generated_users.json @@ -0,0 +1,902 @@ +[ + { + "code": "92-55-B9-B3", + "username": "Daniels", + "firstname": "Juliana", + "lastname": "French", + "email": "julianafrench@corecom.com", + "password": "7718fd0fb9c0d5659603abdae0523bf487ee6af3", + "status": 1 + }, + { + "code": "10-FE-BD-61", + "username": "Lucas", + "firstname": "Curry", + "lastname": "Church", + "email": "currychurch@corecom.com", + "password": "9b38c49bd76669828ee450ee727270824129a795", + "status": 0 + }, + { + "code": "E0-11-41-DB", + "username": "Liz", + "firstname": "Geneva", + "lastname": "Diaz", + "email": "genevadiaz@corecom.com", + "password": "a22ba74507e8011b9779b1eb91fbf1b04eb71beb", + "status": 1 + }, + { + "code": "23-77-93-8C", + "username": "Jessie", + "firstname": "Joann", + "lastname": "Melendez", + "email": "joannmelendez@corecom.com", + "password": "0f561939beae883a24d4a07cf96dd3cec5629187", + "status": 1 + }, + { + "code": "E7-DA-79-9B", + "username": "Elaine", + "firstname": "Fox", + "lastname": "Kerr", + "email": "foxkerr@corecom.com", + "password": "348633ada63ae6a9887872401f6d307134aaeee9", + "status": 1 + }, + { + "code": "0F-9F-56-50", + "username": "Tameka", + "firstname": "Nieves", + "lastname": "Velasquez", + "email": "nievesvelasquez@corecom.com", + "password": "cb23ab1722ddbdd9fe7cf71a9898b8687e4455ed", + "status": 0 + }, + { + "code": "DB-A3-8A-D7", + "username": "Katheryn", + "firstname": "Rodriquez", + "lastname": "Gomez", + "email": "rodriquezgomez@corecom.com", + "password": "df3d3345e05eae7544f032bebd4687fed6d03525", + "status": 1 + }, + { + "code": "AF-BB-68-6B", + "username": "Bowen", + "firstname": "Bender", + "lastname": "Holder", + "email": "benderholder@corecom.com", + "password": "abcfa52d4c5f88f1a396eb2a151cc531892f33b4", + "status": 1 + }, + { + "code": "39-DF-20-69", + "username": "Flores", + "firstname": "Beck", + "lastname": "Murray", + "email": "beckmurray@corecom.com", + "password": "ebdf9559b529045694a37dd70797f89505b91770", + "status": 1 + }, + { + "code": "88-FA-FC-C3", + "username": "Dominique", + "firstname": "Tracy", + "lastname": "Morin", + "email": "tracymorin@corecom.com", + "password": "a2416579bcc2e0d4e32d94ba72fe74b9ec664975", + "status": 1 + }, + { + "code": "75-E1-A6-9E", + "username": "Deirdre", + "firstname": "Phoebe", + "lastname": "Pearson", + "email": "phoebepearson@corecom.com", + "password": "2b89badb731c174884f63f9dc057d9b5d3abb664", + "status": 0 + }, + { + "code": "CC-28-79-89", + "username": "Elvira", + "firstname": "Latasha", + "lastname": "Myers", + "email": "latashamyers@corecom.com", + "password": "cbce0e5b4b2d17f0c79abbd76f07f3282aa6a2ca", + "status": 1 + }, + { + "code": "E1-C8-AB-8C", + "username": "Sonya", + "firstname": "Shepherd", + "lastname": "Mcgowan", + "email": "shepherdmcgowan@corecom.com", + "password": "20a30cc9baba12fdede04e17d5f170cc9fcf822e", + "status": 0 + }, + { + "code": "7C-94-C4-9A", + "username": "Patrick", + "firstname": "Sandoval", + "lastname": "Wolfe", + "email": "sandovalwolfe@corecom.com", + "password": "554ee1ceef62cdad454af3b69d0d754630f4b4df", + "status": 1 + }, + { + "code": "36-3C-BB-F4", + "username": "Tamra", + "firstname": "Julie", + "lastname": "Alvarado", + "email": "juliealvarado@corecom.com", + "password": "7413e384e2768966e7eeb926eed610e923bf587b", + "status": 0 + }, + { + "code": "E7-52-B2-35", + "username": "Lawanda", + "firstname": "Erin", + "lastname": "Hayes", + "email": "erinhayes@corecom.com", + "password": "124b79396de86930007b4f1aa9356b11af471fd8", + "status": 0 + }, + { + "code": "94-E7-44-49", + "username": "Susie", + "firstname": "Jannie", + "lastname": "Thomas", + "email": "janniethomas@corecom.com", + "password": "37405dfe6877accb9428ffb8d369c5626a10ac5f", + "status": 1 + }, + { + "code": "89-64-A2-C2", + "username": "Marlene", + "firstname": "Janine", + "lastname": "Mcgee", + "email": "janinemcgee@corecom.com", + "password": "5e60c724022514b4e42b1c277c5326938eee9527", + "status": 1 + }, + { + "code": "AB-E2-19-73", + "username": "Lara", + "firstname": "Janell", + "lastname": "Wilcox", + "email": "janellwilcox@corecom.com", + "password": "dc66424c5e8aaeb0d65373ccc0e4395e268aea8f", + "status": 0 + }, + { + "code": "88-13-39-95", + "username": "Callahan", + "firstname": "Gutierrez", + "lastname": "Hale", + "email": "gutierrezhale@corecom.com", + "password": "41d57f3f623589e04db73f28e9a6dc10c3f900bd", + "status": 0 + }, + { + "code": "6A-8B-F5-05", + "username": "Ball", + "firstname": "Lowery", + "lastname": "Clarke", + "email": "loweryclarke@corecom.com", + "password": "c994259253ea665065862485bcff5fde4cd409f7", + "status": 1 + }, + { + "code": "F2-8B-B7-52", + "username": "Tiffany", + "firstname": "Noelle", + "lastname": "Grant", + "email": "noellegrant@corecom.com", + "password": "0ee717856d3b9f62e12b832ac11e9940b4ed9e64", + "status": 0 + }, + { + "code": "C2-97-8A-D1", + "username": "Alisha", + "firstname": "Dorsey", + "lastname": "Cohen", + "email": "dorseycohen@corecom.com", + "password": "03e337fd61e20c27378c4064913baecb964f8d2e", + "status": 1 + }, + { + "code": "D1-CD-18-D5", + "username": "Kristen", + "firstname": "Mosley", + "lastname": "Allen", + "email": "mosleyallen@corecom.com", + "password": "eb3cbffe04f7db182deb056eda47aa3774b08a94", + "status": 0 + }, + { + "code": "BF-18-2B-5A", + "username": "Hicks", + "firstname": "Georgia", + "lastname": "Henry", + "email": "georgiahenry@corecom.com", + "password": "466f50eaccf0704b77724028b81267a254b4217e", + "status": 1 + }, + { + "code": "3A-B9-55-4C", + "username": "Miriam", + "firstname": "Rosetta", + "lastname": "Daugherty", + "email": "rosettadaugherty@corecom.com", + "password": "724b16ed8ea7c5a83f119f8ae1e5dfabd3bc7d8c", + "status": 0 + }, + { + "code": "6C-90-5E-0A", + "username": "Vilma", + "firstname": "Adrian", + "lastname": "Small", + "email": "adriansmall@corecom.com", + "password": "72f036819075f34abf4da3f4916e4f8d4e7288e1", + "status": 0 + }, + { + "code": "3B-FE-71-B1", + "username": "Woods", + "firstname": "Benton", + "lastname": "Long", + "email": "bentonlong@corecom.com", + "password": "68073113e98d49c58d228d97c34442a85f918e4a", + "status": 0 + }, + { + "code": "94-B6-5A-D4", + "username": "Atkinson", + "firstname": "Atkins", + "lastname": "Riddle", + "email": "atkinsriddle@corecom.com", + "password": "fd6afb3b2dd3a95462dabc8fb22cd92f998cba8d", + "status": 0 + }, + { + "code": "C3-61-78-F2", + "username": "Rogers", + "firstname": "Jolene", + "lastname": "Young", + "email": "joleneyoung@corecom.com", + "password": "d24a404d3a33003e94037186dbcf2fbd270b9903", + "status": 0 + }, + { + "code": "7D-2B-DB-BD", + "username": "Kirsten", + "firstname": "Bush", + "lastname": "Luna", + "email": "bushluna@corecom.com", + "password": "057431e9586c02fb55a225af0452e2a02d1fea20", + "status": 0 + }, + { + "code": "D8-A3-FB-FC", + "username": "Iva", + "firstname": "Fran", + "lastname": "Odom", + "email": "franodom@corecom.com", + "password": "00dfd8c0cf85fc35e00d8943927c4a3aa443af78", + "status": 1 + }, + { + "code": "D8-3D-79-D5", + "username": "Morales", + "firstname": "Stevens", + "lastname": "Vaughan", + "email": "stevensvaughan@corecom.com", + "password": "ee773b00b2745a6a013b281524345649986524c3", + "status": 0 + }, + { + "code": "CE-08-DB-1D", + "username": "Kellie", + "firstname": "Kristi", + "lastname": "Gilliam", + "email": "kristigilliam@corecom.com", + "password": "09d3a7e416cc5d8a0cb55467b893a27cbf47ac0a", + "status": 1 + }, + { + "code": "F1-3C-AA-0D", + "username": "Mullen", + "firstname": "Trudy", + "lastname": "Wolf", + "email": "trudywolf@corecom.com", + "password": "c2488c6e89659ccc8ec0a9d94a8fe93a10af7543", + "status": 1 + }, + { + "code": "86-EE-8D-B3", + "username": "Harper", + "firstname": "Penelope", + "lastname": "Harrell", + "email": "penelopeharrell@corecom.com", + "password": "2826391ff5a4eb68610b1eaaaa1822eb9e497990", + "status": 0 + }, + { + "code": "34-1E-E7-CC", + "username": "Pollard", + "firstname": "Pena", + "lastname": "Roberson", + "email": "penaroberson@corecom.com", + "password": "76a17172e62891db5b6f464c4e7b1dfb4b85ba0f", + "status": 0 + }, + { + "code": "36-E8-D6-7F", + "username": "Howell", + "firstname": "Maryann", + "lastname": "Keith", + "email": "maryannkeith@corecom.com", + "password": "a029a2716b8d8fd8c8460a58952a90e46a323946", + "status": 1 + }, + { + "code": "23-77-0B-03", + "username": "Lina", + "firstname": "Allie", + "lastname": "Matthews", + "email": "alliematthews@corecom.com", + "password": "c611086b8e509e75dd6e840ba9252a39a611e529", + "status": 0 + }, + { + "code": "83-1B-E8-D4", + "username": "Glover", + "firstname": "Giles", + "lastname": "Carpenter", + "email": "gilescarpenter@corecom.com", + "password": "d076d97255e6011adca2459e618c8a9dba140261", + "status": 1 + }, + { + "code": "59-4F-13-7B", + "username": "Clarke", + "firstname": "Newman", + "lastname": "Mays", + "email": "newmanmays@corecom.com", + "password": "1d5da1ad97f86f1e6325ca221843de7b4cf78629", + "status": 0 + }, + { + "code": "03-58-61-02", + "username": "Daphne", + "firstname": "Josephine", + "lastname": "Ferguson", + "email": "josephineferguson@corecom.com", + "password": "c4967ca585254f8f2b6b4dc5eb865e3630923d5b", + "status": 0 + }, + { + "code": "5F-CA-AD-DC", + "username": "Maddox", + "firstname": "Larson", + "lastname": "Guthrie", + "email": "larsonguthrie@corecom.com", + "password": "8840ac79e06e6ab074d29643f2ec6b70d92570d3", + "status": 1 + }, + { + "code": "29-12-1D-1B", + "username": "Ernestine", + "firstname": "Heidi", + "lastname": "Harris", + "email": "heidiharris@corecom.com", + "password": "0776675c8522200f8376336a99d8fe3b404fe968", + "status": 0 + }, + { + "code": "E9-61-60-8B", + "username": "Bernice", + "firstname": "Ella", + "lastname": "Golden", + "email": "ellagolden@corecom.com", + "password": "0aec0b8cf2230cbee1b75b0feba719f6bc7b4e0b", + "status": 0 + }, + { + "code": "3B-27-8E-1F", + "username": "Rhodes", + "firstname": "Cantrell", + "lastname": "Castaneda", + "email": "cantrellcastaneda@corecom.com", + "password": "7a4ea97f9c78fb5596c03b414170afd804e204b2", + "status": 1 + }, + { + "code": "49-DF-A5-C2", + "username": "Nancy", + "firstname": "Audrey", + "lastname": "Wallace", + "email": "audreywallace@corecom.com", + "password": "8b0804f444da8c44fe3754aba17139bf3bf3c94d", + "status": 1 + }, + { + "code": "B1-87-EA-BF", + "username": "Abigail", + "firstname": "Mcmillan", + "lastname": "Savage", + "email": "mcmillansavage@corecom.com", + "password": "468b273cb88b002da5dc922c80c89b909357cbaa", + "status": 0 + }, + { + "code": "63-7F-09-29", + "username": "Levy", + "firstname": "Shawna", + "lastname": "Hicks", + "email": "shawnahicks@corecom.com", + "password": "5748e09d9c2133bb782d3ba78dec0b095b3ca2a4", + "status": 1 + }, + { + "code": "C9-48-F7-62", + "username": "Juarez", + "firstname": "Lynn", + "lastname": "Roth", + "email": "lynnroth@corecom.com", + "password": "7b427ab021a717478391d3361e956d8ba34ea879", + "status": 0 + }, + { + "code": "DF-CD-42-C9", + "username": "Pruitt", + "firstname": "Minerva", + "lastname": "Tran", + "email": "minervatran@corecom.com", + "password": "d46cf1a3954580cb538921caaf85fae0dd758e5a", + "status": 1 + }, + { + "code": "9F-E7-39-8A", + "username": "Richard", + "firstname": "Norris", + "lastname": "West", + "email": "norriswest@corecom.com", + "password": "70c47fb0abe612be1cd0f3fa51dcce5e9a36fc1a", + "status": 0 + }, + { + "code": "F5-AA-76-14", + "username": "Lindsay", + "firstname": "Wright", + "lastname": "Delgado", + "email": "wrightdelgado@corecom.com", + "password": "fee325ea1fd06bae0aef0a6c76bb9dc45b49b653", + "status": 0 + }, + { + "code": "A5-C8-50-F5", + "username": "Darla", + "firstname": "May", + "lastname": "Mcconnell", + "email": "maymcconnell@corecom.com", + "password": "2725d19076cb23aa8fd149dcee24f61ab5388cbd", + "status": 1 + }, + { + "code": "A0-0E-D0-AC", + "username": "Nolan", + "firstname": "Herrera", + "lastname": "Randall", + "email": "herrerarandall@corecom.com", + "password": "0fdaee6506f65f91737e5e686c2b2b46efef28c7", + "status": 0 + }, + { + "code": "FF-1F-FD-20", + "username": "Zelma", + "firstname": "Gwendolyn", + "lastname": "Yates", + "email": "gwendolynyates@corecom.com", + "password": "023c94ccd4e8650575362287242fe3adc4085519", + "status": 1 + }, + { + "code": "7D-0D-95-B1", + "username": "Avila", + "firstname": "Ramos", + "lastname": "Benton", + "email": "ramosbenton@corecom.com", + "password": "6911c3f6b80310363b6d880eb9c143f38921fcfd", + "status": 0 + }, + { + "code": "9D-5A-95-A9", + "username": "Etta", + "firstname": "Graves", + "lastname": "Horne", + "email": "graveshorne@corecom.com", + "password": "dbce0141e9e291a4d378d14c2d2d25cbe7f9eeec", + "status": 0 + }, + { + "code": "B9-3C-5A-74", + "username": "Ava", + "firstname": "Maribel", + "lastname": "Lawrence", + "email": "maribellawrence@corecom.com", + "password": "f194d0f315ca8f468b5d80a8fdd394a181fd752d", + "status": 0 + }, + { + "code": "E0-B9-0F-F5", + "username": "Stein", + "firstname": "Peterson", + "lastname": "Lindsey", + "email": "petersonlindsey@corecom.com", + "password": "d2ab2005065787d5bfbff3556ff51ac6786a2ba8", + "status": 1 + }, + { + "code": "BD-A1-69-F0", + "username": "Tommie", + "firstname": "Lee", + "lastname": "Chen", + "email": "leechen@corecom.com", + "password": "9a990087014b1d85646c9ec2d504fe067f60c39c", + "status": 0 + }, + { + "code": "81-8B-3B-DD", + "username": "Holmes", + "firstname": "Doreen", + "lastname": "Ramos", + "email": "doreenramos@corecom.com", + "password": "a5510d2adc6b1785f6fe08fd9599be777952eadc", + "status": 1 + }, + { + "code": "8D-C8-12-6C", + "username": "Todd", + "firstname": "Sherri", + "lastname": "Knight", + "email": "sherriknight@corecom.com", + "password": "1590a127ffe84d37118ff543d4cc8c0b0fc828d1", + "status": 1 + }, + { + "code": "12-74-96-57", + "username": "Henry", + "firstname": "Kane", + "lastname": "Martinez", + "email": "kanemartinez@corecom.com", + "password": "3e6a21cc8850b55ce954e0bc0614ca814c13a840", + "status": 0 + }, + { + "code": "5E-CA-06-D0", + "username": "Liliana", + "firstname": "Eleanor", + "lastname": "Molina", + "email": "eleanormolina@corecom.com", + "password": "9dc9e7d76223a7f7494d644c69fb73e72bbfb8c0", + "status": 0 + }, + { + "code": "46-D5-1C-58", + "username": "Angelita", + "firstname": "Pennington", + "lastname": "Simpson", + "email": "penningtonsimpson@corecom.com", + "password": "92ec823b4054e1ebb72eb42cef777f2cbae5191b", + "status": 0 + }, + { + "code": "04-D8-00-77", + "username": "Mcintyre", + "firstname": "Tami", + "lastname": "Clements", + "email": "tamiclements@corecom.com", + "password": "e76563ed028f6a61b3676c1d6ff3dfef13c335bf", + "status": 0 + }, + { + "code": "85-F4-B2-64", + "username": "Baker", + "firstname": "Noreen", + "lastname": "Chang", + "email": "noreenchang@corecom.com", + "password": "8f0b82179c2e3c01d22c7cfc61469a08c11fe972", + "status": 1 + }, + { + "code": "99-82-48-DC", + "username": "Barbra", + "firstname": "Charlene", + "lastname": "Meadows", + "email": "charlenemeadows@corecom.com", + "password": "1d605e5128de62077fb24442c4a2e650786bfc79", + "status": 1 + }, + { + "code": "51-FC-6F-FB", + "username": "Delacruz", + "firstname": "Lois", + "lastname": "Ware", + "email": "loisware@corecom.com", + "password": "ab1214f59416305b6e3c79a87ab88b1b724a1b33", + "status": 0 + }, + { + "code": "C5-20-CB-4B", + "username": "Wall", + "firstname": "Mcgee", + "lastname": "Washington", + "email": "mcgeewashington@corecom.com", + "password": "578bcdf6c794d5adae4e18c4ff71eb03b9b5b1f1", + "status": 1 + }, + { + "code": "BA-25-6F-EA", + "username": "Wilkinson", + "firstname": "Langley", + "lastname": "Oneil", + "email": "langleyoneil@corecom.com", + "password": "af13286c8c24ba418182d3aaefde6a5cc01e8e6e", + "status": 0 + }, + { + "code": "D6-9E-A2-80", + "username": "Rosalie", + "firstname": "Frost", + "lastname": "Floyd", + "email": "frostfloyd@corecom.com", + "password": "92ed95d940adddb5b4b7bbe2874856b09062f007", + "status": 0 + }, + { + "code": "26-C4-EB-5D", + "username": "Mae", + "firstname": "Diaz", + "lastname": "Pruitt", + "email": "diazpruitt@corecom.com", + "password": "7539b4a221bf6c0764d269514a6f548c2b4c9f3c", + "status": 1 + }, + { + "code": "8A-BF-C9-3D", + "username": "Bernadine", + "firstname": "Bullock", + "lastname": "Tucker", + "email": "bullocktucker@corecom.com", + "password": "938f7a23f86230770b7edec8a316edd05f01a38f", + "status": 0 + }, + { + "code": "17-4B-80-EC", + "username": "Norman", + "firstname": "Foster", + "lastname": "Hyde", + "email": "fosterhyde@corecom.com", + "password": "bc5dc4129b7e3e89901e688f94b44f92b7547f9e", + "status": 0 + }, + { + "code": "C8-5B-C6-4A", + "username": "Terra", + "firstname": "Hahn", + "lastname": "Larsen", + "email": "hahnlarsen@corecom.com", + "password": "59e34409cc08114706d32c96097b4045843739e2", + "status": 0 + }, + { + "code": "BD-6F-75-F0", + "username": "Ina", + "firstname": "Payne", + "lastname": "Hawkins", + "email": "paynehawkins@corecom.com", + "password": "98c8df2cb860a5eb7243fae1b541b469cda83265", + "status": 1 + }, + { + "code": "C4-DB-18-8B", + "username": "Sabrina", + "firstname": "Leach", + "lastname": "Cantrell", + "email": "leachcantrell@corecom.com", + "password": "8f68f0d8f4bf7c279cc5f67335d307cd0735e3bf", + "status": 0 + }, + { + "code": "23-4D-56-D9", + "username": "Karla", + "firstname": "Roxanne", + "lastname": "Bullock", + "email": "roxannebullock@corecom.com", + "password": "a67ab1116f048e5fde51019badc8246cf9201f36", + "status": 1 + }, + { + "code": "04-08-EB-92", + "username": "Clements", + "firstname": "Munoz", + "lastname": "Brooks", + "email": "munozbrooks@corecom.com", + "password": "fccfbfa65dbe6c0cb6c7a489c4b9771443782fce", + "status": 0 + }, + { + "code": "EB-DB-FD-87", + "username": "Mccullough", + "firstname": "Sofia", + "lastname": "Farley", + "email": "sofiafarley@corecom.com", + "password": "669c1c48f4ba6090f16e2ebfe3a6dfd3e55ea291", + "status": 1 + }, + { + "code": "83-F4-17-0D", + "username": "Cheri", + "firstname": "Trina", + "lastname": "Walls", + "email": "trinawalls@corecom.com", + "password": "5ed0a7f1b6e13841fe06e93d67d67886dbca283e", + "status": 1 + }, + { + "code": "E7-7D-E0-52", + "username": "Mcclain", + "firstname": "Price", + "lastname": "Gentry", + "email": "pricegentry@corecom.com", + "password": "2c2aa9f5961bc8906718abdd09b2e54aa3caf6a7", + "status": 1 + }, + { + "code": "0F-6C-B6-F9", + "username": "Leona", + "firstname": "Adriana", + "lastname": "Williamson", + "email": "adrianawilliamson@corecom.com", + "password": "f3255b73f2e807b11cedcd2124c689e4c3ec742e", + "status": 1 + }, + { + "code": "2D-C2-9C-32", + "username": "Roslyn", + "firstname": "Garner", + "lastname": "Armstrong", + "email": "garnerarmstrong@corecom.com", + "password": "7de33fcbdc4ea015f72d867d6b956bc3fe47ab0a", + "status": 0 + }, + { + "code": "1C-5E-93-06", + "username": "Castillo", + "firstname": "Rachael", + "lastname": "Trevino", + "email": "rachaeltrevino@corecom.com", + "password": "c2283af9be2c0db8ec5fbdc2c6b4bfa9eec424bb", + "status": 0 + }, + { + "code": "6F-49-74-A5", + "username": "Helen", + "firstname": "Samantha", + "lastname": "Gates", + "email": "samanthagates@corecom.com", + "password": "1d9e72419c316b6da5d006748ac983087b38f072", + "status": 1 + }, + { + "code": "54-65-6C-9F", + "username": "Olson", + "firstname": "Sweet", + "lastname": "Barry", + "email": "sweetbarry@corecom.com", + "password": "11e5db47cc15fec40f359674802f80c1d7a00f5b", + "status": 1 + }, + { + "code": "BC-1E-40-1A", + "username": "Ann", + "firstname": "Evans", + "lastname": "Howe", + "email": "evanshowe@corecom.com", + "password": "f19aab303f71391069117399362f280378962469", + "status": 1 + }, + { + "code": "F1-D0-5D-4E", + "username": "Haynes", + "firstname": "Russell", + "lastname": "Shannon", + "email": "russellshannon@corecom.com", + "password": "fa3204a1deabacda8d4f2e25056a61c7c3a50b71", + "status": 1 + }, + { + "code": "D5-E3-43-71", + "username": "Malinda", + "firstname": "Alvarez", + "lastname": "Singleton", + "email": "alvarezsingleton@corecom.com", + "password": "9274d7ab8718f07d5b06c7bda94320b01cbce80d", + "status": 0 + }, + { + "code": "23-41-81-AB", + "username": "Cochran", + "firstname": "Mcgowan", + "lastname": "Mclaughlin", + "email": "mcgowanmclaughlin@corecom.com", + "password": "f6bd26e02cd87c09a62087210a3ac35615e248ed", + "status": 0 + }, + { + "code": "28-86-38-25", + "username": "Winters", + "firstname": "Eugenia", + "lastname": "Anthony", + "email": "eugeniaanthony@corecom.com", + "password": "87c91e44121cfba9f5ef76b0f121f6ace5997989", + "status": 1 + }, + { + "code": "C7-7C-E2-41", + "username": "Richardson", + "firstname": "King", + "lastname": "Rodriguez", + "email": "kingrodriguez@corecom.com", + "password": "5b7d5be566bf6ff86a8f241741165bd0b7d2a944", + "status": 1 + }, + { + "code": "6B-1B-5E-A7", + "username": "Walker", + "firstname": "Montoya", + "lastname": "Meyer", + "email": "montoyameyer@corecom.com", + "password": "323c935631ef2396afc59d93ce7080df7e7cd1b5", + "status": 0 + }, + { + "code": "48-03-38-1F", + "username": "Witt", + "firstname": "Larsen", + "lastname": "Strong", + "email": "larsenstrong@corecom.com", + "password": "8292d357d783eb4ab3900fba170fb8977e9a8720", + "status": 0 + }, + { + "code": "E0-4B-04-F6", + "username": "Valarie", + "firstname": "Craft", + "lastname": "Klein", + "email": "craftklein@corecom.com", + "password": "b1f2ec40a2f4457d88662b3ef22ff8fe16fb5e4c", + "status": 0 + }, + { + "code": "2F-7D-0A-51", + "username": "Jessica", + "firstname": "Delgado", + "lastname": "Campos", + "email": "delgadocampos@corecom.com", + "password": "8125b1397016438dc4342d829c286b7597c69803", + "status": 0 + }, + { + "code": "91-D4-7E-65", + "username": "Velez", + "firstname": "Mcmahon", + "lastname": "Lott", + "email": "mcmahonlott@corecom.com", + "password": "b6a433da4441737be56635dd80d1a5a8eec2bcd3", + "status": 1 + } +] \ No newline at end of file diff --git a/config/jsongenerator_users.js b/config/jsongenerator_users.js new file mode 100644 index 0000000..349ae78 --- /dev/null +++ b/config/jsongenerator_users.js @@ -0,0 +1,24 @@ +[ + '{{repeat(100)}}', + { + code: function(tags){ + + function randHex(){ return ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'][Math.floor(Math.random()*16)]; } + + return randHex()+randHex()+'-'+randHex()+randHex()+'-'+randHex()+randHex()+'-'+randHex()+randHex(); + }, + + + username: '{{firstName()}}', + firstname: '{{firstName()}}', + lastname: '{{surname()}}', + email: '{{email()}}', + password: function(tags){ + var result = ''; + for(var i = 0 ; i < 40 ; i++ ) + result += ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'][Math.floor(Math.random()*16)]; + return result; + }, + status: '{{integer(0,1)}}' + } +] \ No newline at end of file diff --git a/config/managers.json b/config/managers.json deleted file mode 100755 index 0954b60..0000000 --- a/config/managers.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "a" : "/firstManager", - "b" : "/secondManager", - "c" : "/thirdManager" -} \ No newline at end of file diff --git a/config/modules.json b/config/modules.json new file mode 100755 index 0000000..c80e321 --- /dev/null +++ b/config/modules.json @@ -0,0 +1,25 @@ +{ + "firstModule" : [ + "a", + "b", + "c", + "d", + "e" + ], + + "secondModule" : [ + "f", + "g", + "h", + "i", + "j" + ], + + "thirdModule" : [ + "k", + "l", + "m", + "n", + "o" + ] +} \ No newline at end of file diff --git a/index.php b/index.php index 1bfd0f8..5bd46f9 100755 --- a/index.php +++ b/index.php @@ -51,6 +51,7 @@ $R->post('.*', function(){ var_dump( 'Acces POST : '.$_GET['url'] ); + var_dump( $_POST ); }); diff --git a/manager/ModuleDispatcher.php b/manager/ModuleDispatcher.php new file mode 100644 index 0000000..937603a --- /dev/null +++ b/manager/ModuleDispatcher.php @@ -0,0 +1,48 @@ + La requete a dispatcher de type + * + * @return status Retourne si oui ou non tout s'est bien passe + * + */ + public function __construct($request){ + /* [1] On verifie le type de la requete + =========================================================*/ + if( !($request instanceof ModuleRequest) ) // Si c'est pas une instance de + return false; // On retourne FALSE, si erreur + + + + return true; + + } + + + + } + +?> \ No newline at end of file diff --git a/manager/ModuleRequest.php b/manager/ModuleRequest.php new file mode 100644 index 0000000..bf8ebb2 --- /dev/null +++ b/manager/ModuleRequest.php @@ -0,0 +1,155 @@ + Chemin de delegation ("module/methode") + * @data Tableau contenant les parametres utiles au traitement + * + * @return status Retourne si oui ou non tout s'est bien passe + * + */ + public function __construct($path=null, $data=null){ + // Si pas parametre manquant, on quitte + if( $path == null ) return false; + + /* [0] On met a jour la configuration + =========================================================*/ + // Modules specifies + $this->modules = json_decode( ResourcesDispatcher::getResource(self::$config_path), true ); + + // Gestion de l'erreur de parsage + if( $this->modules == null ) return false; + + + + /* [1] Verification des types des parametres + =========================================================*/ + // Type de @path + if( !is_string($path) ) // Si le type est incorrect + return false; // On retourne FALSE, si erreur + + // Type de @data (optionnel) + $data = (is_array($data)) ? $data : array(); + + + /* [2] Verification du chemin (existence module+methode) + =========================================================*/ + if( !$this->checkPath($path) ) // Verification de la coherence du chemin + attribution + return false; // On retourne FALSE, si erreur + + + + /* [3] Construction de l'objet + =========================================================*/ + $this->data = $data; + + return true; // On retourne que tout s'est bien passe + + } + + + + + + /* VERIFICATION DU FORMAT ET DE LA COHERENCE DU CHEMIN SPECIFIE + * + * @path String correspondant au chemin de delegation ("module/methode") + * + * @return validity Retourne si oui ou non l'objet est correct + * + */ + private function checkPath($path){ + /* [1] Verification format general + =========================================================*/ + if( !preg_match('#^([\w_-]+)/([\w_-]+)$#i', $path, $matches) ) // Si mauvais format + return false; + + // On recupere les donnes de la regex + $module = $matches[1]; + $method = $matches[2]; + + /* [2] Verification de l'existence du module (conf) + =========================================================*/ + if( !array_key_exists($module, $this->modules) ) // Si le module n'est pas specifie dans la conf + return false; // On retourne FALSE, si erreur + + + /* [3] Verification de l'existence de la methode (conf) + =========================================================*/ + if( array_search($method, $this->modules[$module]) === false ) // Si la methode n'est pas specifie dans la conf + return false; // On retourne FALSE, si erreur + + + + /* [4] Enregistrement du chemin et renvoi de SUCCESS + =========================================================*/ + $this->path = array( + 'module' => $module, + 'method' => $method + ); + + return true; + } + + + + + + /* DESERIALISATION ET CREATION D'UN OBJET + * + * @jsonString Json au format string contenant les donnees + * + * @return instance Retourne un objet de type + * + */ + public static function fromString($jsonString){ + $json = json_decode( $jsonString, true ); + + // Verification du parsage + if( $json == null ) + return new ModuleRequest(); + + // Verification des parametres + if( !isset($json['path']) ) + return new ModuleRequest(); + + // On definit $data au cas ou il soit vide + $data = (isset($json['data'])) ? $json['data'] : array(); + + return new ModuleRequest($json['path'], $data); + } + + + + } + +?> \ No newline at end of file diff --git a/manager/ResourcesDispatcher.php b/manager/ResourcesDispatcher.php index 497a4d4..3e87c1a 100755 --- a/manager/ResourcesDispatcher.php +++ b/manager/ResourcesDispatcher.php @@ -5,7 +5,7 @@ class ResourcesDispatcher{ - // Constantes (a dispatcher dans un .conf) + // Constantes public static $extension_config_path = '/config/dispatcher-extensions.json'; public static $parents_config_path = '/config/dispatcher-tree.json'; @@ -22,8 +22,6 @@ * * @url L'url courante * - * @GET Arguments indirects (variable $_GET) - * * @return status Retourne si oui ou non tout s'est bien passe * */ @@ -32,10 +30,18 @@ =====================================================*/ // Extensions supportees $extensions_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$extension_config_path), true ); + + // Gestion de l'erreur de parsage + if( $extensions_conf == null ) return false; + self::$supported_extensions = $extensions_conf; // Dossiers supportes $parents_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$parents_config_path), true ); + + // Gestion de l'erreur de parsage + if( $parents_conf == null ) return false; + self::$supported_parents = $parents_conf; @@ -65,6 +71,18 @@ } + /* INCLUSION PHP D'UNE RESSOURCE UTILISANT LE DISPATCHER + * + * @route Route associee a une ressource + * + * @return content<*> Retourne le contenu de la ressource + * + */ + public static function getResource($route){ + return file_get_contents('http://'.$_SERVER['HTTP_HOST'].$route); + } + + /* FONCTION QUI VERIFIE LES DRAPEAUX * diff --git a/todo.md b/todo.md index 96f4ee4..0a84817 100755 --- a/todo.md +++ b/todo.md @@ -13,6 +13,11 @@ ############ # EN COURS # ############ +- [ ] Conception du systeme de delegation des managers + - [.] Module Dispatcher + - [x] Module Request + - [ ] Module Answer + - [x] Conception BDD + ameliorations - [x] Liste des tables - [x] Liste de attributs