Compare commits
746 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c351a8fc02 | |||
| 14c0f12fe9 | |||
| 9e5810c8cf | |||
| e6a0a94e17 | |||
| 777f9de3d9 | |||
| 791c172c7a | |||
| 3bef6d8e84 | |||
| 093d71e5ae | |||
| 67e83f5c9e | |||
| b952f3dbfb | |||
| 23b125f552 | |||
| 93e17e8f8d | |||
| 9af562fda2 | |||
| 0612cd2399 | |||
| 811ea3ad27 | |||
| 967571f030 | |||
| ac2576b760 | |||
| 7f1bc0cf1d | |||
| 3ba9ea5085 | |||
| 08512304f1 | |||
| c0da4e1777 | |||
| 14705e2100 | |||
| 0c99f35c02 | |||
| a91da86ae4 | |||
| fe726b2637 | |||
| 8852dd7ea2 | |||
| 44897a64b5 | |||
| 4f160937a4 | |||
| 6ca02933c9 | |||
| d233d8ce46 | |||
| 07db57717f | |||
| 6f676c8a2f | |||
| ac667356c5 | |||
| acef776782 | |||
| ff41b49538 | |||
| 24d2bd5cad | |||
| 86a092ddb1 | |||
| 6c2fa01375 | |||
| 77eaaa45d9 | |||
| 3d8b487754 | |||
| 94c6715c21 | |||
| 976a10ed0a | |||
| a5c7fb8905 | |||
| 4dec6b8d49 | |||
| e1eaeab938 | |||
| 4a4766cb0b | |||
| 686219c60b | |||
| a97c642d3b | |||
| 432d45e122 | |||
| 336bb95d11 | |||
| 185a24f007 | |||
| 6cfe9b6b43 | |||
| 61cdcbfeb5 | |||
| b0a77054dc | |||
| f6fb791fd2 | |||
| ec3a6bf0a2 | |||
| 8e277fdb36 | |||
| 085e5ef4bf | |||
| cf7f382784 | |||
| 65266fcf25 | |||
| 8bc34aab9b | |||
| 3bd73f16a8 | |||
| 0db4057d44 | |||
| f14bc07174 | |||
| 8e91786d99 | |||
| 44745aef14 | |||
| 56640839d2 | |||
| 1e319a91ba | |||
| c37b2964c2 | |||
| 24647cd5fb | |||
| d407494579 | |||
| b43843f882 | |||
| 87c5371846 | |||
| 7b9c6cdb3f | |||
| 32ea4dae9d | |||
| a3cb0e6313 | |||
| 0f88e535ad | |||
| 3edb739e2a | |||
| 82ad48c586 | |||
| 710f6783bc | |||
| 797c5453c9 | |||
| a03ef074ef | |||
| 1e6b28e560 | |||
| 77c7468512 | |||
| 0764231ab6 | |||
| a779fc0a99 | |||
| d5fb8af1a3 | |||
| 3099ef6dc3 | |||
| 078a445e18 | |||
| e6e1471a53 | |||
| b16ffc4739 | |||
| ec44deceaa | |||
| 31b416d3ee | |||
| 9dd0f8eb70 | |||
| cf508debae | |||
| e25227e853 | |||
| 6bba422d07 | |||
| a1337cefe4 | |||
| 1ce54bbb33 | |||
| e46edf2b36 | |||
| 0093a03b7b | |||
| f35df154ae | |||
| a5dc3aae70 | |||
| 847ac0c20a | |||
| 87396518f1 | |||
| 4ba74fe8b4 | |||
| 8858d96cda | |||
| 415e30ece8 | |||
| 1a0958e65a | |||
| cf0e5bb328 | |||
| b02e1218ee | |||
| ba478fcce5 | |||
| 9682138038 | |||
| 59499f6f07 | |||
| b425a335ab | |||
| 8cdde45b1b | |||
| d00925d99a | |||
| 2fffec3e5d | |||
| 395785d0c4 | |||
| 3812856740 | |||
| 088558d969 | |||
| d79e81f652 | |||
| 39c0f159a8 | |||
| f2ea162952 | |||
| fdde599205 | |||
| 7e80ca806d | |||
| 09bf5219ad | |||
| 9922dc8e22 | |||
| b9bb4bc0b5 | |||
| d5a928d955 | |||
| aad2ab08c5 | |||
| 5d18d50ca0 | |||
| 54f2ab411f | |||
| b066c3d3da | |||
| 957a2fa171 | |||
| 61ccee3ac2 | |||
| c889edb782 | |||
| e1f673fe78 | |||
| 8b781d32da | |||
| 3c06d6684e | |||
| 6bf8274d11 | |||
| 2b59c5bdec | |||
| 4f6497f412 | |||
| 1fa937ef64 | |||
| 4ffc309e11 | |||
| 33b60e6791 | |||
| 378bebb2bf | |||
| 7925f2468a | |||
| a1d0c494af | |||
| a86ca38bd7 | |||
| 18cf4c4cf5 | |||
| cf42f49431 | |||
| 82df939bda | |||
| 94f0c0bb3e | |||
| 9f78afd0e6 | |||
| 04f4a4a63a | |||
| 31c226dd16 | |||
| 9fe3f7cdf8 | |||
| be744399cb | |||
| 866c336a0b | |||
| 4928edc4d1 | |||
| 2e1b35d404 | |||
| a8db63910e | |||
| 2cde8e8918 | |||
| 6c59f70cf4 | |||
| 2ac1c8d444 | |||
| 7526e737b8 | |||
| 0d44d04a17 | |||
| bc81154ce2 | |||
| 1632668529 | |||
| fbd05ebafa | |||
| 2c6f9f02df | |||
| 5c572b9750 | |||
| 5be21c7342 | |||
| 7d662eab8e | |||
| 8734a00d11 | |||
| d4511e3983 | |||
| ae643c5a28 | |||
| e6dc5dd12b | |||
| 566f92149c | |||
| 99bf7fc524 | |||
| b350bd4fc1 | |||
| 58d1e67b53 | |||
| 20855e81d4 | |||
| 3282de2c8f | |||
| 72f51ec77c | |||
| c8558f0cba | |||
| d0876db1f7 | |||
| efd7de49c6 | |||
| 5ae6fb0020 | |||
| 1057b8bc95 | |||
| 3076b6c8ea | |||
| b7ff603772 | |||
| b996389845 | |||
| ca2d1217cd | |||
| 227b0fb828 | |||
| ac28ae5a9b | |||
| 04eaf4db02 | |||
| a380d7e5f9 | |||
| 73af7d4119 | |||
| 4762237796 | |||
| 591a4f0f32 | |||
| d28cc59feb | |||
| be899564c1 | |||
| 6fb8e7ab37 | |||
| 047b07d3c9 | |||
| 8f0969eb5d | |||
| b92975c9b7 | |||
| 0cfc69cdaa | |||
| 1b497c81c7 | |||
| eab2dbd1b4 | |||
| 4eac37ad61 | |||
| dc658a6b06 | |||
| 9d3aaebf24 | |||
| f5b6876626 | |||
| 5d7893e4ee | |||
| 01ef55ffc1 | |||
| 551d97883f | |||
| 68ccfe735f | |||
| de4ed2100c | |||
| b602ef8eb8 | |||
| 5ade5cf4c1 | |||
| 7cb7719cf6 | |||
| d07be2b5f4 | |||
| 77f01fd28d | |||
| 93fb78cf71 | |||
| 2ff28ba8ca | |||
| 01b9b735e5 | |||
| 751a293319 | |||
| 2e1cd55ee2 | |||
| 45bdd62bbf | |||
| 9a56ca9599 | |||
| 1eb5fab3e3 | |||
| 99ca025ded | |||
| 3fa83db99f | |||
| f143dc7042 | |||
| 1a8a93c03a | |||
| 9bbd51fd61 | |||
| 00238ba043 | |||
| 2147e3073c | |||
| 3f9dc78fa4 | |||
| 0c8c3ef5f4 | |||
| b6cafb1a35 | |||
| c3ace0b56d | |||
| 0c3b452d6f | |||
| 297c973695 | |||
| 57ec132aa7 | |||
| d1b10de17d | |||
| 85549cf39f | |||
| bba2d5b898 | |||
| 4e0de42b0d | |||
| 66fc373af6 | |||
| d7e215505f | |||
| c293bef232 | |||
| 11d6ea3271 | |||
| 3d243e19fd | |||
| 813b5834fd | |||
| 2f3e662ef6 | |||
| a3779dbbee | |||
| f109b6f60a | |||
| 9b7ddf19a5 | |||
| 9e4ca525a0 | |||
| 0359528b7c | |||
| c1ef8854ac | |||
| 824878de39 | |||
| 919f48e0a3 | |||
| 0a16ae3395 | |||
| 4528edd6a7 | |||
| 25daa39a91 | |||
| e20e6e863f | |||
| dbe5dbaf1f | |||
| a5ba3ca5db | |||
| 8efe9842cf | |||
| 550bdaba4f | |||
| 6f6c08f9a3 | |||
| dfea8470d1 | |||
| a19ada57fa | |||
| f617d212f2 | |||
| 88a09b2487 | |||
| 8dd5b078e6 | |||
| cccb71fd5b | |||
| f232f58b07 | |||
| 17f8cb2f42 | |||
| 5149713643 | |||
| 586852ce7d | |||
| 65afe07a03 | |||
| ea8bb03e8d | |||
| 7f52192fa8 | |||
| cadf54fb4e | |||
| 631e766e5f | |||
| d770afd24a | |||
| 6eb29eef2b | |||
| 7079ecfba1 | |||
| ecf9962d6e | |||
| 4bc24352c6 | |||
| cc5125230e | |||
| f50e962aee | |||
| c363be67a1 | |||
| 2467129e48 | |||
| dbcc6b43e6 | |||
| 13ebb9b63f | |||
| 6ba856fc66 | |||
| 6f08fee069 | |||
| f270073be6 | |||
| fb3dd2dbf5 | |||
| ef47d3d2bf | |||
| 31bf387cbe | |||
| 446c9a13cc | |||
| a373f1a864 | |||
| 7526e3c516 | |||
| 98eb42ddb0 | |||
| 9fd6c202a4 | |||
| 00cbc80ccd | |||
| b1252d2be4 | |||
| daba2b3ba3 | |||
| 3ecb64965d | |||
| 061535d9fe | |||
| 87459afab4 | |||
| a5da02df0f | |||
| f37f59aff9 | |||
| 155a34245f | |||
| 456eca773d | |||
| 7e54ff7f98 | |||
| d2abd0eb3b | |||
| 853ca01176 | |||
| 4e7462566b | |||
| 46c910d74f | |||
| e2a3761f10 | |||
| 4d04a513c5 | |||
| dcb550d6a8 | |||
| 44c13c9223 | |||
| 3f37245a8c | |||
| 1f1b2c2203 | |||
| 2fc38dd184 | |||
| 5e95a9e6b5 | |||
| 832a135556 | |||
| 39c3eeadd8 | |||
| aaaad41051 | |||
| d446034f41 | |||
| 644c165b94 | |||
| b4bec78081 | |||
| ac35e3db83 | |||
| 429d808e98 | |||
| 0354cc1e38 | |||
| 7c731550ac | |||
| aa45ed88aa | |||
| 98fa68a070 | |||
| 0b3b915641 | |||
| d54f5cb259 | |||
| d018781667 | |||
| 6e07ecd5bb | |||
| 9190544b10 | |||
| 2c6674efe0 | |||
| 2d6528a8d5 | |||
| 6b4980899c | |||
| c5781971f3 | |||
| 19984e6e4e | |||
| 97b12c3916 | |||
| 237ff5699c | |||
| 61e869a552 | |||
| d0710ccb21 | |||
| d83ab71e48 | |||
| e1da88372f | |||
| cb9bda59f0 | |||
| 1d41127810 | |||
| 0835699897 | |||
| 07f9d6b482 | |||
| 9cdb14daaa | |||
| bb2db7d675 | |||
| 3991efff4c | |||
| b3ad922691 | |||
| 8d3ad7318a | |||
| def5c9d97b | |||
| feb880fd53 | |||
| bff95e6522 | |||
| 38f2172f20 | |||
| 20ccba9f23 | |||
| 8ae97efb43 | |||
| fdf72b3676 | |||
| 334d88775f | |||
| b47a6b2cd5 | |||
| 69c7752537 | |||
| e708db7e5b | |||
| 978a206662 | |||
| 62d1c0fae9 | |||
| 76546ff06c | |||
| 171164ed2b | |||
| 4057f92ec0 | |||
| 2b181b8d84 | |||
| e210f1386d | |||
| 711781b666 | |||
| addda0d9a8 | |||
| b2b958c946 | |||
| 42af361ae4 | |||
| 440c6cee23 | |||
| 1b32e57637 | |||
| 5008561965 | |||
| 168f32a90e | |||
| 23a21a060c | |||
| 0eab4f0cac | |||
| 0ee3044ebc | |||
| 916ad5159e | |||
| 31d985e875 | |||
| 973404d46e | |||
| 042c5e5791 | |||
| 64b3328916 | |||
| ef8faa466c | |||
| 4f53f6861c | |||
| c610f8d6a7 | |||
| ecde182b08 | |||
| 94a723753f | |||
| cef40340cf | |||
| 8413e56d3f | |||
| c14c6d9187 | |||
| d010c4a463 | |||
| ecf70585d7 | |||
| 9183489d19 | |||
| e659c79bf7 | |||
| e017479f85 | |||
| 24091d9eed | |||
| abdc73af6a | |||
| 168335c5b0 | |||
| d0f43e7de9 | |||
| 4dee40f714 | |||
| bd238f912f | |||
| e91539f534 | |||
| e912566b44 | |||
| daef165a2e | |||
| 2b740082e4 | |||
| b0292e61a9 | |||
| e5b8db367b | |||
| 1aad648987 | |||
| a943c4a7ea | |||
| a184d5568d | |||
| a351875586 | |||
| 21b325f27f | |||
| 992d581ff2 | |||
| 4824714b0d | |||
| bdf3e9a4b6 | |||
| 5826f0fb2a | |||
| 65a57aed59 | |||
| ffe4b82e1e | |||
| 32c29ac829 | |||
| 03e46ed08f | |||
| d4821db812 | |||
| 0f8d9f96fb | |||
| dbaf535f53 | |||
| f8254f49c0 | |||
| 6592ad3798 | |||
| d5bb95cab6 | |||
| ae2f2ab235 | |||
| 489e41a042 | |||
| 4c209aaa86 | |||
| 09d8bc5a36 | |||
| 589415b036 | |||
| 6ee936d522 | |||
| 648fa60e14 | |||
| deea05a986 | |||
| 1ddefe2541 | |||
| efaf3327e3 | |||
| 0046734522 | |||
| 0ed243c9b1 | |||
| 91d81773bc | |||
| c71f8a5334 | |||
| 21e8425e59 | |||
| f246021819 | |||
| e0ac2e156d | |||
| 46a4815def | |||
| 5851245f43 | |||
| 66f0aa71c9 | |||
| 51b621ecd1 | |||
| 65d88e5ac8 | |||
| 96a0cb12a0 | |||
| 07844912d2 | |||
| cdbe9651f3 | |||
| ba172494b4 | |||
| 956e7108c3 | |||
| 66a111d7fc | |||
| 4b038d66d1 | |||
| 8feab8f394 | |||
| 0c350b5f16 | |||
| be21968795 | |||
| 0dac024316 | |||
| d7d1a38fd3 | |||
| cc562d6c26 | |||
| 8565711a3e | |||
| 362b65b2b2 | |||
| 444f699853 | |||
| f6ea204259 | |||
| 5c44a374d5 | |||
| 8aae2b18ba | |||
| 258e56c61d | |||
| 55d054b15c | |||
| 1f733fa307 | |||
| acfcc65aee | |||
| 5a29830202 | |||
| 04ef798866 | |||
| 5987906fd8 | |||
| 3084dddf1c | |||
| 87b112c699 | |||
| 212a5879b3 | |||
| eb6f9b602f | |||
| cf508a540e | |||
| 5278e3bf06 | |||
| ee70b1afad | |||
| 4374688c85 | |||
| 0b7804f4f1 | |||
| c01545678f | |||
| 3ea617e449 | |||
| 75e3961fb5 | |||
| cc8d66dc7d | |||
| 874c42fa33 | |||
| 8a554bdf55 | |||
| 5b02dc23f5 | |||
| dd75aaeef2 | |||
| 97c109dc79 | |||
| f61c546af7 | |||
| f6742d225d | |||
| ba69668df5 | |||
| 7b8d2a874c | |||
| 8ba1e8148e | |||
| 7266cc96c9 | |||
| f4a3a3fbd3 | |||
| 937f28b52f | |||
| 0997a870ec | |||
| 5da17fd8a9 | |||
| d8ca8a9a22 | |||
| 76007e2c79 | |||
| f0b7e94aa0 | |||
| 89f7281a02 | |||
| 9d7d9d0f3d | |||
| 46d6cbb042 | |||
| 63d50c1ebd | |||
| 4917f0d5f6 | |||
| ffb1f51f52 | |||
| 48f98014a9 | |||
| 8005e6e879 | |||
| 5763f5b58e | |||
| 8f6872bb08 | |||
| 6fe21e68c0 | |||
| 6b0bc18cbe | |||
| d1eced41aa | |||
| ff83b4cb41 | |||
| 59d46e43a4 | |||
| 240644dd8c | |||
| 840b31c7d3 | |||
| 1c29123a44 | |||
| 8e73af8d38 | |||
| 85e583ec7c | |||
| 509841344f | |||
| 5eef8f2ce5 | |||
| 85efea44ed | |||
| c004815a42 | |||
| afddb6afc9 | |||
| 7c869ce3fc | |||
| b9541eea35 | |||
| 75e46f6f5b | |||
| 531992adff | |||
| 1f88b60cca | |||
| 09d7c73449 | |||
| b43d9f8784 | |||
| d3e65f9ba1 | |||
| 5485966c1c | |||
| d6dc858720 | |||
| 07ee43d4d7 | |||
| 45720afd50 | |||
| 291c692bdb | |||
| 464976629d | |||
| 4267adbdb2 | |||
| f8d0fc2654 | |||
| ba2bea15b5 | |||
| 7ffd5a25a9 | |||
| ba59e3922f | |||
| 8336eb3dd9 | |||
| 667f9b6eb6 | |||
| f76d8601e7 | |||
| f09db0ebdb | |||
| 3b6a686257 | |||
| e939b4541d | |||
| d6c4002e82 | |||
| 0cb1629f75 | |||
| e8f600c99f | |||
| 745d6b9603 | |||
| 245e267f73 | |||
| 953920a742 | |||
| a6e1b016ae | |||
| fdddc5cc2a | |||
| b7de49a2aa | |||
| 35dbe35ea4 | |||
| d0f84584a0 | |||
| a334fc5456 | |||
| ccbc9a2348 | |||
| 8c109d2713 | |||
| 8b3b659ec6 | |||
| 537b921e87 | |||
| 74dbc64d5b | |||
| fe9ed74875 | |||
| a8f48c3248 | |||
| 857648633e | |||
| 81d961d5d9 | |||
| ae2d5e2552 | |||
| 035e561a4c | |||
| 541cc907f1 | |||
| a5fc42a85f | |||
| 421384980a | |||
| 331fb69364 | |||
| 9d5e1b7d33 | |||
| 1c06f3be92 | |||
| 64c8c1a891 | |||
| f637960648 | |||
| 2f73ae43ac | |||
| befdff8085 | |||
| 7be573be67 | |||
| 19227313b3 | |||
| 4d71e3c904 | |||
| fef90ac1dc | |||
| 6a940eb732 | |||
| 838d0b08db | |||
| c36c5a9d63 | |||
| 327b6adbbf | |||
| 3f78f71c5f | |||
| 06e68a3e7d | |||
| b1614ae660 | |||
| 9575b8e24f | |||
| b6b562cff1 | |||
| e22f8b0120 | |||
| eaa0426628 | |||
| 42c5ac56ca | |||
| f54497b76f | |||
| f253e021d0 | |||
| fa679b6dd2 | |||
| 11d55b9e40 | |||
| 00fbf45e88 | |||
| 945921b38d | |||
| b69f20a7fd | |||
| 1f445770cf | |||
| 7765562302 | |||
| 16abe43003 | |||
| 5fed4f93e5 | |||
| 4514e8225f | |||
| ab2d3eed43 | |||
| f236a72a1a | |||
| b66ac6ce13 | |||
| 0a8ade65f4 | |||
| 1235eee695 | |||
| fbc35ec23d | |||
| 4e31fc89d4 | |||
| a7d3073861 | |||
| abd40d42b8 | |||
| ec19ae061f | |||
| 84d9e1fe29 | |||
| 50d7f6d831 | |||
| b80bdf9a83 | |||
| 19eb99ed25 | |||
| 6c2be9199e | |||
| ff1c449411 | |||
| 259b06cd7a | |||
| cb00922841 | |||
| e21f500a4d | |||
| af9fac2b51 | |||
| 81c8311026 | |||
| 085e66feea | |||
| 7ad01cad77 | |||
| 5038e4144f | |||
| 4e6d5cf773 | |||
| 8815564be3 | |||
| 097a600488 | |||
| 037687e11f | |||
| 6eddc10d5a | |||
| 0b9256ecf9 | |||
| 26e692563b | |||
| 961e056e8d | |||
| 77debc3875 | |||
| d4376264c3 | |||
| 424302287e | |||
| bcdee914ad | |||
| 9580c4f376 | |||
| edf673fb69 | |||
| 7738b9c3e0 | |||
| 1579e4851e | |||
| 914e070732 | |||
| a976e22ebd | |||
| 138d0215f7 | |||
| 39b42c3953 | |||
| da10e9c4a9 | |||
| 89273a26d4 | |||
| bac7eb6c89 | |||
| 80572ae14f | |||
| c8a746d90b | |||
| a57f13eda2 | |||
| e576b9f272 | |||
| 6df18b3604 | |||
| 616d65023b | |||
| ea001812e2 | |||
| b7925f6d1f | |||
| e7d1cbd5ca | |||
| b165d54ad6 | |||
| 25afbffda8 | |||
| 77f7db3592 | |||
| 3f950cb615 | |||
| a0e2b1a9b6 | |||
| c50b043e52 | |||
| b99091eb3a | |||
| 450cd80f62 | |||
| 0b9d52d30d | |||
| 6e9b125818 | |||
| 93146dffd6 | |||
| 07d3e982ef | |||
| 865078a7f9 | |||
| 14eafb6121 | |||
| 0d1ce3ee90 | |||
| 638654d52e | |||
| 3c0f7ca93e | |||
| c5c9862c68 | |||
| 452ea6f1ef | |||
| c5fe7bca21 | |||
| 60922ac7cd | |||
| 97b7f4adfa | |||
| 895a2f7f2f | |||
| 25bcb9a49d | |||
| ebf8d58a5e | |||
| 8d5cf689ee | |||
| e72f348dc8 | |||
| caaf651a2e | |||
| 8e62ed2fb8 | |||
| d5058d9399 | |||
| 4279e86526 | |||
| 0691e469e5 | |||
| 90cd54410b | |||
| 546bb56c86 | |||
| 340f82cc4b | |||
| 81f10127fa | |||
| 8d12148722 | |||
| 70000efc0a | |||
| 31de034d45 | |||
| 94cef5d4a2 | |||
| 3a97076790 | |||
| 3dfaae167f | |||
| 4d7e56e7b7 | |||
| c0f3fdb226 | |||
| 6f37c54ff6 | |||
| a6ca10fdc8 | |||
| 07d7afb5b4 | |||
| cae9b04f80 | |||
| edf4e6c9e4 | |||
| 9857a61744 |
@@ -19,7 +19,6 @@ jobs:
|
||||
image: mysql:8.0
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQ_USER: root
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: integration_test
|
||||
ports:
|
||||
@@ -28,7 +27,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.4', '8.1']
|
||||
php-versions: ['8.0', '8.1', '8.2']
|
||||
branches: ['master']
|
||||
|
||||
steps:
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
php-versions: ['7.4', '8.0', '8.1']
|
||||
php-versions: ['8.0', '8.1', '8.2']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
Generated
+1
@@ -3,3 +3,4 @@
|
||||
!/codeStyles
|
||||
!/fileTemplates
|
||||
!/inspectionProfiles
|
||||
!misc.xml
|
||||
|
||||
Generated
+9
@@ -2,10 +2,19 @@
|
||||
<code_scheme name="Project" version="173">
|
||||
<PHPCodeStyleSettings>
|
||||
<option name="GROUP_USE_WRAP" value="2" />
|
||||
<option name="VARIABLE_NAMING_STYLE" value="CAMEL_CASE" />
|
||||
<option name="KEEP_RPAREN_AND_LBRACE_ON_ONE_LINE" value="true" />
|
||||
<option name="FORCE_EMPTY_METHODS_IN_ONE_LINE" value="true" />
|
||||
</PHPCodeStyleSettings>
|
||||
<codeStyleSettings language="PHP">
|
||||
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
||||
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PhpEntryPointsManager">
|
||||
<pattern value="\Espo\Controllers\*" member="*Action*" />
|
||||
<pattern value="\Espo\Modules\*\Controllers\*" member="*Action*" />
|
||||
</component>
|
||||
</project>
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -10,7 +10,7 @@ It's a web application with a frontend designed as a single page application and
|
||||
|
||||
### Requirements
|
||||
|
||||
* PHP 7.4 and later (with pdo, json, gd, openssl, zip, imap, mbstring, curl extensions);
|
||||
* PHP 8.0 and later;
|
||||
* MySQL 5.7 (and later), or MariaDB 10.1 (and later).
|
||||
|
||||
For more information about server configuration see [this article](https://docs.espocrm.com/administration/server-configuration/).
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -27,9 +27,19 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Binding;
|
||||
namespace Espo;
|
||||
|
||||
class DefaultBinding implements BindingProcessor
|
||||
use Espo\Core\Binding\Binder;
|
||||
use Espo\Core\Binding\BindingProcessor;
|
||||
use Espo\Core\Binding\Key\NamedClassKey;
|
||||
|
||||
/**
|
||||
* Default binding for the dependency injection framework. Custom binding should be set up in
|
||||
* `Espo\Modules\{ModuleName}\Binding` or `Espo\Custom\Binding`.
|
||||
*
|
||||
* @link https://docs.espocrm.com/development/di/#binding.
|
||||
*/
|
||||
class Binding implements BindingProcessor
|
||||
{
|
||||
public function process(Binder $binder): void
|
||||
{
|
||||
@@ -108,7 +118,7 @@ class DefaultBinding implements BindingProcessor
|
||||
);
|
||||
|
||||
$binder->bindService(
|
||||
'Espo\\Core\\SelectBuilderFactory',
|
||||
'Espo\\Core\\Select\\SelectBuilderFactory',
|
||||
'selectBuilderFactory'
|
||||
);
|
||||
|
||||
@@ -128,7 +138,7 @@ class DefaultBinding implements BindingProcessor
|
||||
);
|
||||
|
||||
$binder->bindService(
|
||||
'Espo\\Core\\Utils\\HookManager',
|
||||
'Espo\\Core\\HookManager',
|
||||
'hookManager'
|
||||
);
|
||||
|
||||
@@ -153,12 +163,12 @@ class DefaultBinding implements BindingProcessor
|
||||
);
|
||||
|
||||
$binder->bindService(
|
||||
'Espo\\Core\\Utils\\Language $baseLanguage',
|
||||
NamedClassKey::create('Espo\\Core\\Utils\\Language', 'baseLanguage'),
|
||||
'baseLanguage'
|
||||
);
|
||||
|
||||
$binder->bindService(
|
||||
'Espo\\Core\\Utils\\Language $defaultLanguage',
|
||||
NamedClassKey::create('Espo\\Core\\Utils\\Language', 'defaultLanguage'),
|
||||
'defaultLanguage'
|
||||
);
|
||||
|
||||
@@ -173,7 +183,7 @@ class DefaultBinding implements BindingProcessor
|
||||
);
|
||||
|
||||
$binder->bindService(
|
||||
'Espo\\Core\\AclManager $internalAclManager',
|
||||
NamedClassKey::create('Espo\\Core\\AclManager', 'internalAclManager'),
|
||||
'internalAclManager'
|
||||
);
|
||||
|
||||
@@ -219,6 +229,35 @@ class DefaultBinding implements BindingProcessor
|
||||
'Espo\\Core\\Sms\\Sender',
|
||||
'Espo\\Core\\Sms\\SenderFactory'
|
||||
);
|
||||
|
||||
$binder->bindImplementation(
|
||||
'Espo\\Core\\Authentication\\Jwt\\KeyFactory',
|
||||
'Espo\\Core\\Authentication\\Jwt\\DefaultKeyFactory'
|
||||
);
|
||||
|
||||
$binder
|
||||
->for('Espo\\Core\\Authentication\\Oidc\\TokenValidator')
|
||||
->bindImplementation(
|
||||
'Espo\\Core\\Authentication\\Jwt\\SignatureVerifierFactory',
|
||||
'Espo\\Core\\Authentication\\Oidc\\DefaultSignatureVerifierFactory'
|
||||
);
|
||||
|
||||
$binder
|
||||
->for('Espo\\Core\\Authentication\\Oidc\\Login')
|
||||
->bindImplementation(
|
||||
'Espo\\Core\\Authentication\\Oidc\\UserProvider',
|
||||
'Espo\\Core\\Authentication\\Oidc\\DefaultUserProvider'
|
||||
);
|
||||
|
||||
$binder->bindImplementation(
|
||||
'Espo\\Core\\Mail\\Importer\\ParentFinder',
|
||||
'Espo\\Core\\Mail\\Importer\\DefaultParentFinder'
|
||||
);
|
||||
|
||||
$binder->bindImplementation(
|
||||
'Espo\\Core\\Mail\\Importer\\DuplicateFinder',
|
||||
'Espo\\Core\\Mail\\Importer\\DefaultDuplicateFinder'
|
||||
);
|
||||
}
|
||||
|
||||
private function bindAcl(Binder $binder): void
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,16 +29,13 @@
|
||||
|
||||
namespace Espo\Classes\Acl\ActionHistoryRecord;
|
||||
|
||||
use Espo\Entities\ActionHistoryRecord;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\OwnershipOwnChecker,
|
||||
};
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\ActionHistoryRecord>
|
||||
* @implements OwnershipOwnChecker<ActionHistoryRecord>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,22 +29,17 @@
|
||||
|
||||
namespace Espo\Classes\Acl\Attachment;
|
||||
|
||||
use Espo\Entities\{
|
||||
User,
|
||||
Note,
|
||||
Attachment,
|
||||
};
|
||||
|
||||
use Espo\Entities\Attachment;
|
||||
use Espo\Entities\Note;
|
||||
use Espo\Entities\Settings;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
ORM\EntityManager,
|
||||
AclManager,
|
||||
Acl\ScopeData,
|
||||
Acl\DefaultAccessChecker,
|
||||
Acl\AccessEntityCREDChecker,
|
||||
Acl\Traits\DefaultAccessCheckerDependency,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDChecker;
|
||||
use Espo\Core\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
use Espo\Core\AclManager;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDChecker<Attachment>
|
||||
@@ -53,9 +48,8 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
private $aclManager;
|
||||
|
||||
private $entityManager;
|
||||
private AclManager $aclManager;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(
|
||||
DefaultAccessChecker $defaultAccessChecker,
|
||||
@@ -71,7 +65,7 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
/** @var Attachment $entity */
|
||||
|
||||
if ($entity->get('parentType') === 'Settings') {
|
||||
if ($entity->get('parentType') === Settings::ENTITY_TYPE) {
|
||||
// Allow the logo.
|
||||
return true;
|
||||
}
|
||||
@@ -99,7 +93,7 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($parent->getEntityType() === 'Note') {
|
||||
if ($parent->getEntityType() === Note::ENTITY_TYPE) {
|
||||
/** @var Note $parent */
|
||||
$result = $this->checkEntityReadNoteParent($user, $parent);
|
||||
|
||||
@@ -145,7 +139,7 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
|
||||
if ($note->getTargetType() === Note::TARGET_USERS) {
|
||||
$isRelated = $this->entityManager
|
||||
->getRDBRepository('Note')
|
||||
->getRDBRepository(Note::ENTITY_TYPE)
|
||||
->getRelation($note, 'users')
|
||||
->isRelated($user);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,16 +29,13 @@
|
||||
|
||||
namespace Espo\Classes\Acl\Attachment;
|
||||
|
||||
use Espo\Entities\Attachment;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\OwnershipOwnChecker,
|
||||
};
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\Attachment>
|
||||
* @implements OwnershipOwnChecker<Attachment>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,24 +29,20 @@
|
||||
|
||||
namespace Espo\Classes\Acl\AuthToken;
|
||||
|
||||
use Espo\Entities\AuthToken;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\ScopeData,
|
||||
Acl\DefaultAccessChecker,
|
||||
Acl\AccessEntityCREDChecker,
|
||||
Acl\Traits\DefaultAccessCheckerDependency,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDChecker;
|
||||
use Espo\Core\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDChecker<\Espo\Entities\AuthToken>
|
||||
* @implements AccessEntityCREDChecker<AuthToken>
|
||||
*/
|
||||
class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
private $defaultAccessChecker;
|
||||
|
||||
public function __construct(DefaultAccessChecker $defaultAccessChecker)
|
||||
{
|
||||
$this->defaultAccessChecker = $defaultAccessChecker;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -31,19 +31,15 @@ namespace Espo\Classes\Acl\Email;
|
||||
|
||||
use Espo\Entities\User;
|
||||
use Espo\Entities\Email;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\Table,
|
||||
Acl\ScopeData,
|
||||
Acl\DefaultAccessChecker,
|
||||
Acl\AccessEntityCREDSChecker,
|
||||
Acl\Traits\DefaultAccessCheckerDependency,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDSChecker;
|
||||
use Espo\Core\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Table;
|
||||
use Espo\Core\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDSChecker<\Espo\Entities\Email>
|
||||
* @implements AccessEntityCREDSChecker<Email>
|
||||
*/
|
||||
class AccessChecker implements AccessEntityCREDSChecker
|
||||
{
|
||||
@@ -129,7 +125,10 @@ class AccessChecker implements AccessEntityCREDSChecker
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($entity->get('status') !== 'Sent' && $entity->get('status') !== 'Archived') {
|
||||
if (
|
||||
$entity->getStatus() !== Email::STATUS_SENT &&
|
||||
$entity->getStatus() !== Email::STATUS_ARCHIVED
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -30,12 +30,8 @@
|
||||
namespace Espo\Classes\Acl\Email;
|
||||
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\DefaultAssignmentChecker,
|
||||
};
|
||||
use Espo\Core\Acl\DefaultAssignmentChecker;
|
||||
|
||||
class AssignmentChecker extends DefaultAssignmentChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -34,15 +34,13 @@ use Espo\Entities\Email;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\DefaultOwnershipChecker,
|
||||
Acl\OwnershipOwnChecker,
|
||||
Acl\OwnershipTeamChecker,
|
||||
};
|
||||
use Espo\Core\Acl\DefaultOwnershipChecker;
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
use Espo\Core\Acl\OwnershipTeamChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\Email>
|
||||
* @implements OwnershipTeamChecker<\Espo\Entities\Email>
|
||||
* @implements OwnershipOwnChecker<Email>
|
||||
* @implements OwnershipTeamChecker<Email>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker, OwnershipTeamChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,51 +29,56 @@
|
||||
|
||||
namespace Espo\Classes\Acl\EmailFilter;
|
||||
|
||||
use Espo\Entities\EmailAccount;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\Entities\EmailFilter;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\OwnershipOwnChecker,
|
||||
ORM\EntityManager,
|
||||
};
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\EmailFilter>
|
||||
* @implements OwnershipOwnChecker<EmailFilter>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
private $entityManager;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(EntityManager $entityManager)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EmailFilter $entity
|
||||
*/
|
||||
public function checkOwn(User $user, Entity $entity): bool
|
||||
{
|
||||
if (!$entity->has('parentId') || !$entity->has('parentType')) {
|
||||
if ($entity->isGlobal()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$parentType = $entity->get('parentType');
|
||||
$parentId = $entity->get('parentId');
|
||||
$parentType = $entity->getParentType();
|
||||
$parentId = $entity->getParentId();
|
||||
|
||||
if (!$parentType || !$parentId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$parent = $this->entityManager->getEntity($parentType, $parentId);
|
||||
$parent = $this->entityManager->getEntityById($parentType, $parentId);
|
||||
|
||||
if (!$parent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($parent->getEntityType() === 'User') {
|
||||
if ($parent->getEntityType() === User::ENTITY_TYPE) {
|
||||
return $parent->getId() === $user->getId();
|
||||
}
|
||||
|
||||
if ($parent->has('assignedUserId') && $parent->get('assignedUserId') === $user->getId()) {
|
||||
if (
|
||||
$parent instanceof EmailAccount &&
|
||||
$parent->has('assignedUserId') &&
|
||||
$parent->get('assignedUserId') === $user->getId()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,19 +29,16 @@
|
||||
|
||||
namespace Espo\Classes\Acl\Import;
|
||||
|
||||
use Espo\Entities\Import;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\ScopeData,
|
||||
Acl\AccessEntityReadChecker,
|
||||
Acl\AccessEntityDeleteChecker,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityDeleteChecker;
|
||||
use Espo\Core\Acl\AccessEntityReadChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityReadChecker<\Espo\Entities\Import>
|
||||
* @implements AccessEntityDeleteChecker<\Espo\Entities\Import>
|
||||
* @implements AccessEntityReadChecker<Import>
|
||||
* @implements AccessEntityDeleteChecker<Import>
|
||||
*/
|
||||
class AccessChecker implements AccessEntityReadChecker, AccessEntityDeleteChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -31,40 +31,32 @@ namespace Espo\Classes\Acl\Note;
|
||||
|
||||
use Espo\Entities\Note;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\ScopeData,
|
||||
Acl\DefaultAccessChecker,
|
||||
Acl\AccessEntityCREDChecker,
|
||||
Acl\Traits\DefaultAccessCheckerDependency,
|
||||
AclManager,
|
||||
ORM\EntityManager,
|
||||
Utils\Config,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDChecker;
|
||||
use Espo\Core\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
use Espo\Core\AclManager;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Core\Utils\Config;
|
||||
|
||||
use DateTime;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDChecker<\Espo\Entities\Note>
|
||||
* @implements AccessEntityCREDChecker<Note>
|
||||
*/
|
||||
class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
private const EDIT_PERIOD = '7 days';
|
||||
|
||||
private const DELETE_PERIOD = '1 month';
|
||||
|
||||
private $defaultAccessChecker;
|
||||
|
||||
private $aclManager;
|
||||
|
||||
private $entityManager;
|
||||
|
||||
private $config;
|
||||
private DefaultAccessChecker $defaultAccessChecker;
|
||||
private AclManager $aclManager;
|
||||
private EntityManager $entityManager;
|
||||
private Config $config;
|
||||
|
||||
public function __construct(
|
||||
DefaultAccessChecker $defaultAccessChecker,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -31,13 +31,11 @@ namespace Espo\Classes\Acl\Note;
|
||||
|
||||
use Espo\Entities\Note;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\Note>
|
||||
* @implements OwnershipOwnChecker<Note>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,16 +29,13 @@
|
||||
|
||||
namespace Espo\Classes\Acl\Notification;
|
||||
|
||||
use Espo\Entities\Notification;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\OwnershipOwnChecker,
|
||||
};
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\Notification>
|
||||
* @implements OwnershipOwnChecker<Notification>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,27 +29,24 @@
|
||||
|
||||
namespace Espo\Classes\Acl\Portal;
|
||||
|
||||
use Espo\Entities\Portal;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\ScopeData,
|
||||
Acl\DefaultAccessChecker,
|
||||
Acl\AccessEntityCREDChecker,
|
||||
Acl\Traits\DefaultAccessCheckerDependency,
|
||||
Acl\Table,
|
||||
AclManager,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDChecker;
|
||||
use Espo\Core\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Table;
|
||||
use Espo\Core\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
use Espo\Core\AclManager;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDChecker<\Espo\Entities\Portal>
|
||||
* @implements AccessEntityCREDChecker<Portal>
|
||||
*/
|
||||
class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
private $defaultAccessChecker;
|
||||
|
||||
private $aclManager;
|
||||
private DefaultAccessChecker $defaultAccessChecker;
|
||||
private AclManager $aclManager;
|
||||
|
||||
public function __construct(DefaultAccessChecker $defaultAccessChecker, AclManager $aclManager)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,25 +29,22 @@
|
||||
|
||||
namespace Espo\Classes\Acl\ScheduledJob;
|
||||
|
||||
use Espo\Entities\ScheduledJob;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\ScopeData,
|
||||
Acl\DefaultAccessChecker,
|
||||
Acl\AccessEntityCREDChecker,
|
||||
Acl\Traits\DefaultAccessCheckerDependency,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDChecker;
|
||||
use Espo\Core\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDChecker<\Espo\Entities\ScheduledJob>
|
||||
* @implements AccessEntityCREDChecker<ScheduledJob>
|
||||
*/
|
||||
class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
private $defaultAccessChecker;
|
||||
private DefaultAccessChecker $defaultAccessChecker;
|
||||
|
||||
public function __construct(DefaultAccessChecker $defaultAccessChecker)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,16 +29,13 @@
|
||||
|
||||
namespace Espo\Classes\Acl\Team;
|
||||
|
||||
use Espo\Entities\Team;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\OwnershipOwnChecker,
|
||||
};
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\Team>
|
||||
* @implements OwnershipOwnChecker<Team>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -30,17 +30,13 @@
|
||||
namespace Espo\Classes\Acl\User;
|
||||
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\Table,
|
||||
Acl\ScopeData,
|
||||
Acl\DefaultAccessChecker,
|
||||
Acl\AccessEntityCREDSChecker,
|
||||
Acl\Traits\DefaultAccessCheckerDependency,
|
||||
AclManager,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDSChecker;
|
||||
use Espo\Core\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Table;
|
||||
use Espo\Core\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
use Espo\Core\AclManager;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDSChecker<User>
|
||||
@@ -49,9 +45,8 @@ class AccessChecker implements AccessEntityCREDSChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
private $defaultAccessChecker;
|
||||
|
||||
private $aclManager;
|
||||
private DefaultAccessChecker $defaultAccessChecker;
|
||||
private AclManager $aclManager;
|
||||
|
||||
public function __construct(DefaultAccessChecker $defaultAccessChecker, AclManager $aclManager)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -32,15 +32,12 @@ namespace Espo\Classes\Acl\User;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\OwnershipOwnChecker,
|
||||
Acl\OwnershipTeamChecker,
|
||||
};
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
use Espo\Core\Acl\OwnershipTeamChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\User>
|
||||
* @implements OwnershipTeamChecker<\Espo\Entities\User>
|
||||
* @implements OwnershipOwnChecker<User>
|
||||
* @implements OwnershipTeamChecker<User>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker, OwnershipTeamChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -30,25 +30,20 @@
|
||||
namespace Espo\Classes\Acl\Webhook;
|
||||
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\Entities\Webhook;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\ScopeData,
|
||||
Acl\DefaultAccessChecker,
|
||||
Acl\AccessEntityCREDChecker,
|
||||
Acl\Traits\DefaultAccessCheckerDependency,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDChecker;
|
||||
use Espo\Core\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDChecker<\Espo\Entities\Webhook>
|
||||
* @implements AccessEntityCREDChecker<Webhook>
|
||||
*/
|
||||
class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
private $defaultAccessChecker;
|
||||
|
||||
public function __construct(DefaultAccessChecker $defaultAccessChecker)
|
||||
{
|
||||
$this->defaultAccessChecker = $defaultAccessChecker;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\Acl\WorkingTimeRange;
|
||||
|
||||
use Espo\Core\Acl\AssignmentChecker as AssignmentCheckerInterface;
|
||||
use Espo\Core\Acl\DefaultAssignmentChecker;
|
||||
use Espo\Core\AclManager;
|
||||
use Espo\Entities\User;
|
||||
use Espo\Entities\WorkingTimeRange;
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* @implements AssignmentCheckerInterface<WorkingTimeRange>
|
||||
*/
|
||||
class AssignmentChecker implements AssignmentCheckerInterface
|
||||
{
|
||||
private DefaultAssignmentChecker $defaultAssignmentChecker;
|
||||
private AclManager $aclManager;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(
|
||||
DefaultAssignmentChecker $defaultAssignmentChecker,
|
||||
AclManager $aclManager,
|
||||
EntityManager $entityManager
|
||||
) {
|
||||
$this->defaultAssignmentChecker = $defaultAssignmentChecker;
|
||||
$this->aclManager = $aclManager;
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WorkingTimeRange $entity
|
||||
*/
|
||||
public function check(User $user, Entity $entity): bool
|
||||
{
|
||||
$result = $this->defaultAssignmentChecker->check($user, $entity);
|
||||
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$entity->isAttributeChanged('usersIds')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$users = $this->entityManager
|
||||
->getRDBRepositoryByClass(User::class)
|
||||
->where(['id' => $entity->getUsers()->getIdList()])
|
||||
->find();
|
||||
|
||||
foreach ($users as $targetUser) {
|
||||
$accessToUser = $this->aclManager->check($user, $targetUser);
|
||||
|
||||
if (!$accessToUser) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,22 +29,17 @@
|
||||
|
||||
namespace Espo\Classes\AclPortal\Attachment;
|
||||
|
||||
use Espo\Entities\{
|
||||
User,
|
||||
Note,
|
||||
Attachment,
|
||||
};
|
||||
|
||||
use Espo\Entities\Attachment;
|
||||
use Espo\Entities\Note;
|
||||
use Espo\Entities\Settings;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
ORM\EntityManager,
|
||||
Portal\AclManager,
|
||||
Acl\ScopeData,
|
||||
Acl\AccessEntityCREDChecker,
|
||||
Portal\Acl\DefaultAccessChecker,
|
||||
Portal\Acl\Traits\DefaultAccessCheckerDependency,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Core\Portal\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Portal\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
use Espo\Core\Portal\AclManager;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDChecker<Attachment>
|
||||
@@ -53,11 +48,9 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
private $defaultAccessChecker;
|
||||
|
||||
private $aclManager;
|
||||
|
||||
private $entityManager;
|
||||
private DefaultAccessChecker $defaultAccessChecker;
|
||||
private AclManager $aclManager;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(
|
||||
DefaultAccessChecker $defaultAccessChecker,
|
||||
@@ -73,7 +66,7 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
/** @var Attachment $entity */
|
||||
|
||||
if ($entity->get('parentType') === 'Settings') {
|
||||
if ($entity->get('parentType') === Settings::ENTITY_TYPE) {
|
||||
// Allow the logo.
|
||||
return true;
|
||||
}
|
||||
@@ -101,7 +94,7 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($parent->getEntityType() === 'Note') {
|
||||
if ($parent->getEntityType() === Note::ENTITY_TYPE) {
|
||||
/** @var Note $parent */
|
||||
$result = $this->checkEntityReadNoteParent($user, $parent);
|
||||
|
||||
@@ -151,7 +144,7 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
|
||||
if ($note->getTargetType() === Note::TARGET_USERS) {
|
||||
$isRelated = $this->entityManager
|
||||
->getRDBRepository('Note')
|
||||
->getRDBRepository(Note::ENTITY_TYPE)
|
||||
->getRelation($note, 'users')
|
||||
->isRelated($user);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,16 +29,13 @@
|
||||
|
||||
namespace Espo\Classes\AclPortal\Attachment;
|
||||
|
||||
use Espo\Entities\Attachment;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\OwnershipOwnChecker,
|
||||
};
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\Attachment>
|
||||
* @implements OwnershipOwnChecker<Attachment>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,29 +29,23 @@
|
||||
|
||||
namespace Espo\Classes\AclPortal\Email;
|
||||
|
||||
use Espo\Entities\Email;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\Table,
|
||||
Acl\ScopeData,
|
||||
Acl\AccessEntityCREDSChecker,
|
||||
Portal\Acl\DefaultAccessChecker,
|
||||
Portal\Acl\Traits\DefaultAccessCheckerDependency,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDSChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Table;
|
||||
use Espo\Core\Portal\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Portal\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDSChecker<\Espo\Entities\Email>
|
||||
* @implements AccessEntityCREDSChecker<Email>
|
||||
*/
|
||||
class AccessChecker implements AccessEntityCREDSChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
private $defaultAccessChecker;
|
||||
|
||||
public function __construct(
|
||||
DefaultAccessChecker $defaultAccessChecker
|
||||
) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,16 +29,13 @@
|
||||
|
||||
namespace Espo\Classes\AclPortal\Email;
|
||||
|
||||
use Espo\Entities\Email;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\OwnershipOwnChecker,
|
||||
};
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\Email>
|
||||
* @implements OwnershipOwnChecker<Email>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -31,40 +31,32 @@ namespace Espo\Classes\AclPortal\Note;
|
||||
|
||||
use Espo\Entities\Note;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Portal\AclManager,
|
||||
Acl\ScopeData,
|
||||
Acl\AccessEntityCREDChecker,
|
||||
Portal\Acl\DefaultAccessChecker,
|
||||
Portal\Acl\Traits\DefaultAccessCheckerDependency,
|
||||
ORM\EntityManager,
|
||||
Utils\Config,
|
||||
};
|
||||
use Espo\Core\Acl\AccessEntityCREDChecker;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Core\Portal\Acl\DefaultAccessChecker;
|
||||
use Espo\Core\Portal\Acl\Traits\DefaultAccessCheckerDependency;
|
||||
use Espo\Core\Portal\AclManager;
|
||||
use Espo\Core\Utils\Config;
|
||||
|
||||
use DateTime;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @implements AccessEntityCREDChecker<\Espo\Entities\Note>
|
||||
* @implements AccessEntityCREDChecker<Note>
|
||||
*/
|
||||
class AccessChecker implements AccessEntityCREDChecker
|
||||
{
|
||||
use DefaultAccessCheckerDependency;
|
||||
|
||||
private const EDIT_PERIOD = '7 days';
|
||||
|
||||
private const DELETE_PERIOD = '1 month';
|
||||
|
||||
private $defaultAccessChecker;
|
||||
|
||||
private $aclManager;
|
||||
|
||||
private $entityManager;
|
||||
|
||||
private $config;
|
||||
private DefaultAccessChecker $defaultAccessChecker;
|
||||
private AclManager $aclManager;
|
||||
private EntityManager $entityManager;
|
||||
private Config $config;
|
||||
|
||||
public function __construct(
|
||||
DefaultAccessChecker $defaultAccessChecker,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -31,13 +31,11 @@ namespace Espo\Classes\AclPortal\Note;
|
||||
|
||||
use Espo\Entities\Note;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\Note>
|
||||
* @implements OwnershipOwnChecker<Note>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,16 +29,13 @@
|
||||
|
||||
namespace Espo\Classes\AclPortal\Notification;
|
||||
|
||||
use Espo\Entities\Notification;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\OwnershipOwnChecker,
|
||||
};
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\Notification>
|
||||
* @implements OwnershipOwnChecker<Notification>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -30,15 +30,11 @@
|
||||
namespace Espo\Classes\AclPortal\User;
|
||||
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\OwnershipOwnChecker,
|
||||
};
|
||||
use Espo\Core\Acl\OwnershipOwnChecker;
|
||||
|
||||
/**
|
||||
* @implements OwnershipOwnChecker<\Espo\Entities\User>
|
||||
* @implements OwnershipOwnChecker<User>
|
||||
*/
|
||||
class OwnershipChecker implements OwnershipOwnChecker
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,16 +29,14 @@
|
||||
|
||||
namespace Espo\Classes\AppInfo;
|
||||
|
||||
use Espo\Core\{
|
||||
Utils\Module,
|
||||
Binding\EspoBindingLoader,
|
||||
Binding\Binding as BindingItem,
|
||||
Console\Command\Params,
|
||||
};
|
||||
use Espo\Core\Binding\Binding as BindingItem;
|
||||
use Espo\Core\Binding\EspoBindingLoader;
|
||||
use Espo\Core\Console\Command\Params;
|
||||
use Espo\Core\Utils\Module;
|
||||
|
||||
class Binding
|
||||
{
|
||||
private $module;
|
||||
private Module $module;
|
||||
|
||||
public function __construct(Module $module)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\AppParams;
|
||||
|
||||
use Espo\Entities\Extension;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\Tools\App\AppParam;
|
||||
use stdClass;
|
||||
|
||||
class Extensions implements AppParam
|
||||
{
|
||||
private User $user;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(
|
||||
User $user,
|
||||
EntityManager $entityManager
|
||||
) {
|
||||
$this->user = $user;
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return stdClass[]
|
||||
*/
|
||||
public function get(): array
|
||||
{
|
||||
if (!$this->user->isRegular() && !$this->user->isAdmin()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$extensionList = $this->entityManager
|
||||
->getRDBRepositoryByClass(Extension::class)
|
||||
->where([
|
||||
'licenseStatus' => [
|
||||
Extension::LICENSE_STATUS_INVALID,
|
||||
Extension::LICENSE_STATUS_EXPIRED,
|
||||
Extension::LICENSE_STATUS_SOFT_EXPIRED,
|
||||
],
|
||||
])
|
||||
->find();
|
||||
|
||||
$list = [];
|
||||
|
||||
foreach ($extensionList as $extension) {
|
||||
$list[] = (object) [
|
||||
'name' => $extension->getName(),
|
||||
'version' => $extension->getVersion(),
|
||||
'licenseStatus' => $extension->getLicenseStatus(),
|
||||
'licenseStatusMessage' => $extension->getLicenseStatusMessage(),
|
||||
'isInstalled' => $extension->isInstalled(),
|
||||
'notify' => in_array(
|
||||
$extension->getLicenseStatus(),
|
||||
[
|
||||
Extension::LICENSE_STATUS_INVALID,
|
||||
Extension::LICENSE_STATUS_EXPIRED,
|
||||
]
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,11 +29,10 @@
|
||||
|
||||
namespace Espo\Classes\AppParams;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl,
|
||||
Select\SelectBuilderFactory,
|
||||
ORM\EntityManager,
|
||||
};
|
||||
use Espo\Core\Acl;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Core\Select\SelectBuilderFactory;
|
||||
use Espo\Entities\Template;
|
||||
use Espo\Tools\App\AppParam;
|
||||
|
||||
/**
|
||||
@@ -42,9 +41,7 @@ use Espo\Tools\App\AppParam;
|
||||
class TemplateEntityTypeList implements AppParam
|
||||
{
|
||||
private Acl $acl;
|
||||
|
||||
private SelectBuilderFactory $selectBuilderFactory;
|
||||
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(
|
||||
@@ -62,7 +59,7 @@ class TemplateEntityTypeList implements AppParam
|
||||
*/
|
||||
public function get(): array
|
||||
{
|
||||
if (!$this->acl->checkScope('Template')) {
|
||||
if (!$this->acl->checkScope(Template::ENTITY_TYPE)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -70,7 +67,7 @@ class TemplateEntityTypeList implements AppParam
|
||||
|
||||
$query = $this->selectBuilderFactory
|
||||
->create()
|
||||
->from('Template')
|
||||
->from(Template::ENTITY_TYPE)
|
||||
->withAccessControlFilter()
|
||||
->buildQueryBuilder()
|
||||
->select(['entityType'])
|
||||
@@ -78,12 +75,12 @@ class TemplateEntityTypeList implements AppParam
|
||||
->build();
|
||||
|
||||
$templateCollection = $this->entityManager
|
||||
->getRDBRepository('Template')
|
||||
->getRDBRepositoryByClass(Template::class)
|
||||
->clone($query)
|
||||
->find();
|
||||
|
||||
foreach ($templateCollection as $template) {
|
||||
$list[] = $template->get('entityType');
|
||||
$list[] = $template->getTargetEntityType();
|
||||
}
|
||||
|
||||
return $list;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,65 +29,61 @@
|
||||
|
||||
namespace Espo\Classes\AssignmentNotificators;
|
||||
|
||||
use Espo\Services\Email as EmailService;
|
||||
use Espo\Services\Stream as StreamService;
|
||||
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Entities\EmailAddress;
|
||||
use Espo\Entities\EmailFolder;
|
||||
use Espo\Modules\Crm\Entities\Account;
|
||||
use Espo\Modules\Crm\Entities\Contact;
|
||||
use Espo\Modules\Crm\Entities\Lead;
|
||||
use Espo\Tools\Stream\Service as StreamService;
|
||||
use Espo\Core\Notification\AssignmentNotificator;
|
||||
use Espo\Core\Notification\AssignmentNotificator\Params;
|
||||
use Espo\Core\Notification\UserEnabledChecker;
|
||||
use Espo\Core\InjectableFactory;
|
||||
use Espo\Core\AclManager;
|
||||
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Entities\User;
|
||||
use Espo\Entities\Notification;
|
||||
use Espo\Entities\Email as EmailEntity;
|
||||
|
||||
use Espo\Repositories\Email as EmailRepository;
|
||||
use Espo\Repositories\EmailAddress as EmailAddressRepository;
|
||||
use Espo\Tools\Email\Util;
|
||||
|
||||
use DateTime;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @implements AssignmentNotificator<EmailEntity>
|
||||
*/
|
||||
class Email implements AssignmentNotificator
|
||||
{
|
||||
private const DAYS_THRESHOLD = 2;
|
||||
|
||||
private ?StreamService $streamService = null;
|
||||
|
||||
private $user;
|
||||
|
||||
private $entityManager;
|
||||
|
||||
private $injectableFactory;
|
||||
|
||||
private $aclManager;
|
||||
|
||||
private $userChecker;
|
||||
private User $user;
|
||||
private EntityManager $entityManager;
|
||||
private UserEnabledChecker $userChecker;
|
||||
private AclManager $aclManager;
|
||||
private StreamService $streamService;
|
||||
|
||||
public function __construct(
|
||||
User $user,
|
||||
EntityManager $entityManager,
|
||||
UserEnabledChecker $userChecker,
|
||||
InjectableFactory $injectableFactory,
|
||||
AclManager $aclManager
|
||||
AclManager $aclManager,
|
||||
StreamService $streamService
|
||||
) {
|
||||
$this->user = $user;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->userChecker = $userChecker;
|
||||
$this->injectableFactory = $injectableFactory;
|
||||
$this->aclManager = $aclManager;
|
||||
$this->streamService = $streamService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EmailEntity $entity
|
||||
*/
|
||||
public function process(Entity $entity, Params $params): void
|
||||
{
|
||||
/** @var EmailEntity $entity */
|
||||
|
||||
if (
|
||||
!in_array(
|
||||
$entity->get('status'),
|
||||
$entity->getStatus(),
|
||||
[
|
||||
EmailEntity::STATUS_ARCHIVED,
|
||||
EmailEntity::STATUS_SENT,
|
||||
@@ -109,26 +105,19 @@ class Email implements AssignmentNotificator
|
||||
}
|
||||
}
|
||||
|
||||
$dateSent = $entity->get('dateSent');
|
||||
$dateSent = $entity->getDateSent();
|
||||
|
||||
if (!$dateSent) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$dt = new DateTime($dateSent);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($dt->diff(new DateTime())->days > self::DAYS_THRESHOLD) {
|
||||
if ($dateSent->diff(DateTime::createNow())->days > self::DAYS_THRESHOLD) {
|
||||
return;
|
||||
}
|
||||
|
||||
$emailUserIdList = $entity->get('usersIds');
|
||||
|
||||
if (is_null($emailUserIdList) || !is_array($emailUserIdList)) {
|
||||
if (!is_array($emailUserIdList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -146,13 +135,13 @@ class Email implements AssignmentNotificator
|
||||
|
||||
$data = [
|
||||
'emailId' => $entity->getId(),
|
||||
'emailName' => $entity->get('name'),
|
||||
'emailName' => $entity->getSubject(),
|
||||
];
|
||||
|
||||
/** @var EmailRepository $emailRepository */
|
||||
$emailRepository = $this->entityManager->getRepository('Email');
|
||||
$emailRepository = $this->entityManager->getRepository(EmailEntity::ENTITY_TYPE);
|
||||
/** @var EmailAddressRepository $emailAddressRepository */
|
||||
$emailAddressRepository = $this->entityManager->getRepository('EmailAddress');
|
||||
$emailAddressRepository = $this->entityManager->getRepository(EmailAddress::ENTITY_TYPE);
|
||||
|
||||
if (!$entity->has('from')) {
|
||||
$emailRepository->loadFromField($entity);
|
||||
@@ -167,7 +156,11 @@ class Email implements AssignmentNotificator
|
||||
$from = $entity->get('from');
|
||||
|
||||
if ($from) {
|
||||
$person = $emailAddressRepository->getEntityByAddress($from, null, ['User', 'Contact', 'Lead']);
|
||||
$person = $emailAddressRepository->getEntityByAddress($from, null, [
|
||||
User::ENTITY_TYPE,
|
||||
Contact::ENTITY_TYPE,
|
||||
Lead::ENTITY_TYPE,
|
||||
]);
|
||||
|
||||
if ($person) {
|
||||
$data['personEntityType'] = $person->getEntityType();
|
||||
@@ -178,12 +171,12 @@ class Email implements AssignmentNotificator
|
||||
|
||||
$userIdFrom = null;
|
||||
|
||||
if ($person && $person->getEntityType() === 'User') {
|
||||
if ($person && $person->getEntityType() === User::ENTITY_TYPE) {
|
||||
$userIdFrom = $person->getId();
|
||||
}
|
||||
|
||||
if (empty($data['personEntityId'])) {
|
||||
$data['fromString'] = EmailService::parseFromName($entity->get('fromString'));
|
||||
$data['fromString'] = Util::parseFromName($entity->getFromString());
|
||||
|
||||
if (empty($data['fromString']) && $from) {
|
||||
$data['fromString'] = $from;
|
||||
@@ -192,8 +185,8 @@ class Email implements AssignmentNotificator
|
||||
|
||||
$parent = null;
|
||||
|
||||
$parentId = $entity->get('parentId');
|
||||
$parentType = $entity->get('parentType');
|
||||
$parentId = $entity->getParentId();
|
||||
$parentType = $entity->getParentType();
|
||||
|
||||
if ($parentType && $parentId) {
|
||||
$parent = $this->entityManager->getEntityById($parentType, $parentId);
|
||||
@@ -201,10 +194,10 @@ class Email implements AssignmentNotificator
|
||||
|
||||
$account = null;
|
||||
|
||||
$accountId = $entity->get('accountId');
|
||||
$accountLink = $entity->getAccount();
|
||||
|
||||
if ($accountId) {
|
||||
$account = $this->entityManager->getEntityById('Account', $accountId);
|
||||
if ($accountLink) {
|
||||
$account = $this->entityManager->getEntityById(Account::ENTITY_TYPE, $accountLink->getId());
|
||||
}
|
||||
|
||||
foreach ($userIdList as $userId) {
|
||||
@@ -216,11 +209,15 @@ class Email implements AssignmentNotificator
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($entity->getLinkMultipleColumn('users', 'inTrash', $userId)) {
|
||||
if ($entity->getLinkMultipleColumn('users', EmailEntity::USERS_COLUMN_IN_TRASH, $userId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$this->userChecker->checkAssignment('Email', $userId)) {
|
||||
if ($entity->getLinkMultipleColumn('users', EmailEntity::USERS_COLUMN_IS_READ, $userId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$this->userChecker->checkAssignment(EmailEntity::ENTITY_TYPE, $userId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -228,25 +225,24 @@ class Email implements AssignmentNotificator
|
||||
$params->getOption('isBeingImported') ||
|
||||
$params->getOption('isJustSent')
|
||||
) {
|
||||
$folderId = $entity->getLinkMultipleColumn('users', 'folderId', $userId);
|
||||
$folderId = $entity->getLinkMultipleColumn('users', EmailEntity::USERS_COLUMN_FOLDER_ID, $userId);
|
||||
|
||||
if ($folderId) {
|
||||
if (
|
||||
$this->entityManager
|
||||
->getRDBRepository('EmailFolder')
|
||||
->where([
|
||||
'id' => $folderId,
|
||||
'skipNotifications' => true,
|
||||
])
|
||||
->count()
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
$folderId &&
|
||||
$this->entityManager
|
||||
->getRDBRepositoryByClass(EmailFolder::class)
|
||||
->where([
|
||||
'id' => $folderId,
|
||||
'skipNotifications' => true,
|
||||
])
|
||||
->count()
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/** @var User|null $user */
|
||||
$user = $this->entityManager->getEntity('User', $userId);
|
||||
/** @var ?User $user */
|
||||
$user = $this->entityManager->getEntityById(User::ENTITY_TYPE, $userId);
|
||||
|
||||
if (!$user) {
|
||||
continue;
|
||||
@@ -256,18 +252,18 @@ class Email implements AssignmentNotificator
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$this->aclManager->checkScope($user, 'Email')) {
|
||||
if (!$this->aclManager->checkScope($user, EmailEntity::ENTITY_TYPE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$isArchivedOrBeingImported =
|
||||
$entity->get('status') === EmailEntity::STATUS_ARCHIVED ||
|
||||
$entity->getStatus() === EmailEntity::STATUS_ARCHIVED ||
|
||||
$params->getOption('isBeingImported');
|
||||
|
||||
if (
|
||||
$isArchivedOrBeingImported &&
|
||||
$parent &&
|
||||
$this->getStreamService()->checkIsFollowed($parent, $userId)
|
||||
$this->streamService->checkIsFollowed($parent, $userId)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
@@ -275,7 +271,7 @@ class Email implements AssignmentNotificator
|
||||
if (
|
||||
$isArchivedOrBeingImported &&
|
||||
$account &&
|
||||
$this->getStreamService()->checkIsFollowed($account, $userId)
|
||||
$this->streamService->checkIsFollowed($account, $userId)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
@@ -286,7 +282,7 @@ class Email implements AssignmentNotificator
|
||||
'type' => Notification::TYPE_EMAIL_RECEIVED,
|
||||
'userId' => $userId,
|
||||
'relatedId' => $entity->getId(),
|
||||
'relatedType' => 'Email',
|
||||
'relatedType' => EmailEntity::ENTITY_TYPE,
|
||||
])
|
||||
->select(['id'])
|
||||
->findOne();
|
||||
@@ -300,17 +296,8 @@ class Email implements AssignmentNotificator
|
||||
'userId' => $userId,
|
||||
'data' => $data,
|
||||
'relatedId' => $entity->getId(),
|
||||
'relatedType' => 'Email',
|
||||
'relatedType' => EmailEntity::ENTITY_TYPE,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function getStreamService(): StreamService
|
||||
{
|
||||
if (empty($this->streamService)) {
|
||||
$this->streamService = $this->injectableFactory->create(StreamService::class);
|
||||
}
|
||||
|
||||
return $this->streamService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -40,7 +40,6 @@ use Espo\Entities\PasswordChangeRequest;
|
||||
class PasswordChangeRequests implements Cleanup
|
||||
{
|
||||
private Config $config;
|
||||
|
||||
private EntityManager $entityManager;
|
||||
|
||||
private string $cleanupPeriod = '30 days';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -31,18 +31,19 @@ namespace Espo\Classes\Cleanup;
|
||||
|
||||
use Espo\Core\Cleanup\Cleanup;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\DateTime as DateTimeUtil;
|
||||
use Espo\Modules\Crm\Entities\Reminder;
|
||||
use Espo\ORM\EntityManager;
|
||||
|
||||
use DateTime;
|
||||
|
||||
class Reminders implements Cleanup
|
||||
{
|
||||
private $config;
|
||||
|
||||
private $entityManager;
|
||||
|
||||
private string $cleanupRemindersPeriod = '15 days';
|
||||
|
||||
private Config $config;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(Config $config, EntityManager $entityManager)
|
||||
{
|
||||
$this->config = $config;
|
||||
@@ -60,9 +61,9 @@ class Reminders implements Cleanup
|
||||
$delete = $this->entityManager
|
||||
->getQueryBuilder()
|
||||
->delete()
|
||||
->from('Reminder')
|
||||
->from(Reminder::ENTITY_TYPE)
|
||||
->where([
|
||||
'remindAt<' => $dt->format('Y-m-d'),
|
||||
'remindAt<' => $dt->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT),
|
||||
])
|
||||
->build();
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\Cleanup;
|
||||
|
||||
use Espo\Core\Cleanup\Cleanup;
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
use Espo\Entities\Subscription;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\ORM\Query\Part\Condition as Cond;
|
||||
|
||||
class Subscribers implements Cleanup
|
||||
{
|
||||
private const PERIOD = '2 months';
|
||||
|
||||
private Metadata $metadata;
|
||||
private EntityManager $entityManager;
|
||||
private Config $config;
|
||||
|
||||
public function __construct(
|
||||
Metadata $metadata,
|
||||
EntityManager $entityManager,
|
||||
Config $config
|
||||
) {
|
||||
$this->metadata = $metadata;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function process(): void
|
||||
{
|
||||
if (!$this->config->get('cleanupSubscribers')) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var string[] $scopeList */
|
||||
$scopeList = array_keys($this->metadata->get(['scopes']) ?? []);
|
||||
|
||||
/** @var string[] $scopeList */
|
||||
$scopeList = array_values(array_filter(
|
||||
$scopeList,
|
||||
fn ($item) => (bool) $this->metadata->get(['scopes', $item, 'stream'])
|
||||
));
|
||||
|
||||
foreach ($scopeList as $scope) {
|
||||
$this->processEntityType($scope);
|
||||
}
|
||||
}
|
||||
|
||||
private function processEntityType(string $entityType): void
|
||||
{
|
||||
/** @var ?array<string, mixed> $data */
|
||||
$data = $this->metadata->get(['streamDefs', $entityType, 'subscribersCleanup']);
|
||||
|
||||
if (!($data['enabled'] ?? false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var string $dateField */
|
||||
$dateField = $data['dateField'] ?? 'createdAt';
|
||||
/** @var ?string[] $statusList */
|
||||
$statusList = $data['statusList'] ?? null;
|
||||
/** @var ?string $statusField */
|
||||
$statusField = $this->metadata->get(['scopes', $entityType, 'statusField']);
|
||||
|
||||
if ($statusList === null || $statusField === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var string $period */
|
||||
$period = $this->metadata->get(['streamDefs', $entityType, 'subscribersCleanup', 'period']) ??
|
||||
$this->config->get('cleanupSubscribersPeriod') ??
|
||||
self::PERIOD;
|
||||
|
||||
$before = DateTime::createNow()->modify('-' . $period);
|
||||
|
||||
$query = $this->entityManager
|
||||
->getQueryBuilder()
|
||||
->delete()
|
||||
->from(Subscription::ENTITY_TYPE, 'subscription')
|
||||
->join(
|
||||
$entityType,
|
||||
'entity',
|
||||
Cond::equal(
|
||||
Cond::column('entity.id'),
|
||||
Cond::column('entityId')
|
||||
)
|
||||
)
|
||||
->where(
|
||||
Cond::and(
|
||||
Cond::equal(
|
||||
Cond::column('entityType'),
|
||||
$entityType
|
||||
),
|
||||
Cond::less(
|
||||
Cond::column('entity.' . $dateField),
|
||||
$before->getString()
|
||||
),
|
||||
Cond::in(
|
||||
Cond::column('entity.' . $statusField),
|
||||
$statusList
|
||||
)
|
||||
)
|
||||
)
|
||||
->build();
|
||||
|
||||
$this->entityManager->getQueryExecutor()->execute($query);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\ConsoleCommands;
|
||||
|
||||
use Espo\Core\Console\Command;
|
||||
use Espo\Core\Console\Command\Params;
|
||||
use Espo\Core\Console\IO;
|
||||
use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
use Espo\Entities\ArrayValue;
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\Repositories\ArrayValue as ArrayValueRepository;
|
||||
|
||||
class PopulateArrayValues implements Command
|
||||
{
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(EntityManager $entityManager)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Error
|
||||
*/
|
||||
public function run(Params $params, IO $io): void
|
||||
{
|
||||
$entityType = $params->getArgument(0);
|
||||
$field = $params->getArgument(1);
|
||||
|
||||
if (!$entityType || !$field) {
|
||||
throw new Error("Entity type and field should be passed as arguments.");
|
||||
}
|
||||
|
||||
if (!$this->entityManager->hasRepository($entityType)) {
|
||||
throw new Error("Bad entity type.");
|
||||
}
|
||||
|
||||
$defs = $this->entityManager->getDefs()->getEntity($entityType);
|
||||
|
||||
if (!$defs->hasAttribute($field)) {
|
||||
throw new Error("Bad field.");
|
||||
}
|
||||
|
||||
if ($defs->getAttribute($field)->getType() !== Entity::JSON_ARRAY) {
|
||||
throw new Error("Non-array field.");
|
||||
}
|
||||
|
||||
if ($defs->getAttribute($field)->isNotStorable()) {
|
||||
throw new Error("Not-storable field.");
|
||||
}
|
||||
|
||||
if (!$defs->getAttribute($field)->getParam('storeArrayValues')) {
|
||||
throw new Error("Array values disabled for the field..");
|
||||
}
|
||||
|
||||
$collection = $this->entityManager
|
||||
->getRDBRepository($entityType)
|
||||
->sth()
|
||||
->find();
|
||||
|
||||
/** @var ArrayValueRepository $repository */
|
||||
$repository = $this->entityManager->getRepository(ArrayValue::ENTITY_TYPE);
|
||||
|
||||
foreach ($collection as $i => $entity) {
|
||||
if (!$entity instanceof CoreEntity) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
$repository->storeEntityAttribute($entity, $field);
|
||||
|
||||
if ($i % 1000 === 0) {
|
||||
$io->write('.');
|
||||
}
|
||||
}
|
||||
|
||||
$io->writeLine('');
|
||||
$io->writeLine('Done.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\ConsoleCommands;
|
||||
|
||||
use Espo\Core\Console\Command;
|
||||
use Espo\Core\Console\Command\Params;
|
||||
use Espo\Core\Console\Exceptions\ArgumentNotSpecified;
|
||||
use Espo\Core\Console\Exceptions\InvalidArgument;
|
||||
use Espo\Core\Console\IO;
|
||||
use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\FieldProcessing\NextNumber\BeforeSaveProcessor;
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
use Espo\Core\ORM\Repository\Option\SaveOption;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\ORM\Query\Part\Order;
|
||||
|
||||
class PopulateNumbers implements Command
|
||||
{
|
||||
private BeforeSaveProcessor $beforeSaveProcessor;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(
|
||||
BeforeSaveProcessor $beforeSaveProcessor,
|
||||
EntityManager $entityManager
|
||||
) {
|
||||
$this->beforeSaveProcessor = $beforeSaveProcessor;
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Error
|
||||
*/
|
||||
public function run(Params $params, IO $io): void
|
||||
{
|
||||
$entityType = $params->getArgument(0);
|
||||
$field = $params->getArgument(1);
|
||||
|
||||
$orderBy = $params->getOption('orderBy') ?? 'createdAt';
|
||||
$order = $params->getOption('order') ?? Order::ASC;
|
||||
|
||||
if (!$entityType) {
|
||||
throw new ArgumentNotSpecified("No entity type argument.");
|
||||
}
|
||||
|
||||
if (!$field) {
|
||||
throw new ArgumentNotSpecified("No field argument.");
|
||||
}
|
||||
|
||||
$fieldType = $this->entityManager
|
||||
->getDefs()
|
||||
->getEntity($entityType)
|
||||
->getField($field)
|
||||
->getType();
|
||||
|
||||
if ($fieldType !== 'number') {
|
||||
throw new InvalidArgument("Field `{$field}` is not of `number` type.");
|
||||
}
|
||||
|
||||
$collection = $this->entityManager
|
||||
->getRDBRepository($entityType)
|
||||
->where([
|
||||
$field => null,
|
||||
])
|
||||
->order($orderBy, $order)
|
||||
->sth()
|
||||
->find();
|
||||
|
||||
foreach ($collection as $i => $entity) {
|
||||
if (!$entity instanceof CoreEntity) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
$this->beforeSaveProcessor->processPopulate($entity, $field);
|
||||
$this->entityManager->saveEntity($entity, [SaveOption::IMPORT => true]);
|
||||
|
||||
if ($i % 1000 === 0) {
|
||||
$io->write('.');
|
||||
}
|
||||
}
|
||||
|
||||
$io->writeLine('');
|
||||
$io->writeLine('Done.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\ConsoleCommands;
|
||||
|
||||
use Espo\Core\Console\Command;
|
||||
use Espo\Core\Console\Command\Params;
|
||||
use Espo\Core\Console\IO;
|
||||
use Espo\Tools\CategoryTree\RebuildPaths;
|
||||
use Exception;
|
||||
|
||||
class RebuildCategoryPaths implements Command
|
||||
{
|
||||
private RebuildPaths $rebuildPaths;
|
||||
|
||||
public function __construct(RebuildPaths $rebuildPaths)
|
||||
{
|
||||
$this->rebuildPaths = $rebuildPaths;
|
||||
}
|
||||
|
||||
public function run(Params $params, IO $io): void
|
||||
{
|
||||
$entityType = $params->getArgument(0);
|
||||
|
||||
if (!$entityType) {
|
||||
$io->setExitStatus(1);
|
||||
$io->writeLine("Error: No entity type. Should be specified as the first argument.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->rebuildPaths->run($entityType);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$io->setExitStatus(1);
|
||||
$io->writeLine("Error: " . $e->getMessage());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$io->writeLine("Done.");
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -36,43 +36,32 @@ use Espo\ORM\EntityManager;
|
||||
use Espo\Repositories\EmailAddress as EmailAddressRepository;
|
||||
use Espo\Entities\EmailAddress;
|
||||
use Espo\Entities\Email;
|
||||
use Espo\Core\FieldProcessing\Loader;
|
||||
use Espo\Core\FieldProcessing\Loader\Params;
|
||||
use Espo\Core\Mail\Event\Event as EspoEvent;
|
||||
use Espo\Core\Mail\Event\EventFactory;
|
||||
use Espo\Core\Utils\Log;
|
||||
|
||||
use Espo\Core\{
|
||||
FieldProcessing\Loader,
|
||||
FieldProcessing\Loader\Params,
|
||||
Mail\Event\Event as EspoEvent,
|
||||
Mail\Event\EventFactory,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use ICal\Event;
|
||||
use ICal\ICal;
|
||||
|
||||
use Throwable;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @implements Loader<\Espo\Entities\Email>
|
||||
* @implements Loader<Email>
|
||||
*/
|
||||
class IcsDataLoader implements Loader
|
||||
{
|
||||
private $entityManager;
|
||||
|
||||
private $log;
|
||||
|
||||
/**
|
||||
* @var array<string,string>
|
||||
*/
|
||||
/** @var array<string, string> */
|
||||
private $entityTypeLinkMap = [
|
||||
'User' => 'users',
|
||||
'Contact' => 'contacts',
|
||||
'Lead' => 'leads',
|
||||
];
|
||||
|
||||
public function __construct(EntityManager $entityManager, Log $log)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
$this->log = $log;
|
||||
}
|
||||
public function __construct(private EntityManager $entityManager, private Log $log)
|
||||
{}
|
||||
|
||||
public function process(Entity $entity, Params $params): void
|
||||
{
|
||||
@@ -86,7 +75,7 @@ class IcsDataLoader implements Loader
|
||||
|
||||
$ical->initString($icsContents);
|
||||
|
||||
/* @var \ICal\Event|null $event */
|
||||
/* @var ?Event $event */
|
||||
$event = $ical->events()[0] ?? null;
|
||||
|
||||
if ($event === null) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -30,30 +30,22 @@
|
||||
namespace Espo\Classes\FieldProcessing\Email;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Repositories\EmailAddress as EmailAddressRepository;
|
||||
|
||||
use Espo\Core\{
|
||||
FieldProcessing\Loader,
|
||||
FieldProcessing\Loader\Params,
|
||||
ORM\EntityManager,
|
||||
};
|
||||
|
||||
use Espo\Core\FieldProcessing\Loader;
|
||||
use Espo\Core\FieldProcessing\Loader\Params;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Entities\Email;
|
||||
use Espo\Entities\User;
|
||||
|
||||
/**
|
||||
* @implements Loader<\Espo\Entities\Email>
|
||||
* @implements Loader<Email>
|
||||
*/
|
||||
class StringDataLoader implements Loader
|
||||
{
|
||||
private $entityManager;
|
||||
private EntityManager $entityManager;
|
||||
private User $user;
|
||||
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @var array<string,string>
|
||||
*/
|
||||
/** @var array<string, string> */
|
||||
private $fromEmailAddressNameCache = [];
|
||||
|
||||
public function __construct(EntityManager $entityManager, User $user)
|
||||
@@ -66,21 +58,22 @@ class StringDataLoader implements Loader
|
||||
{
|
||||
/** @var Email $entity */
|
||||
|
||||
$userEmailAdddressIdList = [];
|
||||
$userEmailAddressIdList = [];
|
||||
|
||||
$emailAddressCollection = $this->entityManager
|
||||
->getRDBRepository('User')
|
||||
->getRDBRepository(User::ENTITY_TYPE)
|
||||
->getRelation($this->user, 'emailAddresses')
|
||||
->select(['id'])
|
||||
->find();
|
||||
|
||||
foreach ($emailAddressCollection as $emailAddress) {
|
||||
$userEmailAdddressIdList[] = $emailAddress->getId();
|
||||
$userEmailAddressIdList[] = $emailAddress->getId();
|
||||
}
|
||||
|
||||
if (
|
||||
in_array($entity->get('fromEmailAddressId'), $userEmailAdddressIdList) ||
|
||||
$entity->get('createdById') === $this->user->getId() && $entity->get('status') === Email::STATUS_SENT
|
||||
in_array($entity->get('fromEmailAddressId'), $userEmailAddressIdList) ||
|
||||
$entity->get('createdById') === $this->user->getId() &&
|
||||
$entity->getStatus() === Email::STATUS_SENT
|
||||
) {
|
||||
$entity->loadLinkMultipleField('toEmailAddresses');
|
||||
|
||||
@@ -114,7 +107,7 @@ class StringDataLoader implements Loader
|
||||
if (!array_key_exists($fromEmailAddressId, $this->fromEmailAddressNameCache)) {
|
||||
$person = $this->getEmailAddressRepository()->getEntityByAddressId($fromEmailAddressId, null, true);
|
||||
|
||||
$fromName = $person ? $person->get('name') : null;
|
||||
$fromName = $person?->get('name');
|
||||
|
||||
$this->fromEmailAddressNameCache[$fromEmailAddressId] = $fromName;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,24 +29,20 @@
|
||||
|
||||
namespace Espo\Classes\FieldProcessing\Email;
|
||||
|
||||
use Espo\Entities\Email;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
FieldProcessing\Loader,
|
||||
FieldProcessing\Loader\Params,
|
||||
ORM\EntityManager,
|
||||
};
|
||||
|
||||
use Espo\Core\FieldProcessing\Loader;
|
||||
use Espo\Core\FieldProcessing\Loader\Params;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Entities\User;
|
||||
|
||||
/**
|
||||
* @implements Loader<\Espo\Entities\Email>
|
||||
* @implements Loader<Email>
|
||||
*/
|
||||
class UserColumnsLoader implements Loader
|
||||
{
|
||||
private $entityManager;
|
||||
|
||||
private $user;
|
||||
private EntityManager $entityManager;
|
||||
private User $user;
|
||||
|
||||
public function __construct(EntityManager $entityManager, User $user)
|
||||
{
|
||||
@@ -57,8 +53,12 @@ class UserColumnsLoader implements Loader
|
||||
public function process(Entity $entity, Params $params): void
|
||||
{
|
||||
$emailUser = $this->entityManager
|
||||
->getRDBRepository('EmailUser')
|
||||
->select(['isRead', 'isImportant', 'inTrash'])
|
||||
->getRDBRepository(Email::RELATIONSHIP_EMAIL_USER)
|
||||
->select([
|
||||
Email::USERS_COLUMN_IS_READ,
|
||||
Email::USERS_COLUMN_IS_IMPORTANT,
|
||||
Email::USERS_COLUMN_IN_TRASH,
|
||||
])
|
||||
->where([
|
||||
'deleted' => false,
|
||||
'userId' => $this->user->getId(),
|
||||
@@ -67,17 +67,17 @@ class UserColumnsLoader implements Loader
|
||||
->findOne();
|
||||
|
||||
if (!$emailUser) {
|
||||
$entity->set('isRead', null);
|
||||
$entity->clear('isImportant');
|
||||
$entity->clear('inTrash');
|
||||
$entity->set(Email::USERS_COLUMN_IS_READ, null);
|
||||
$entity->clear(Email::USERS_COLUMN_IS_IMPORTANT);
|
||||
$entity->clear(Email::USERS_COLUMN_IN_TRASH);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$entity->set([
|
||||
'isRead' => $emailUser->get('isRead'),
|
||||
'isImportant' => $emailUser->get('isImportant'),
|
||||
'inTrash' => $emailUser->get('inTrash'),
|
||||
Email::USERS_COLUMN_IS_READ => $emailUser->get(Email::USERS_COLUMN_IS_READ),
|
||||
Email::USERS_COLUMN_IS_IMPORTANT => $emailUser->get(Email::USERS_COLUMN_IS_IMPORTANT),
|
||||
Email::USERS_COLUMN_IN_TRASH => $emailUser->get(Email::USERS_COLUMN_IN_TRASH),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,27 +29,26 @@
|
||||
|
||||
namespace Espo\Classes\FieldProcessing\User;
|
||||
|
||||
use Espo\Entities\AuthLogRecord;
|
||||
use Espo\Entities\AuthToken;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
FieldProcessing\Loader,
|
||||
FieldProcessing\Loader\Params,
|
||||
ORM\EntityManager,
|
||||
Acl,
|
||||
Acl\Table,
|
||||
};
|
||||
use Espo\Core\Acl;
|
||||
use Espo\Core\Acl\Table;
|
||||
use Espo\Core\FieldProcessing\Loader;
|
||||
use Espo\Core\FieldProcessing\Loader\Params;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
|
||||
use DateTime;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @implements Loader<\Espo\Entities\User>
|
||||
* @implements Loader<User>
|
||||
*/
|
||||
class LastAccessLoader implements Loader
|
||||
{
|
||||
private $entityManager;
|
||||
|
||||
private $acl;
|
||||
private EntityManager $entityManager;
|
||||
private Acl $acl;
|
||||
|
||||
public function __construct(EntityManager $entityManager, Acl $acl)
|
||||
{
|
||||
@@ -67,7 +66,7 @@ class LastAccessLoader implements Loader
|
||||
}
|
||||
|
||||
$authToken = $this->entityManager
|
||||
->getRDBRepository('AuthToken')
|
||||
->getRDBRepository(AuthToken::ENTITY_TYPE)
|
||||
->select(['id', 'lastAccess'])
|
||||
->where([
|
||||
'userId' => $entity->getId(),
|
||||
@@ -87,7 +86,7 @@ class LastAccessLoader implements Loader
|
||||
try {
|
||||
$dt = new DateTime($lastAccess);
|
||||
}
|
||||
catch (Exception $e) {}
|
||||
catch (Exception) {}
|
||||
}
|
||||
|
||||
$where = [
|
||||
@@ -100,7 +99,7 @@ class LastAccessLoader implements Loader
|
||||
}
|
||||
|
||||
$authLogRecord = $this->entityManager
|
||||
->getRDBRepository('AuthLogRecord')
|
||||
->getRDBRepository(AuthLogRecord::ENTITY_TYPE)
|
||||
->select(['id', 'createdAt'])
|
||||
->where($where)
|
||||
->order('requestTime', true)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,10 +29,13 @@
|
||||
|
||||
namespace Espo\Classes\FieldValidators;
|
||||
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
class CurrencyType extends FloatType
|
||||
{
|
||||
public function __construct(private Config $config) {}
|
||||
|
||||
protected function isNotEmpty(Entity $entity, string $field): bool
|
||||
{
|
||||
return
|
||||
@@ -40,4 +43,26 @@ class CurrencyType extends FloatType
|
||||
$entity->has($field . 'Currency') && $entity->get($field . 'Currency') !== null &&
|
||||
$entity->get($field . 'Currency') !== '';
|
||||
}
|
||||
|
||||
public function checkValidCurrency(Entity $entity, string $field): bool
|
||||
{
|
||||
$attribute = $field . 'Currency';
|
||||
|
||||
if (!$entity->has($attribute)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$currency = $entity->get($attribute);
|
||||
$currencyList = $this->config->get('currencyList') ?? [$this->config->get('defaultCurrency')];
|
||||
|
||||
if (
|
||||
$currency === null &&
|
||||
$entity->has($field) &&
|
||||
$entity->get($field) === null
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return in_array($currency, $currencyList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,8 +29,11 @@
|
||||
|
||||
namespace Espo\Classes\FieldValidators;
|
||||
|
||||
use Espo\Core\Field\Date;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Exception;
|
||||
|
||||
class DateType
|
||||
{
|
||||
public function checkRequired(Entity $entity, string $field): bool
|
||||
@@ -42,4 +45,23 @@ class DateType
|
||||
{
|
||||
return $entity->has($field) && $entity->get($field) !== null;
|
||||
}
|
||||
|
||||
public function checkValid(Entity $entity, string $field): bool
|
||||
{
|
||||
/** @var ?string $value */
|
||||
$value = $entity->get($field);
|
||||
|
||||
if ($value === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
Date::fromString($value);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,7 +29,10 @@
|
||||
|
||||
namespace Espo\Classes\FieldValidators;
|
||||
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Field\Date;
|
||||
use Espo\ORM\Entity;
|
||||
use Exception;
|
||||
|
||||
class DatetimeOptionalType extends DatetimeType
|
||||
{
|
||||
@@ -50,4 +53,33 @@ class DatetimeOptionalType extends DatetimeType
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkValid(Entity $entity, string $field): bool
|
||||
{
|
||||
/** @var ?string $dateValue */
|
||||
$dateValue = $entity->get($field . 'Date');
|
||||
|
||||
if ($dateValue !== null) {
|
||||
try {
|
||||
Date::fromString($dateValue);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** @var ?string $value */
|
||||
$value = $entity->get($field);
|
||||
|
||||
if ($value !== null) {
|
||||
try {
|
||||
DateTime::fromString($value);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -29,6 +29,29 @@
|
||||
|
||||
namespace Espo\Classes\FieldValidators;
|
||||
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Exception;
|
||||
|
||||
class DatetimeType extends DateType
|
||||
{
|
||||
public function checkValid(Entity $entity, string $field): bool
|
||||
{
|
||||
/** @var ?string $value */
|
||||
$value = $entity->get($field);
|
||||
|
||||
if ($value === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
DateTime::fromString($value);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -31,11 +31,11 @@ namespace Espo\Classes\FieldValidators;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use StdClass;
|
||||
use stdClass;
|
||||
|
||||
class JsonArrayType
|
||||
{
|
||||
public function rawCheckArray(StdClass $data, string $field): bool
|
||||
public function rawCheckArray(stdClass $data, string $field): bool
|
||||
{
|
||||
if (isset($data->$field) && !is_array($data->$field)) {
|
||||
return false;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\FieldValidators\User\UserName;
|
||||
|
||||
use Espo\Core\FieldValidation\Validator;
|
||||
use Espo\Core\FieldValidation\Validator\Data;
|
||||
use Espo\Core\FieldValidation\Validator\Failure;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Entity;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @implements Validator<User>
|
||||
*/
|
||||
class Valid implements Validator
|
||||
{
|
||||
private Config $config;
|
||||
|
||||
public function __construct(Config $config) {
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $entity
|
||||
*/
|
||||
public function validate(Entity $entity, string $field, Data $data): ?Failure
|
||||
{
|
||||
$value = $entity->getUserName();
|
||||
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var ?string $regExp */
|
||||
$regExp = $this->config->get('userNameRegularExpression');
|
||||
|
||||
if (!$regExp) {
|
||||
throw new RuntimeException("No `userNameRegularExpression` in config.");
|
||||
}
|
||||
|
||||
if (strpos($value, ' ') !== false) {
|
||||
return Failure::create();
|
||||
}
|
||||
|
||||
if (preg_replace("/{$regExp}/", '_', $value) !== $value) {
|
||||
return Failure::create();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -30,6 +30,7 @@
|
||||
namespace Espo\Classes\FieldValidators;
|
||||
|
||||
use Espo\Core\Utils\Metadata;
|
||||
use Espo\ORM\Defs;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
class VarcharType
|
||||
@@ -37,10 +38,12 @@ class VarcharType
|
||||
private Metadata $metadata;
|
||||
|
||||
private const DEFAULT_MAX_LENGTH = 255;
|
||||
private Defs $defs;
|
||||
|
||||
public function __construct(Metadata $metadata)
|
||||
public function __construct(Metadata $metadata, Defs $defs)
|
||||
{
|
||||
$this->metadata = $metadata;
|
||||
$this->defs = $defs;
|
||||
}
|
||||
|
||||
public function checkRequired(Entity $entity, string $field): bool
|
||||
@@ -54,6 +57,14 @@ class VarcharType
|
||||
return true;
|
||||
}
|
||||
|
||||
$fieldDefs = $this->defs
|
||||
->getEntity($entity->getEntityType())
|
||||
->getField($field);
|
||||
|
||||
if ($fieldDefs->isNotStorable() && !$validationValue) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$value = $entity->get($field);
|
||||
|
||||
$maxLength = $validationValue ?? self::DEFAULT_MAX_LENGTH;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -34,6 +34,7 @@ use Espo\Core\Job\Job\Status;
|
||||
use Espo\Core\Job\Preparator;
|
||||
use Espo\Core\Job\Preparator\Data;
|
||||
|
||||
use Espo\Entities\EmailAccount;
|
||||
use Espo\ORM\EntityManager;
|
||||
|
||||
use Espo\Entities\Job as JobEntity;
|
||||
@@ -42,7 +43,7 @@ use DateTimeImmutable;
|
||||
|
||||
class CheckEmailAccounts implements Preparator
|
||||
{
|
||||
private $entityManager;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
public function __construct(EntityManager $entityManager)
|
||||
{
|
||||
@@ -52,10 +53,10 @@ class CheckEmailAccounts implements Preparator
|
||||
public function prepare(Data $data, DateTimeImmutable $executeTime): void
|
||||
{
|
||||
$collection = $this->entityManager
|
||||
->getRDBRepository('EmailAccount')
|
||||
->getRDBRepository(EmailAccount::ENTITY_TYPE)
|
||||
->join('assignedUser', 'assignedUserAdditional')
|
||||
->where([
|
||||
'status' => 'Active',
|
||||
'status' => EmailAccount::STATUS_ACTIVE,
|
||||
'useImap' => true,
|
||||
'assignedUserAdditional.isActive' => true,
|
||||
])
|
||||
@@ -70,7 +71,7 @@ class CheckEmailAccounts implements Preparator
|
||||
Status::RUNNING,
|
||||
Status::READY,
|
||||
],
|
||||
'targetType' => 'EmailAccount',
|
||||
'targetType' => EmailAccount::ENTITY_TYPE,
|
||||
'targetId' => $entity->getId(),
|
||||
])
|
||||
->findOne();
|
||||
@@ -84,7 +85,7 @@ class CheckEmailAccounts implements Preparator
|
||||
->where([
|
||||
'scheduledJobId' => $data->getId(),
|
||||
'status' => Status::PENDING,
|
||||
'targetType' => 'EmailAccount',
|
||||
'targetType' => EmailAccount::ENTITY_TYPE,
|
||||
'targetId' => $entity->getId(),
|
||||
])
|
||||
->count();
|
||||
@@ -99,7 +100,7 @@ class CheckEmailAccounts implements Preparator
|
||||
'name' => $data->getName(),
|
||||
'scheduledJobId' => $data->getId(),
|
||||
'executeTime' => $executeTime->format(DateTime::SYSTEM_DATE_TIME_FORMAT),
|
||||
'targetType' => 'EmailAccount',
|
||||
'targetType' => EmailAccount::ENTITY_TYPE,
|
||||
'targetId' => $entity->getId(),
|
||||
]);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user