mirror of
https://github.com/espocrm/espocrm.git
synced 2026-03-03 20:07:01 +00:00
Compare commits
2732 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d4bde46f8 | ||
|
|
cb89ad59af | ||
|
|
092b5024fe | ||
|
|
517edf2ced | ||
|
|
219c28313c | ||
|
|
311d92202b | ||
|
|
05cb2ee272 | ||
|
|
f896a2d71a | ||
|
|
dd6704ace5 | ||
|
|
1dc4d44a65 | ||
|
|
bfb28ea178 | ||
|
|
ec6f3a22f2 | ||
|
|
5a0c7c330c | ||
|
|
f64df5af87 | ||
|
|
d4dc7a4051 | ||
|
|
d676f85c8f | ||
|
|
ab382f2387 | ||
|
|
206219c738 | ||
|
|
37d1c707cb | ||
|
|
93af1c9bfc | ||
|
|
a021c4c8d5 | ||
|
|
a125244cdf | ||
|
|
1cfd251c4c | ||
|
|
d2f4f312e5 | ||
|
|
c468b061d9 | ||
|
|
7bf945f0b6 | ||
|
|
fecbb26cbf | ||
|
|
a5ae33ab81 | ||
|
|
c6fa0e464e | ||
|
|
38bae6238a | ||
|
|
79de4c874f | ||
|
|
814748ec61 | ||
|
|
1f0ad0cbec | ||
|
|
7224f566d6 | ||
|
|
eefb01ec4f | ||
|
|
24d46ed81d | ||
|
|
37c749faf8 | ||
|
|
4306a3131e | ||
|
|
8fa95fcce3 | ||
|
|
b7c41ce640 | ||
|
|
a21be94ed3 | ||
|
|
9d59edcae2 | ||
|
|
deaa26a355 | ||
|
|
25d6fb6d82 | ||
|
|
c1bcc44f04 | ||
|
|
fdf8183385 | ||
|
|
db40426f00 | ||
|
|
eb92e648a0 | ||
|
|
5df26c324f | ||
|
|
c36a064fdc | ||
|
|
a28baa6a75 | ||
|
|
27aed29ddf | ||
|
|
744fb176cc | ||
|
|
5f8a0736e4 | ||
|
|
7fb179e769 | ||
|
|
48239c53ca | ||
|
|
4e18afb80f | ||
|
|
e9d3d7c807 | ||
|
|
60923197e5 | ||
|
|
a9f7c90323 | ||
|
|
cc723095c2 | ||
|
|
373b77f83f | ||
|
|
68ab589f3e | ||
|
|
23ccbb226f | ||
|
|
48edf2a2b5 | ||
|
|
082c65ef05 | ||
|
|
6553d8ec6c | ||
|
|
c54b6fcc7c | ||
|
|
655ee740e0 | ||
|
|
b02f77b8f9 | ||
|
|
351c46af06 | ||
|
|
d3db25d98a | ||
|
|
ef1fe1bd1d | ||
|
|
6c2cd93826 | ||
|
|
4859f54f42 | ||
|
|
749c2dc1e9 | ||
|
|
3d13026084 | ||
|
|
6cf66aa88e | ||
|
|
d10ef7038b | ||
|
|
cda612810d | ||
|
|
a7aaac513d | ||
|
|
329dbdf408 | ||
|
|
007f705904 | ||
|
|
36cddbe0cf | ||
|
|
e9409ccf72 | ||
|
|
b5a1ede962 | ||
|
|
2dc6951ef9 | ||
|
|
66f686c013 | ||
|
|
937aab2b1c | ||
|
|
43bee97055 | ||
|
|
a31f5ea87a | ||
|
|
0c4d5f3405 | ||
|
|
4e70ea0586 | ||
|
|
7736f6cd76 | ||
|
|
2db6eaa344 | ||
|
|
38b6cbda0e | ||
|
|
9292f18b5b | ||
|
|
193cf2438a | ||
|
|
155e0e3841 | ||
|
|
019c03ed2f | ||
|
|
316e54df92 | ||
|
|
40691ae899 | ||
|
|
ab8ba168ac | ||
|
|
b066d91cf5 | ||
|
|
2833581cde | ||
|
|
279c8b3188 | ||
|
|
eca6408415 | ||
|
|
35cfb1a480 | ||
|
|
30f3d4ab5e | ||
|
|
7e5424e40a | ||
|
|
82612326bf | ||
|
|
da2e5c835a | ||
|
|
af8eb51c76 | ||
|
|
7253e257f1 | ||
|
|
37e93edf25 | ||
|
|
36a56f050f | ||
|
|
31c2d1360d | ||
|
|
4addc48339 | ||
|
|
a7267bc920 | ||
|
|
93e94f40c3 | ||
|
|
bd75790c29 | ||
|
|
f1cffcae38 | ||
|
|
9111bce47a | ||
|
|
73ec161ac4 | ||
|
|
495a07639e | ||
|
|
044223e70e | ||
|
|
42c9250995 | ||
|
|
8b4a1d96fd | ||
|
|
fff06d7e92 | ||
|
|
726adc550c | ||
|
|
f5bde670f6 | ||
|
|
050873dd3a | ||
|
|
d3886c1c94 | ||
|
|
84f03cf3f9 | ||
|
|
f8953d56f4 | ||
|
|
ebbf14160b | ||
|
|
4df0a09de0 | ||
|
|
c485aa9a62 | ||
|
|
ae474022b9 | ||
|
|
f994cdf7c4 | ||
|
|
7ff514e5a7 | ||
|
|
344403de54 | ||
|
|
836243d170 | ||
|
|
0dc9129d79 | ||
|
|
61c9d07ad8 | ||
|
|
a238295ba8 | ||
|
|
dbabd0dd45 | ||
|
|
f87ff8db8a | ||
|
|
60d121f1e1 | ||
|
|
1497abff07 | ||
|
|
935ba7d4e4 | ||
|
|
fba79cde8f | ||
|
|
ce79d14a29 | ||
|
|
14b2083226 | ||
|
|
779a841817 | ||
|
|
3647523150 | ||
|
|
eb5b941fe6 | ||
|
|
c542d99536 | ||
|
|
918031a9c6 | ||
|
|
163e0cac2a | ||
|
|
95096dd8fd | ||
|
|
67bd98bf4b | ||
|
|
ac434c00d6 | ||
|
|
0fb8330ecf | ||
|
|
3f969cee5b | ||
|
|
ea5f6300f3 | ||
|
|
0d5e75db23 | ||
|
|
7d667a1d1b | ||
|
|
610922c8e0 | ||
|
|
36e0882542 | ||
|
|
b9979e87af | ||
|
|
bcd38dd853 | ||
|
|
b018580c0b | ||
|
|
38a7f42a1e | ||
|
|
1387d856ba | ||
|
|
f2bbc872d6 | ||
|
|
c74e7b416e | ||
|
|
f008688c14 | ||
|
|
dff0d5a992 | ||
|
|
6fe6f8960f | ||
|
|
0b0184098d | ||
|
|
647515d21a | ||
|
|
2ee944ef7b | ||
|
|
f4d2325b8b | ||
|
|
c0904125eb | ||
|
|
7dad30ad0c | ||
|
|
d6acb6dfdc | ||
|
|
b6da94fe2e | ||
|
|
dc5e292a02 | ||
|
|
4bf938107d | ||
|
|
ec7d49cdbc | ||
|
|
3c73062b91 | ||
|
|
5122f112d1 | ||
|
|
5e20fa6717 | ||
|
|
d4599d9377 | ||
|
|
adb9ce4d7e | ||
|
|
e777413a7b | ||
|
|
2cb0ac6221 | ||
|
|
8f7fafb990 | ||
|
|
158c911787 | ||
|
|
aa67575ecb | ||
|
|
81cf82c99f | ||
|
|
e638bf2eec | ||
|
|
6c9d1dbb3d | ||
|
|
fbb034ef92 | ||
|
|
335601d6b8 | ||
|
|
f6ad51ca74 | ||
|
|
e119f8b008 | ||
|
|
5af0eeff3b | ||
|
|
f685feb312 | ||
|
|
c78254a8fa | ||
|
|
9c3758b92c | ||
|
|
4ca2a7fa1a | ||
|
|
d6814b1601 | ||
|
|
55e5a21dcd | ||
|
|
792f422f76 | ||
|
|
8cac546087 | ||
|
|
0cfe91d960 | ||
|
|
4dea1762e8 | ||
|
|
b1a9b8d8b1 | ||
|
|
6787acce61 | ||
|
|
eb0adf7c28 | ||
|
|
783cccaa1b | ||
|
|
36a0a22996 | ||
|
|
a3f3357b2e | ||
|
|
cbbfa44174 | ||
|
|
812d2ec9bc | ||
|
|
b51ba96bb7 | ||
|
|
4c60cf79f6 | ||
|
|
8451949805 | ||
|
|
af5750cdf6 | ||
|
|
1a4dfd6f67 | ||
|
|
6aa800d453 | ||
|
|
82aa3b9508 | ||
|
|
6910a113da | ||
|
|
bd20aaa577 | ||
|
|
0aef3c0b04 | ||
|
|
2f97010b54 | ||
|
|
5bcdad2996 | ||
|
|
1e8a8d94c2 | ||
|
|
9aeefd7685 | ||
|
|
f72385471c | ||
|
|
f7a542560a | ||
|
|
400f43447d | ||
|
|
866593a831 | ||
|
|
c90cdc62fb | ||
|
|
d5c93f21b5 | ||
|
|
b58d78a29e | ||
|
|
f5b41eb78b | ||
|
|
c2a7d90944 | ||
|
|
b2a4ec238c | ||
|
|
df69584c7d | ||
|
|
574da55be7 | ||
|
|
52b808b902 | ||
|
|
714c7b0a33 | ||
|
|
3d774e3afa | ||
|
|
c91db1699b | ||
|
|
2b5695d8dc | ||
|
|
b562fc33bd | ||
|
|
425414b8f3 | ||
|
|
3b363d5ee3 | ||
|
|
4fc3b9a99e | ||
|
|
ab2b9bafeb | ||
|
|
e99fc6302f | ||
|
|
82996a807f | ||
|
|
86b31b1f26 | ||
|
|
19c9b38f82 | ||
|
|
b1d0d1cd27 | ||
|
|
c916011530 | ||
|
|
5db6327272 | ||
|
|
3c5fe4c778 | ||
|
|
f6f3f05aa5 | ||
|
|
10f34564d0 | ||
|
|
216ec2329d | ||
|
|
c3cb4619cf | ||
|
|
fcf2929b5b | ||
|
|
15c10ca553 | ||
|
|
9bb417ab38 | ||
|
|
5b110ee7b2 | ||
|
|
f3951966f3 | ||
|
|
f580f0ba60 | ||
|
|
a9e4ad3833 | ||
|
|
3e6c88eb27 | ||
|
|
7c4ef3f00f | ||
|
|
762d7f71c6 | ||
|
|
50cc658c20 | ||
|
|
21a59cb198 | ||
|
|
38ba3461be | ||
|
|
f70ee27809 | ||
|
|
674c1588d9 | ||
|
|
e9eb5402cc | ||
|
|
7f746a72bb | ||
|
|
bde6a810c4 | ||
|
|
ff3e7d1c5b | ||
|
|
7ecb63189a | ||
|
|
eb1e16d6bd | ||
|
|
f17b5d7244 | ||
|
|
a5b44e9fdf | ||
|
|
734219dbd4 | ||
|
|
45c351ab39 | ||
|
|
74aa55a8aa | ||
|
|
64b3a88ba0 | ||
|
|
08ff00f602 | ||
|
|
0d9853311a | ||
|
|
b1d17f9e84 | ||
|
|
3a6041a8df | ||
|
|
023171f19e | ||
|
|
546fed83c8 | ||
|
|
6b37ce80fd | ||
|
|
a98c8b3bcd | ||
|
|
7bd3dd26cf | ||
|
|
fe7684b46c | ||
|
|
ea5dcfe630 | ||
|
|
ad5f29338b | ||
|
|
89d2b26613 | ||
|
|
7206dc38bc | ||
|
|
4b9ff21743 | ||
|
|
fbe7910349 | ||
|
|
7b098095cb | ||
|
|
7966be90e7 | ||
|
|
b64db89307 | ||
|
|
cb9b7c3e72 | ||
|
|
a268962c15 | ||
|
|
36c1b56916 | ||
|
|
39a2e30e3f | ||
|
|
b91d237f0b | ||
|
|
f7a0a0daa0 | ||
|
|
4f270d003b | ||
|
|
e3ebc8c2e2 | ||
|
|
c31c5618dd | ||
|
|
341d5f8d7c | ||
|
|
04d2bd69c1 | ||
|
|
47efa792ee | ||
|
|
a71c6789bc | ||
|
|
3a41aad935 | ||
|
|
fad56c1c0a | ||
|
|
d6ad7f16c1 | ||
|
|
ae89a9216d | ||
|
|
6927c82a0f | ||
|
|
e06b553653 | ||
|
|
e9a63c0c36 | ||
|
|
582c23ecf4 | ||
|
|
d86ff1e905 | ||
|
|
773bca8448 | ||
|
|
a6258cd334 | ||
|
|
1cdf88ef9b | ||
|
|
58ffbad422 | ||
|
|
aafcd5767e | ||
|
|
2bfac8352b | ||
|
|
954eff0c94 | ||
|
|
9692076ba8 | ||
|
|
5ae64989eb | ||
|
|
3fd34fc48d | ||
|
|
94c207677f | ||
|
|
39188f0b3a | ||
|
|
7665ec2730 | ||
|
|
bc57ac3065 | ||
|
|
6cf62736bb | ||
|
|
d5e78c1a7a | ||
|
|
4a0aa1bca0 | ||
|
|
2d06e8a801 | ||
|
|
25b1479c23 | ||
|
|
09ab17f18b | ||
|
|
be438a2f18 | ||
|
|
c9f91bb8da | ||
|
|
cd01178151 | ||
|
|
3e8ed72246 | ||
|
|
c500520130 | ||
|
|
0fc2eb6817 | ||
|
|
4db2f49233 | ||
|
|
8215c44be9 | ||
|
|
dbee926a94 | ||
|
|
d85e13cae0 | ||
|
|
370eee8d9d | ||
|
|
98f317cb1c | ||
|
|
3ec9613b0e | ||
|
|
8e27d50d5c | ||
|
|
fc50991317 | ||
|
|
52382bb958 | ||
|
|
66fdd40659 | ||
|
|
f0f402a8b3 | ||
|
|
591cbf4484 | ||
|
|
44d813bf5b | ||
|
|
fceff4ad7f | ||
|
|
f47b41928e | ||
|
|
c559a97953 | ||
|
|
d1d64c84b0 | ||
|
|
cb1f32ec3a | ||
|
|
e76116810f | ||
|
|
974b69eed0 | ||
|
|
bb379c7a0e | ||
|
|
5664ede648 | ||
|
|
881a3db412 | ||
|
|
b74f1cc5d6 | ||
|
|
265ec60614 | ||
|
|
d79d716612 | ||
|
|
aa61f322bc | ||
|
|
c8d2f08c13 | ||
|
|
920b6e2eba | ||
|
|
6e7908de52 | ||
|
|
10de6aedbd | ||
|
|
ce0efed7b8 | ||
|
|
204b9aa49d | ||
|
|
ae1db7990e | ||
|
|
18f13acfa9 | ||
|
|
a15b247952 | ||
|
|
2e457e1f6f | ||
|
|
e0375a52f9 | ||
|
|
351a70015a | ||
|
|
8faa001a56 | ||
|
|
182fc8b65e | ||
|
|
49b581dafd | ||
|
|
1319c54365 | ||
|
|
c9db2687f5 | ||
|
|
21252a6eb7 | ||
|
|
1054050542 | ||
|
|
90e2d7ef0b | ||
|
|
de9c1e7a20 | ||
|
|
08b5f09c55 | ||
|
|
23a0ed86e0 | ||
|
|
0ca7da454b | ||
|
|
ffc22673f7 | ||
|
|
1faa75c303 | ||
|
|
8136eed152 | ||
|
|
13dc6f0d76 | ||
|
|
dd55141422 | ||
|
|
d3bcadce13 | ||
|
|
99533a5416 | ||
|
|
4a288434bc | ||
|
|
9218bce3e4 | ||
|
|
b566413b78 | ||
|
|
f624b441e4 | ||
|
|
ebe7834092 | ||
|
|
9c8f54fd24 | ||
|
|
4a20d74258 | ||
|
|
f47915d077 | ||
|
|
eb2305712a | ||
|
|
f75414a5d2 | ||
|
|
a88cb05897 | ||
|
|
2435ae67c9 | ||
|
|
4c49be5203 | ||
|
|
2d8a1dad80 | ||
|
|
a15b009133 | ||
|
|
25d2033b7c | ||
|
|
9abeb6aec8 | ||
|
|
c509eeae49 | ||
|
|
2a4b0dbcb4 | ||
|
|
e45a863e8d | ||
|
|
2ca40a6b4e | ||
|
|
c4819e29e0 | ||
|
|
176fae228c | ||
|
|
c0242a18e3 | ||
|
|
7a953c9a47 | ||
|
|
27cc0d812e | ||
|
|
2a1df998eb | ||
|
|
78573b85b5 | ||
|
|
7a433c1890 | ||
|
|
de26d87400 | ||
|
|
07da707503 | ||
|
|
b473b19b45 | ||
|
|
6c291999f4 | ||
|
|
2e92d0d3a5 | ||
|
|
2ac5695e45 | ||
|
|
0af4ab54f9 | ||
|
|
8da92966de | ||
|
|
bc3dfc7ff9 | ||
|
|
e81d5707f2 | ||
|
|
4cb42f8762 | ||
|
|
1d2e3aff89 | ||
|
|
e36c8d6053 | ||
|
|
4ea1d50caf | ||
|
|
a50361126f | ||
|
|
865a8e2abc | ||
|
|
037ef7ea78 | ||
|
|
5783f4e708 | ||
|
|
9991dd350f | ||
|
|
557a48ec6a | ||
|
|
d5fa18975e | ||
|
|
23ee06e123 | ||
|
|
e47eab0ce7 | ||
|
|
17ae5b6b5a | ||
|
|
fa29bf3309 | ||
|
|
e839e505c8 | ||
|
|
7dc9c3e6b6 | ||
|
|
684585278d | ||
|
|
e303be8155 | ||
|
|
f1285f0615 | ||
|
|
3fd1974d86 | ||
|
|
d48716e65a | ||
|
|
a0432051f4 | ||
|
|
076c3aa65b | ||
|
|
92abd16032 | ||
|
|
e6632066a6 | ||
|
|
e2deaf57dd | ||
|
|
0530d9deb8 | ||
|
|
b57ccf0c6a | ||
|
|
9ea9cf693d | ||
|
|
3460931fba | ||
|
|
b743d113cc | ||
|
|
f810371e70 | ||
|
|
bc525f3047 | ||
|
|
6809181adf | ||
|
|
2c71a28421 | ||
|
|
82162e4fe6 | ||
|
|
03454bc309 | ||
|
|
d975501f29 | ||
|
|
761356adda | ||
|
|
824835a28c | ||
|
|
252ce15973 | ||
|
|
7f25dba917 | ||
|
|
b5d4b8aa5a | ||
|
|
39a136295a | ||
|
|
6d674c007e | ||
|
|
31f380a03a | ||
|
|
7e23960196 | ||
|
|
d3b9f2479b | ||
|
|
c211842b52 | ||
|
|
3e11c0cfc1 | ||
|
|
6747440b00 | ||
|
|
dc1c4b1e78 | ||
|
|
26f2fba3ac | ||
|
|
eb481c689b | ||
|
|
88c3984d35 | ||
|
|
4eae088973 | ||
|
|
60ae0fb365 | ||
|
|
ab36f41fc3 | ||
|
|
98de243e37 | ||
|
|
0c6ccabbeb | ||
|
|
a66e6111cb | ||
|
|
caf5c8806a | ||
|
|
0154dfd6a1 | ||
|
|
e545e68877 | ||
|
|
fa24c2b7fe | ||
|
|
df2b7d9659 | ||
|
|
cc395232ff | ||
|
|
47afb83536 | ||
|
|
02d1b50b59 | ||
|
|
bd86eb08fa | ||
|
|
b3c1a45b72 | ||
|
|
15678e59e2 | ||
|
|
6fe379bab3 | ||
|
|
39ecb2fd37 | ||
|
|
988c0059ff | ||
|
|
61ff31b3b7 | ||
|
|
7c1a098b89 | ||
|
|
f843593843 | ||
|
|
c34eb915bc | ||
|
|
9508432294 | ||
|
|
0959962269 | ||
|
|
e39a91bde6 | ||
|
|
51f5dbe25c | ||
|
|
6fd5c6cbe7 | ||
|
|
6622b09eaa | ||
|
|
9bb9f066cd | ||
|
|
03110b47df | ||
|
|
034e532e05 | ||
|
|
c306af8b4c | ||
|
|
bd4a784676 | ||
|
|
4ca0a9dc5f | ||
|
|
c6816b01b5 | ||
|
|
bc7583ccb4 | ||
|
|
318e43aca3 | ||
|
|
ea992f727b | ||
|
|
5bdb16f98c | ||
|
|
faa06993e6 | ||
|
|
f6e0d017b2 | ||
|
|
8ea56a74b0 | ||
|
|
d4c9666f85 | ||
|
|
5f376304ce | ||
|
|
dbb29f25ab | ||
|
|
da059b2589 | ||
|
|
fee64fd5ac | ||
|
|
85de9f7a6f | ||
|
|
5beb7641af | ||
|
|
249852c3d7 | ||
|
|
223d07579b | ||
|
|
74fb359740 | ||
|
|
f7ffadc76f | ||
|
|
fc03141dee | ||
|
|
8d29014811 | ||
|
|
7dcbbcb98d | ||
|
|
60b9200247 | ||
|
|
fa4d1d70d5 | ||
|
|
de6cc1f9bb | ||
|
|
5fb6abe0e1 | ||
|
|
94073b8aad | ||
|
|
0e83e21aa0 | ||
|
|
63bbf72942 | ||
|
|
dbaa41b161 | ||
|
|
ed673dbe0d | ||
|
|
d54ccb0c9e | ||
|
|
b29cbec3a1 | ||
|
|
edc967c118 | ||
|
|
e80681da22 | ||
|
|
03ec9c9378 | ||
|
|
6c54306cd6 | ||
|
|
db49af84f4 | ||
|
|
79a29531e9 | ||
|
|
c3de7f022e | ||
|
|
59a3111596 | ||
|
|
cf8dfadbdf | ||
|
|
e500b2c906 | ||
|
|
0d9417cc3e | ||
|
|
eb57d70182 | ||
|
|
215b572d70 | ||
|
|
bc72f7f3e6 | ||
|
|
b449473f10 | ||
|
|
6f23362bfd | ||
|
|
074d2cc119 | ||
|
|
725cd224c1 | ||
|
|
2baee2398b | ||
|
|
1a8f8875fd | ||
|
|
9cecea8317 | ||
|
|
05ac6ea0b8 | ||
|
|
cce8186ccf | ||
|
|
b143d1a30e | ||
|
|
4c5f2e6b40 | ||
|
|
6bc2c7a576 | ||
|
|
2412c7521b | ||
|
|
c964897c59 | ||
|
|
6abdc001e5 | ||
|
|
83943d1daa | ||
|
|
eedd54d10a | ||
|
|
c8a3736816 | ||
|
|
e727196424 | ||
|
|
d0f715863c | ||
|
|
ae94113370 | ||
|
|
3fbe4970b2 | ||
|
|
54e6e3bf39 | ||
|
|
f2a7d3ae86 | ||
|
|
3799dd739b | ||
|
|
3161419682 | ||
|
|
bdc277e557 | ||
|
|
a515cd29a0 | ||
|
|
770a2b83f0 | ||
|
|
f9df8a757d | ||
|
|
6d17017c2d | ||
|
|
9fea9d46fb | ||
|
|
3925d83b68 | ||
|
|
ca23f1d58e | ||
|
|
4492293464 | ||
|
|
cd0a32846c | ||
|
|
f5d0a80626 | ||
|
|
1b0fdad357 | ||
|
|
9ea5e3f4d0 | ||
|
|
79416d7ac5 | ||
|
|
52c6ecbcb6 | ||
|
|
f6732e72d2 | ||
|
|
bbf2128c8a | ||
|
|
d5ba8058e4 | ||
|
|
926e243aa3 | ||
|
|
ed7d24bc8f | ||
|
|
4f4069c3d7 | ||
|
|
9426a09a40 | ||
|
|
bfd9b40a5b | ||
|
|
e94da5c189 | ||
|
|
36847497fc | ||
|
|
0bb52a11ea | ||
|
|
9f7043a85d | ||
|
|
eafb8bd2cb | ||
|
|
63eeea7b26 | ||
|
|
eac2372e00 | ||
|
|
d9e972684c | ||
|
|
aaa9d1a7b4 | ||
|
|
df9a778ba0 | ||
|
|
68612cf9d1 | ||
|
|
26b72ea73d | ||
|
|
e8c570f5df | ||
|
|
abbf601325 | ||
|
|
1cd73e2f50 | ||
|
|
4b49bf280b | ||
|
|
48302fae95 | ||
|
|
c525698427 | ||
|
|
64738979e3 | ||
|
|
bed7434cd0 | ||
|
|
95f23863d4 | ||
|
|
1406527755 | ||
|
|
78395407e3 | ||
|
|
26e5c802b6 | ||
|
|
2f5f64e53c | ||
|
|
a1c95fe0e9 | ||
|
|
eb17c54dd6 | ||
|
|
f3207a271a | ||
|
|
ea76104b80 | ||
|
|
3d5be39d46 | ||
|
|
1678bb070e | ||
|
|
470a49d6cd | ||
|
|
bb11a26816 | ||
|
|
06e6b19c40 | ||
|
|
f085bf5e58 | ||
|
|
2437388bf0 | ||
|
|
fb70c9dce6 | ||
|
|
30384a713e | ||
|
|
cc26345db6 | ||
|
|
f29534531d | ||
|
|
00a2eae74e | ||
|
|
283cac586d | ||
|
|
ca33cab247 | ||
|
|
52fb9f8b0a | ||
|
|
10fee4d974 | ||
|
|
6edf6ae9f2 | ||
|
|
58e0ee5721 | ||
|
|
6354c72334 | ||
|
|
f93e6c03c9 | ||
|
|
ef5fec4282 | ||
|
|
6dc13f229e | ||
|
|
f148bb0089 | ||
|
|
9b9a472dd5 | ||
|
|
f965acf384 | ||
|
|
f7e3fb3e15 | ||
|
|
a8396df545 | ||
|
|
3cd91ba15e | ||
|
|
2433f0d626 | ||
|
|
c0b5661ef4 | ||
|
|
ff81306e90 | ||
|
|
d51e38bb6e | ||
|
|
5c1ae72bc6 | ||
|
|
b1ada57d93 | ||
|
|
e7afe68868 | ||
|
|
f6f58c679d | ||
|
|
4b4f8d2cc4 | ||
|
|
7dc230d731 | ||
|
|
db7e33fa61 | ||
|
|
e4d6b13d27 | ||
|
|
3177945146 | ||
|
|
ef9c5da2d6 | ||
|
|
18423c0ba1 | ||
|
|
f629cb3af6 | ||
|
|
d081d6b2d9 | ||
|
|
ab3dfe4bf6 | ||
|
|
a472e6d348 | ||
|
|
fa014bb232 | ||
|
|
bdee4068c0 | ||
|
|
025e7134fc | ||
|
|
a388638a91 | ||
|
|
e7b8283fdc | ||
|
|
d7172f8ebe | ||
|
|
bc0ea9ab3a | ||
|
|
838f8ba3b3 | ||
|
|
4da13a55cf | ||
|
|
8489bca8c0 | ||
|
|
d620b36dd1 | ||
|
|
89b5daebee | ||
|
|
fdea3231e9 | ||
|
|
882b74a31f | ||
|
|
181a680296 | ||
|
|
d7d93e6a79 | ||
|
|
d6ee607b9d | ||
|
|
75f26e3ecc | ||
|
|
e959bcb369 | ||
|
|
c9eea8796f | ||
|
|
8d44e0b1ad | ||
|
|
947f47ef25 | ||
|
|
27e5df5367 | ||
|
|
b7b64d7b32 | ||
|
|
4f9a6a0dd0 | ||
|
|
bb5543fc81 | ||
|
|
8b1ffaac3f | ||
|
|
0961ceb203 | ||
|
|
96ca44f91b | ||
|
|
869bf46070 | ||
|
|
af039971a6 | ||
|
|
5b614691fd | ||
|
|
39295d2d6f | ||
|
|
51952a9283 | ||
|
|
e88ffc1270 | ||
|
|
c7fccac10c | ||
|
|
cdb4b4e7bd | ||
|
|
3fa6ac5042 | ||
|
|
47e52b6670 | ||
|
|
461eb480f1 | ||
|
|
b73cbef3d4 | ||
|
|
c6abb0a531 | ||
|
|
7227122fd8 | ||
|
|
cf3228466d | ||
|
|
4452db65ed | ||
|
|
635f0d4891 | ||
|
|
3da60c1ada | ||
|
|
7187156390 | ||
|
|
b764fd8da2 | ||
|
|
da6d590cc1 | ||
|
|
3b265056c2 | ||
|
|
7fe08f1669 | ||
|
|
dc0a616ec8 | ||
|
|
7dc43e5ccc | ||
|
|
9a78cf2389 | ||
|
|
b0e050ceac | ||
|
|
90f06fc532 | ||
|
|
6d3d922290 | ||
|
|
3c2bc8871e | ||
|
|
16399bf71d | ||
|
|
abf963099c | ||
|
|
b7ab6953cd | ||
|
|
1628821cdd | ||
|
|
fbf98e9754 | ||
|
|
b4ec610fc2 | ||
|
|
e2a63729b6 | ||
|
|
b72924c126 | ||
|
|
115bcc626a | ||
|
|
083e248f21 | ||
|
|
df422f6365 | ||
|
|
47a2fee51d | ||
|
|
3fabdc1d44 | ||
|
|
4b0be0137c | ||
|
|
7fdb40b44e | ||
|
|
929eeddce7 | ||
|
|
ea5d27a87f | ||
|
|
0da898a242 | ||
|
|
4a14cb0e8c | ||
|
|
509c7f3989 | ||
|
|
38514941b8 | ||
|
|
3212f59cf2 | ||
|
|
ad25e13cf0 | ||
|
|
fadd4ffe42 | ||
|
|
7a3e36c092 | ||
|
|
730e8143e7 | ||
|
|
a401c4cd4c | ||
|
|
51bf1343c8 | ||
|
|
343986bf83 | ||
|
|
d0b3ab57de | ||
|
|
d79993ba11 | ||
|
|
6ca6f45b58 | ||
|
|
d3b50c077b | ||
|
|
2c4ba8c1b5 | ||
|
|
a8e00dda0b | ||
|
|
7b88c008de | ||
|
|
2c251133af | ||
|
|
c079b256f0 | ||
|
|
6a9abab7ea | ||
|
|
f59c217053 | ||
|
|
57008f834a | ||
|
|
7b90e74b97 | ||
|
|
da62759130 | ||
|
|
7cfae284ae | ||
|
|
d946eed86a | ||
|
|
030e4ac7ab | ||
|
|
2e04fd5a3b | ||
|
|
6174245b22 | ||
|
|
9b9d3d9634 | ||
|
|
f98d5a4ee9 | ||
|
|
c653d731cc | ||
|
|
f4582ac3a6 | ||
|
|
5bb7842585 | ||
|
|
e13a722dca | ||
|
|
dba325aa61 | ||
|
|
59dccbedbd | ||
|
|
df32edf85f | ||
|
|
0385513f0e | ||
|
|
710fdebbec | ||
|
|
7b707716f9 | ||
|
|
8cdb2df433 | ||
|
|
6c1fb42f59 | ||
|
|
233da7a0be | ||
|
|
612f73dac9 | ||
|
|
3ae7634b15 | ||
|
|
9cfabebdad | ||
|
|
0522796fe3 | ||
|
|
261e76458a | ||
|
|
4f2d218a82 | ||
|
|
4f531da9f5 | ||
|
|
c8adb52b7a | ||
|
|
5152e1ff36 | ||
|
|
5b1cfbdcfc | ||
|
|
00b690da99 | ||
|
|
ed63848efa | ||
|
|
d174fe3e6f | ||
|
|
e1a505955e | ||
|
|
a30b638a8d | ||
|
|
c37fb02b9e | ||
|
|
3fc5b08969 | ||
|
|
0209bc3cd3 | ||
|
|
db02fc4e55 | ||
|
|
d7787a829e | ||
|
|
acdea144bc | ||
|
|
700bb150bb | ||
|
|
9a22ed262b | ||
|
|
65827b2c02 | ||
|
|
e23e80347b | ||
|
|
ddedbfc999 | ||
|
|
d6144f777c | ||
|
|
a328eff3ae | ||
|
|
45bc019967 | ||
|
|
2aafca7ae4 | ||
|
|
13a38f9767 | ||
|
|
fcf07cdf7c | ||
|
|
723a01c12d | ||
|
|
0c1526cb69 | ||
|
|
e25cd0c1a5 | ||
|
|
a3683b76b8 | ||
|
|
e4e56489d7 | ||
|
|
1db01f1b5f | ||
|
|
d9a134bb3a | ||
|
|
1cb762fae7 | ||
|
|
16e57e38a3 | ||
|
|
42cb6fff5c | ||
|
|
55239615ef | ||
|
|
6083531c4a | ||
|
|
65cae656c3 | ||
|
|
ab928c56ad | ||
|
|
884a135397 | ||
|
|
da2baec89d | ||
|
|
59dfa99ff3 | ||
|
|
e15c748470 | ||
|
|
51fc8ac9b1 | ||
|
|
a4c0d7874f | ||
|
|
2f62a455a3 | ||
|
|
a7a3d8a0a7 | ||
|
|
1a7774341a | ||
|
|
0d4565962f | ||
|
|
a2ff2e2f5e | ||
|
|
b038a9449f | ||
|
|
160d10c5d1 | ||
|
|
4eb842d37d | ||
|
|
7fd78a71fd | ||
|
|
88fb06d982 | ||
|
|
c8a208db4b | ||
|
|
2aaec4ea99 | ||
|
|
b64c897f33 | ||
|
|
64bf4b8296 | ||
|
|
52bb6d10be | ||
|
|
3527abb171 | ||
|
|
8bdbac85a8 | ||
|
|
13eb8630ca | ||
|
|
e749ec6943 | ||
|
|
c0d0c72392 | ||
|
|
f1834147c7 | ||
|
|
e044d34abd | ||
|
|
bfcc5b0b14 | ||
|
|
7a5b3b23e6 | ||
|
|
9e15565227 | ||
|
|
79e6befdf4 | ||
|
|
07ff4cb3d1 | ||
|
|
961a5bb8a0 | ||
|
|
bf5f0e0e7f | ||
|
|
329f05fd5b | ||
|
|
2661511bbc | ||
|
|
cea3c8609b | ||
|
|
35cbbb06ce | ||
|
|
1383a5d5da | ||
|
|
67857ef93c | ||
|
|
f93cc5b472 | ||
|
|
e9df433b27 | ||
|
|
dc300dbbe0 | ||
|
|
c6b905d503 | ||
|
|
73c1cc40eb | ||
|
|
38cf2d8500 | ||
|
|
747c7742da | ||
|
|
5365818d82 | ||
|
|
eddc32ebd7 | ||
|
|
7ae41e414b | ||
|
|
6572d2a998 | ||
|
|
6a2314060f | ||
|
|
6a5e22eaa0 | ||
|
|
98f77041e8 | ||
|
|
5fb0ddb1d2 | ||
|
|
7bfedff3c8 | ||
|
|
cc364bc088 | ||
|
|
81fd286834 | ||
|
|
7d3af14f4d | ||
|
|
37f5244790 | ||
|
|
61fd827dca | ||
|
|
de68abfbb4 | ||
|
|
03ecfdb805 | ||
|
|
2061bf68af | ||
|
|
79f9aae744 | ||
|
|
d6fe7b59eb | ||
|
|
7287854cc0 | ||
|
|
dd5a395061 | ||
|
|
da1b92fdd4 | ||
|
|
f1f23b37c4 | ||
|
|
fea5669078 | ||
|
|
9fb88a6b92 | ||
|
|
3eb6648d2b | ||
|
|
7e8f0db610 | ||
|
|
6c57d9c658 | ||
|
|
bc3e873ef7 | ||
|
|
50105087cc | ||
|
|
f3406f1fcd | ||
|
|
8e105205a4 | ||
|
|
6a496be1fa | ||
|
|
ecc6e9f4ec | ||
|
|
deee30eb3e | ||
|
|
c92ba7f8f6 | ||
|
|
5f46b2f74a | ||
|
|
5c642f93e9 | ||
|
|
915c58e9ab | ||
|
|
ff437c204f | ||
|
|
e25bfbf1d7 | ||
|
|
ab4e16e9e7 | ||
|
|
d60d8bdcae | ||
|
|
a1f641af7a | ||
|
|
5cae8f359a | ||
|
|
19e10aa748 | ||
|
|
0e24774fb9 | ||
|
|
31d31fca73 | ||
|
|
f874aed44f | ||
|
|
04ce825191 | ||
|
|
516f2218d4 | ||
|
|
3cbf1447c9 | ||
|
|
1c3ca4aa5a | ||
|
|
143ab06a74 | ||
|
|
c9609bf707 | ||
|
|
291380c6b4 | ||
|
|
74edceaf67 | ||
|
|
84754077c5 | ||
|
|
e2dae62fa9 | ||
|
|
e0d475e2da | ||
|
|
02cdf522f6 | ||
|
|
8345307760 | ||
|
|
888bb9d3db | ||
|
|
0a0f8da2f4 | ||
|
|
bb5d5a0ccf | ||
|
|
1bd5eac103 | ||
|
|
61957e628b | ||
|
|
97aab07d77 | ||
|
|
c5296bf906 | ||
|
|
707f1a0b5c | ||
|
|
5ffa68bee1 | ||
|
|
a16919f10b | ||
|
|
7050757e4e | ||
|
|
cbd7ef4737 | ||
|
|
d27e9c91e7 | ||
|
|
5e1c7bce33 | ||
|
|
a23ac54da0 | ||
|
|
260c050f36 | ||
|
|
fc5c07927f | ||
|
|
d321f0d701 | ||
|
|
dddedcf088 | ||
|
|
95cbc138f7 | ||
|
|
395063ea35 | ||
|
|
835f95eb52 | ||
|
|
c0f6c91a0e | ||
|
|
b410d0e66f | ||
|
|
52853a4dc4 | ||
|
|
d04f72cfd8 | ||
|
|
a9203b8e22 | ||
|
|
31c7fdcfa6 | ||
|
|
e89c7c9328 | ||
|
|
7808865080 | ||
|
|
5283d1b6ae | ||
|
|
da6546779a | ||
|
|
404e2de3b6 | ||
|
|
9ba2611f3f | ||
|
|
f02dabc540 | ||
|
|
c29da46a97 | ||
|
|
b7702d2418 | ||
|
|
2bc56db4c6 | ||
|
|
dd0ef5455e | ||
|
|
7cffefff1c | ||
|
|
a8396df12a | ||
|
|
901bee6d3f | ||
|
|
3375eff719 | ||
|
|
72a0415207 | ||
|
|
de69652137 | ||
|
|
f6b696aad6 | ||
|
|
e7018965c9 | ||
|
|
126eaed2ca | ||
|
|
8916b5eca8 | ||
|
|
dda34dce5f | ||
|
|
1cd2d6b35e | ||
|
|
9888ec8a6f | ||
|
|
e2d5592d0a | ||
|
|
242d1fcfe5 | ||
|
|
77b0ebfa76 | ||
|
|
ea5321577a | ||
|
|
89508ccc3e | ||
|
|
24d80f86e5 | ||
|
|
23c772e029 | ||
|
|
e0b6c2cf6f | ||
|
|
e67387d9ea | ||
|
|
aac356d2a3 | ||
|
|
2156094407 | ||
|
|
54a6bc9c87 | ||
|
|
03d5bf1ef2 | ||
|
|
b12b3895ec | ||
|
|
42f57409c8 | ||
|
|
69d7ce408d | ||
|
|
15b3c0440c | ||
|
|
e1f0715c4d | ||
|
|
15aec72e97 | ||
|
|
66eade5db7 | ||
|
|
ea733bb48e | ||
|
|
83d9d1d924 | ||
|
|
5935bb012d | ||
|
|
48139b2be8 | ||
|
|
415babde64 | ||
|
|
f5f5f46c75 | ||
|
|
3d89e25349 | ||
|
|
1f57a01d5d | ||
|
|
7c890aa83a | ||
|
|
62a29c86ab | ||
|
|
bd57b6bb8e | ||
|
|
9ab1d16ea0 | ||
|
|
435aa28ca2 | ||
|
|
4bd375f154 | ||
|
|
d6521f9176 | ||
|
|
f8e0e4955a | ||
|
|
7957359c15 | ||
|
|
bdc3731b9a | ||
|
|
6b8af1220b | ||
|
|
58fffeaa84 | ||
|
|
5806785286 | ||
|
|
2f2d9b5f6f | ||
|
|
5af20c1ee0 | ||
|
|
7620be3b40 | ||
|
|
86f591b409 | ||
|
|
533dfe24d0 | ||
|
|
10c51dc46e | ||
|
|
a9d24a1e09 | ||
|
|
0cfe093701 | ||
|
|
11ec99fe6a | ||
|
|
b07e5a6da2 | ||
|
|
151738f896 | ||
|
|
075a370e7a | ||
|
|
e7aa147b90 | ||
|
|
2e988fab6d | ||
|
|
b38e03a53a | ||
|
|
68e01f9e6f | ||
|
|
4d32955e28 | ||
|
|
13a2aa7f03 | ||
|
|
ac91087b82 | ||
|
|
57a4a30402 | ||
|
|
dd3ee8d69a | ||
|
|
accbc9582e | ||
|
|
4a2845d7a5 | ||
|
|
9b2ae8992f | ||
|
|
1bb0038be8 | ||
|
|
6c4e73f1c4 | ||
|
|
72f5dbea87 | ||
|
|
aeb8411695 | ||
|
|
df6db9bd47 | ||
|
|
ab17044da9 | ||
|
|
7356bd98ab | ||
|
|
a631e52f63 | ||
|
|
b925100df7 | ||
|
|
eeba65440c | ||
|
|
95f72933a4 | ||
|
|
4b03e74662 | ||
|
|
b316eeb3eb | ||
|
|
53e6904ce1 | ||
|
|
e2b9647cf1 | ||
|
|
1145406531 | ||
|
|
9ce65c9a2b | ||
|
|
2ec1db8379 | ||
|
|
8074baef56 | ||
|
|
4584211c04 | ||
|
|
290099641b | ||
|
|
d0c3044e8e | ||
|
|
4e983ff440 | ||
|
|
9aba8b0d8f | ||
|
|
ee6ef6694f | ||
|
|
8330137c4e | ||
|
|
bd420ad963 | ||
|
|
e03bedf439 | ||
|
|
5cba246bb2 | ||
|
|
3490c16285 | ||
|
|
957fda9e8e | ||
|
|
b940adc341 | ||
|
|
f44a093ea9 | ||
|
|
0b6dc1ff5f | ||
|
|
907eb5feb5 | ||
|
|
17a339c318 | ||
|
|
3bea161618 | ||
|
|
b39a4a3624 | ||
|
|
2530d13d25 | ||
|
|
67e152c923 | ||
|
|
4934d4ad95 | ||
|
|
9a072949fd | ||
|
|
6e5f8676a1 | ||
|
|
5a52484295 | ||
|
|
a3338b0db7 | ||
|
|
d212d4a193 | ||
|
|
e3f9a0f607 | ||
|
|
91b7635d26 | ||
|
|
532581cb50 | ||
|
|
9b4a3a8ca9 | ||
|
|
564c397258 | ||
|
|
22e81898c0 | ||
|
|
ec863fe09a | ||
|
|
cb9a1d31d8 | ||
|
|
0e8d0495a9 | ||
|
|
fa19e5ebce | ||
|
|
b67e8960fa | ||
|
|
6efd697a1e | ||
|
|
a9379dcf0a | ||
|
|
9798f399bd | ||
|
|
a520510f9b | ||
|
|
fbfe82870f | ||
|
|
3b668f4dbd | ||
|
|
62eb54d853 | ||
|
|
81335454fd | ||
|
|
1b33221fc1 | ||
|
|
152c96838f | ||
|
|
f78af9b204 | ||
|
|
302b9e759f | ||
|
|
dab7e329df | ||
|
|
6a93fe77ca | ||
|
|
0e21a9bf91 | ||
|
|
723f504a56 | ||
|
|
121b324532 | ||
|
|
c54a4eee95 | ||
|
|
2a03797436 | ||
|
|
55dc4d1e77 | ||
|
|
cb51feef48 | ||
|
|
e75c957aad | ||
|
|
e08624fae3 | ||
|
|
e8ac486d4a | ||
|
|
1ded65b85d | ||
|
|
35b2f0e57e | ||
|
|
d6ef8e1b33 | ||
|
|
118025f646 | ||
|
|
0888752e2a | ||
|
|
df5177a565 | ||
|
|
3f03770b6e | ||
|
|
27ebac0722 | ||
|
|
e5b46bc547 | ||
|
|
468a236ce1 | ||
|
|
6fda3dd147 | ||
|
|
9f0705c82d | ||
|
|
0ab0de2371 | ||
|
|
ba7d79ef39 | ||
|
|
c0e51d85b5 | ||
|
|
80334d59ff | ||
|
|
759ad1a8d3 | ||
|
|
7c569d3880 | ||
|
|
7b21b82a2e | ||
|
|
5e86c5da8c | ||
|
|
9998f82596 | ||
|
|
9cb3f5fb3a | ||
|
|
dcce3335cd | ||
|
|
5f9b4d99f3 | ||
|
|
a6f4111383 | ||
|
|
569180ed86 | ||
|
|
f9cc21a06d | ||
|
|
e5ad31a965 | ||
|
|
5252d63260 | ||
|
|
a9fea0b9f5 | ||
|
|
cee91eb6af | ||
|
|
c61765cc31 | ||
|
|
03d3884bf4 | ||
|
|
cb01caddd3 | ||
|
|
725a2be959 | ||
|
|
45d2cec423 | ||
|
|
08b576105c | ||
|
|
6d86c65ea6 | ||
|
|
0e19fe087b | ||
|
|
2571f967b7 | ||
|
|
a93d5a0678 | ||
|
|
be1647548a | ||
|
|
91571fa47c | ||
|
|
cf3220581f | ||
|
|
44ddf9b400 | ||
|
|
99b4f7eb5c | ||
|
|
803111b12f | ||
|
|
9509d00fd4 | ||
|
|
70eb562400 | ||
|
|
2ceb686198 | ||
|
|
6f89a01c50 | ||
|
|
2d85106a1f | ||
|
|
cefe304c2f | ||
|
|
cbe4f0009b | ||
|
|
a9cad90a02 | ||
|
|
597d83c6f7 | ||
|
|
cbc3c3e921 | ||
|
|
2d1aa77ddc | ||
|
|
5357061d52 | ||
|
|
13b7db63d0 | ||
|
|
62b0020c67 | ||
|
|
4512dfd420 | ||
|
|
b1303cb50e | ||
|
|
3facbc782b | ||
|
|
cdcaf7cd24 | ||
|
|
dae249e4b2 | ||
|
|
ce782ab8bd | ||
|
|
2497ab6a5e | ||
|
|
2d00b27fb6 | ||
|
|
8d179aa719 | ||
|
|
6688e19789 | ||
|
|
1db8b94ea7 | ||
|
|
63a61349ea | ||
|
|
811066a201 | ||
|
|
0b547c26a2 | ||
|
|
15497b96d1 | ||
|
|
9c3cf0b8dd | ||
|
|
eeaff7ac9d | ||
|
|
17e48c4e9f | ||
|
|
4a878c73be | ||
|
|
f05e41afb6 | ||
|
|
ba8e63c40b | ||
|
|
5d6b9b4785 | ||
|
|
06c0a59632 | ||
|
|
f6df48278c | ||
|
|
8207684193 | ||
|
|
49ac186f80 | ||
|
|
4325e1591c | ||
|
|
16eb1e0b6d | ||
|
|
68668acf57 | ||
|
|
5e5e82d6b6 | ||
|
|
8e23ef59a3 | ||
|
|
0213064217 | ||
|
|
d360cbcb4b | ||
|
|
d1dea478f7 | ||
|
|
778e7b335e | ||
|
|
5fc502c6a2 | ||
|
|
ba5bd60931 | ||
|
|
dfb72bb3e1 | ||
|
|
c4880b77e6 | ||
|
|
8aab9d17b1 | ||
|
|
205beb068c | ||
|
|
80cf2f2e10 | ||
|
|
5982b27b90 | ||
|
|
d696ca3013 | ||
|
|
9d10218487 | ||
|
|
b41ef6094a | ||
|
|
9a9a69ace4 | ||
|
|
1000139d01 | ||
|
|
129984f4c6 | ||
|
|
d665bc54e0 | ||
|
|
69b027698d | ||
|
|
6ffff16f06 | ||
|
|
79393f16d3 | ||
|
|
5821a06f9e | ||
|
|
3eb4cf27f2 | ||
|
|
94c345c386 | ||
|
|
6fe7853eb7 | ||
|
|
c45ea08ab2 | ||
|
|
04d41e9c86 | ||
|
|
2850cffc6a | ||
|
|
0cdc15ecaf | ||
|
|
ee85ee369b | ||
|
|
738e56cc63 | ||
|
|
6b38e1561b | ||
|
|
a56d8b7d1c | ||
|
|
db6e5ee778 | ||
|
|
a0bf1af3d3 | ||
|
|
5b47178162 | ||
|
|
3f0684c1ea | ||
|
|
d2bc49755d | ||
|
|
0502c1768b | ||
|
|
cf7d21db32 | ||
|
|
977fb47efb | ||
|
|
6c7a3adcdd | ||
|
|
3b22e08840 | ||
|
|
8d79524c62 | ||
|
|
3c70f28dc0 | ||
|
|
79b37e7047 | ||
|
|
3050d8b5b5 | ||
|
|
231a40e4a8 | ||
|
|
1f1c87513b | ||
|
|
910822334e | ||
|
|
af02d721c3 | ||
|
|
faf7cb9acd | ||
|
|
73869d5674 | ||
|
|
f60732170e | ||
|
|
aecf04a4f8 | ||
|
|
7a383912c8 | ||
|
|
21c288badf | ||
|
|
65492ea1dc | ||
|
|
7fd10104cc | ||
|
|
ad85c6fa3f | ||
|
|
e32bf06e4d | ||
|
|
f363d77cb7 | ||
|
|
8986b6f426 | ||
|
|
8b35c064c8 | ||
|
|
da5ea180ab | ||
|
|
3aca557420 | ||
|
|
ea723742c7 | ||
|
|
d85675f540 | ||
|
|
9b4aeb8e4c | ||
|
|
2c539b1fe6 | ||
|
|
5f31e7e148 | ||
|
|
cc9227910f | ||
|
|
85d8dfe885 | ||
|
|
563179bec7 | ||
|
|
386ada05d6 | ||
|
|
70c2992282 | ||
|
|
36d6483a51 | ||
|
|
01039b9881 | ||
|
|
bbd1297302 | ||
|
|
88c0d8810c | ||
|
|
b365bc17db | ||
|
|
3f24e64988 | ||
|
|
7a5ce2f4ee | ||
|
|
a410fb903a | ||
|
|
ba4004d720 | ||
|
|
cdc980c2b6 | ||
|
|
3578cc9523 | ||
|
|
09ff1d1e5a | ||
|
|
8e4a6ef183 | ||
|
|
0d111a6bd8 | ||
|
|
3e503852db | ||
|
|
d3fe435115 | ||
|
|
e6a0080c0e | ||
|
|
b8ddb72d3b | ||
|
|
58953ca009 | ||
|
|
d4e98155d0 | ||
|
|
86fabe3352 | ||
|
|
c5ccf8e6da | ||
|
|
b7e0a0de23 | ||
|
|
9c2a18f0aa | ||
|
|
aa95f2cf88 | ||
|
|
8dd7f262a2 | ||
|
|
b76feba080 | ||
|
|
1b5aea85ba | ||
|
|
c89c7f5e0e | ||
|
|
bcaaf539be | ||
|
|
48f0988373 | ||
|
|
a0c0d37bfd | ||
|
|
9c696fe8d6 | ||
|
|
224e3475d8 | ||
|
|
841c5f85bd | ||
|
|
6745419a4f | ||
|
|
6bf9bb875a | ||
|
|
d6e1322775 | ||
|
|
bb0e97160c | ||
|
|
8124ceea6b | ||
|
|
b5cb0c0881 | ||
|
|
8747ccc105 | ||
|
|
8b0147484c | ||
|
|
233037a1eb | ||
|
|
11446ef857 | ||
|
|
4403131235 | ||
|
|
9dde3d0645 | ||
|
|
2fcf00ef4f | ||
|
|
1139cb242b | ||
|
|
796e1894ac | ||
|
|
8d15bdab3c | ||
|
|
e94564b5e7 | ||
|
|
67b56345e6 | ||
|
|
9ac2fe1534 | ||
|
|
08cf619807 | ||
|
|
380aad2f4d | ||
|
|
d3a8e57fdf | ||
|
|
c6542c0698 | ||
|
|
f74959ab00 | ||
|
|
2bb28ac270 | ||
|
|
faf3350aab | ||
|
|
9fc4e0b06e | ||
|
|
4c3ecf0b3a | ||
|
|
b1a345963d | ||
|
|
ca64d7c8ec | ||
|
|
f62db8b943 | ||
|
|
ce2a2a03a3 | ||
|
|
d947223b9b | ||
|
|
b1aea34137 | ||
|
|
ae6d03ce2b | ||
|
|
fa4b459d58 | ||
|
|
372a8d0d69 | ||
|
|
bd413a75a0 | ||
|
|
9bb0d123d3 | ||
|
|
59240fb090 | ||
|
|
598852484b | ||
|
|
18548c515e | ||
|
|
6190017919 | ||
|
|
e49cbcad3f | ||
|
|
2a22b94b95 | ||
|
|
739374de59 | ||
|
|
03b8041acb | ||
|
|
a31df6f2af | ||
|
|
64317389a8 | ||
|
|
ab4552d064 | ||
|
|
20281f8cbb | ||
|
|
fb7db0f91d | ||
|
|
b3b0e9254f | ||
|
|
03ffc7727d | ||
|
|
59a4f88eeb | ||
|
|
d504ab8f54 | ||
|
|
627c167ef7 | ||
|
|
656c9b1eee | ||
|
|
92f319a2d9 | ||
|
|
da1f96595f | ||
|
|
21568efa2c | ||
|
|
8a75a5a71b | ||
|
|
012e4d609d | ||
|
|
5e66d2e2c1 | ||
|
|
49ae22e048 | ||
|
|
5d92d14125 | ||
|
|
b6d52d3c97 | ||
|
|
7e2d445db8 | ||
|
|
2325ad695f | ||
|
|
c499b06baa | ||
|
|
a03a512846 | ||
|
|
1e6062bd10 | ||
|
|
2c90558785 | ||
|
|
f6071bad41 | ||
|
|
a09120f39e | ||
|
|
8fb7cbdfcf | ||
|
|
3e8da12410 | ||
|
|
d60213e93f | ||
|
|
0864f7d604 | ||
|
|
6fb2112e40 | ||
|
|
65bb063c2c | ||
|
|
75b2c91baa | ||
|
|
530be71fdd | ||
|
|
c064b8fa80 | ||
|
|
b2b0ed82e5 | ||
|
|
71a5e1ab22 | ||
|
|
371b140056 | ||
|
|
5555383b1e | ||
|
|
ffe824e405 | ||
|
|
6586785415 | ||
|
|
8a2554ef28 | ||
|
|
ec2ddc429a | ||
|
|
1754b8e7b9 | ||
|
|
2e20b24d04 | ||
|
|
5da3df3cd2 | ||
|
|
61d428a4a5 | ||
|
|
a941f0c5da | ||
|
|
199d0a956a | ||
|
|
105ec0f441 | ||
|
|
062effd39a | ||
|
|
3ac5c71736 | ||
|
|
97d7796f9d | ||
|
|
8cd4fe5891 | ||
|
|
77df445c03 | ||
|
|
a510bb4ea0 | ||
|
|
48883211ee | ||
|
|
8b77f181da | ||
|
|
88dbc988ca | ||
|
|
0ecd387ef8 | ||
|
|
2c4cc20005 | ||
|
|
b25c115913 | ||
|
|
e46921ac33 | ||
|
|
dab213ea01 | ||
|
|
7f058b8591 | ||
|
|
76cf945d40 | ||
|
|
c5850d18da | ||
|
|
645cdc440c | ||
|
|
6e910e002e | ||
|
|
cc4de320fd | ||
|
|
7565492666 | ||
|
|
878d74bfa5 | ||
|
|
ee2d8b3f00 | ||
|
|
ebd35638b2 | ||
|
|
6372c7a22e | ||
|
|
a404f7f196 | ||
|
|
0013ca382a | ||
|
|
a9c904afa7 | ||
|
|
a0be338676 | ||
|
|
58d0f2bd98 | ||
|
|
4c92d54119 | ||
|
|
711b2df143 | ||
|
|
0307900942 | ||
|
|
4c60898002 | ||
|
|
4d350b256b | ||
|
|
d41704f1b1 | ||
|
|
5bbb5ee937 | ||
|
|
50e825b7a0 | ||
|
|
dc036225be | ||
|
|
c5a8df84f7 | ||
|
|
7ad6c495a6 | ||
|
|
e8c217e468 | ||
|
|
9e32298d42 | ||
|
|
e4d833e49f | ||
|
|
8505f583f4 | ||
|
|
c1de2d9bd5 | ||
|
|
d192e0aabf | ||
|
|
fb5b464bf6 | ||
|
|
eb71379562 | ||
|
|
b603543537 | ||
|
|
344da24b5e | ||
|
|
23ef028cb4 | ||
|
|
492d4869c2 | ||
|
|
56e45c32f8 | ||
|
|
cb41c55e7a | ||
|
|
7d63eaf3e0 | ||
|
|
1538b08fd9 | ||
|
|
82a8914848 | ||
|
|
2d5bf843d5 | ||
|
|
f22f6d54aa | ||
|
|
d609e4f70b | ||
|
|
8f56769e14 | ||
|
|
fa5b2da69e | ||
|
|
937202784d | ||
|
|
07424df41a | ||
|
|
e960ac472e | ||
|
|
84113356b5 | ||
|
|
3844946dc0 | ||
|
|
9ecdf5713c | ||
|
|
f1abd22512 | ||
|
|
c963058571 | ||
|
|
7e264780ec | ||
|
|
0750a89f74 | ||
|
|
5b52668359 | ||
|
|
3c91f8450d | ||
|
|
f820168283 | ||
|
|
bdb90a0016 | ||
|
|
521fa42bf1 | ||
|
|
1b272ea0c7 | ||
|
|
b055adfd87 | ||
|
|
42ea6e0d7c | ||
|
|
20b21622ed | ||
|
|
34c61a2fc5 | ||
|
|
cf8198dc98 | ||
|
|
c57fd2c55e | ||
|
|
3669bf4e11 | ||
|
|
b6bbdada06 | ||
|
|
804a618408 | ||
|
|
a1192474d9 | ||
|
|
dd28642370 | ||
|
|
b92295cbb1 | ||
|
|
d186cd2b1a | ||
|
|
9ebee47d5c | ||
|
|
3fdc7c8cf7 | ||
|
|
b298b26bab | ||
|
|
0a38857e64 | ||
|
|
2497e9bd88 | ||
|
|
bee44612e5 | ||
|
|
8946b4ad11 | ||
|
|
d4b78b9977 | ||
|
|
f9614385df | ||
|
|
7352abebe9 | ||
|
|
5c57b34893 | ||
|
|
0d873b7302 | ||
|
|
ccca6a8f55 | ||
|
|
bad9cc848f | ||
|
|
e3ab16a7bf | ||
|
|
6db068e625 | ||
|
|
64b1ac3ccf | ||
|
|
ca038970ff | ||
|
|
4d852c8515 | ||
|
|
b96ea5100b | ||
|
|
fd86727bfc | ||
|
|
8dacf66242 | ||
|
|
bbb4271dd1 | ||
|
|
8b72499c19 | ||
|
|
0a9a5a47af | ||
|
|
4304724315 | ||
|
|
8dc3c146e0 | ||
|
|
7cefff04a7 | ||
|
|
dd6d6995b9 | ||
|
|
3606dc39e3 | ||
|
|
03fef2fc8c | ||
|
|
704e548654 | ||
|
|
6120d5501d | ||
|
|
3f8c338265 | ||
|
|
ec07b23af8 | ||
|
|
cc349ca545 | ||
|
|
b16ec66eb3 | ||
|
|
22667e17f1 | ||
|
|
5741834d53 | ||
|
|
0df39cdc4f | ||
|
|
70489e8846 | ||
|
|
c4558ec633 | ||
|
|
5b500ae42a | ||
|
|
cdbe6a2383 | ||
|
|
48c650eab2 | ||
|
|
0c815b5761 | ||
|
|
9b104b9a16 | ||
|
|
97248e2b18 | ||
|
|
b3aa244f4e | ||
|
|
45c59ff242 | ||
|
|
0038c3666d | ||
|
|
7cfebbf87e | ||
|
|
0cd3666a96 | ||
|
|
d4a5f68398 | ||
|
|
1a30a9c29a | ||
|
|
cd75ddbbd7 | ||
|
|
55aedb7194 | ||
|
|
aa303d164f | ||
|
|
1723f63b21 | ||
|
|
55fef695ec | ||
|
|
42ee41ae54 | ||
|
|
676f480db8 | ||
|
|
233408b076 | ||
|
|
9dfec82f6e | ||
|
|
3c791b6363 | ||
|
|
5a0e5f6804 | ||
|
|
3376ab06d0 | ||
|
|
e8b22f9331 | ||
|
|
0b9104f992 | ||
|
|
566d0e50a6 | ||
|
|
be5a6a0ee0 | ||
|
|
4df460d6cb | ||
|
|
7443c969b1 | ||
|
|
3b5b1fb1b3 | ||
|
|
5737927e2d | ||
|
|
c59b837315 | ||
|
|
ce75b68df0 | ||
|
|
d17257fc95 | ||
|
|
ed996eff43 | ||
|
|
8f70c32687 | ||
|
|
d134db65a3 | ||
|
|
deaa3f3f73 | ||
|
|
5f5f6dcf38 | ||
|
|
8e373a9c33 | ||
|
|
f7a367d755 | ||
|
|
fea113269b | ||
|
|
5299da7a21 | ||
|
|
9a06ee3221 | ||
|
|
5b489e2341 | ||
|
|
5b0e4f910d | ||
|
|
575a4f12cc | ||
|
|
9b77f74e53 | ||
|
|
7be801c647 | ||
|
|
a95471a239 | ||
|
|
8982993813 | ||
|
|
cc48dc2a65 | ||
|
|
9e0d8632f5 | ||
|
|
2f751085e0 | ||
|
|
f5faae13c4 | ||
|
|
015fd4014c | ||
|
|
ff9c68d7f6 | ||
|
|
323138eebf | ||
|
|
43f15252bb | ||
|
|
25ad4ffa43 | ||
|
|
0cd3a464d8 | ||
|
|
71e9b313bb | ||
|
|
9b13f82c55 | ||
|
|
20cf214187 | ||
|
|
2d06568470 | ||
|
|
59ccd121c5 | ||
|
|
caa0256f19 | ||
|
|
b27b356997 | ||
|
|
3b76eec06c | ||
|
|
04a768ee40 | ||
|
|
0a3490d4f2 | ||
|
|
df71605c47 | ||
|
|
7424828f0c | ||
|
|
c9c759f33b | ||
|
|
98835fdb6c | ||
|
|
d32887ed40 | ||
|
|
6dd7573f7b | ||
|
|
0027e1bf9a | ||
|
|
eb10aa33d6 | ||
|
|
cfe77569f1 | ||
|
|
62da3462bc | ||
|
|
334b0baacc | ||
|
|
d16d177eaf | ||
|
|
2966f158fe | ||
|
|
1f57bcb250 | ||
|
|
90e775c27a | ||
|
|
9ff47844e7 | ||
|
|
042d98d05b | ||
|
|
0533c5a3ef | ||
|
|
0325f637b2 | ||
|
|
3d2bfe48b9 | ||
|
|
c8a538d73e | ||
|
|
fbc171b07f | ||
|
|
70e4921961 | ||
|
|
1ca96c7ca8 | ||
|
|
65359f103f | ||
|
|
e5afffbde1 | ||
|
|
66364e91b7 | ||
|
|
567ca19398 | ||
|
|
1e073def9d | ||
|
|
70c772dfd2 | ||
|
|
709259f45e | ||
|
|
dca51642e3 | ||
|
|
f24aea6354 | ||
|
|
c020cd4251 | ||
|
|
452e2ddc51 | ||
|
|
1860c69313 | ||
|
|
201beca8fa | ||
|
|
9182aeef99 | ||
|
|
d2cb7f60de | ||
|
|
c6beb0aac3 | ||
|
|
e394b12888 | ||
|
|
a461c8515f | ||
|
|
9bb36e1a35 | ||
|
|
1a5c75daac | ||
|
|
2c7633e74d | ||
|
|
996ad352e1 | ||
|
|
5c4b0d7723 | ||
|
|
6485ed38d6 | ||
|
|
48d9c0a7ff | ||
|
|
40c4b77cbf | ||
|
|
9b0ed1c833 | ||
|
|
bc6e74a092 | ||
|
|
52bdb136d4 | ||
|
|
f0e77da5d4 | ||
|
|
0b77c4cdfe | ||
|
|
2efa0c0ca7 | ||
|
|
87892c799c | ||
|
|
5bfa258881 | ||
|
|
d742de40c5 | ||
|
|
bb3bd0e915 | ||
|
|
8d50f52b7f | ||
|
|
bd2fd5eb3a | ||
|
|
2db25fda63 | ||
|
|
3067abcac2 | ||
|
|
c0c77e6e6b | ||
|
|
4037ffa295 | ||
|
|
2aa263847f | ||
|
|
50f9f24887 | ||
|
|
e36ee5aaff | ||
|
|
6d8017f1dc | ||
|
|
d22ce60f7b | ||
|
|
bc7d4f214f | ||
|
|
daa80d7196 | ||
|
|
8d3da43dca | ||
|
|
15b329580c | ||
|
|
0e2f8d9bf9 | ||
|
|
951d68724b | ||
|
|
f678253b05 | ||
|
|
0603eaf48d | ||
|
|
753caf7eeb | ||
|
|
5dbf719a53 | ||
|
|
1e945cff41 | ||
|
|
4a1237cdcc | ||
|
|
b60e65379e | ||
|
|
6da4e1796b | ||
|
|
2666f05bd5 | ||
|
|
461bffbf02 | ||
|
|
2653bba158 | ||
|
|
56d73519bf | ||
|
|
df3a7d78f4 | ||
|
|
898a7d89c7 | ||
|
|
2734b9bf8c | ||
|
|
2c074c6e82 | ||
|
|
1e67fe69e1 | ||
|
|
08cf333c0c | ||
|
|
0f62d7da13 | ||
|
|
8ce806d41f | ||
|
|
59a564cc1b | ||
|
|
1135573af6 | ||
|
|
c9a1e3733c | ||
|
|
6dbeba3473 | ||
|
|
351087781e | ||
|
|
92f977d6c2 | ||
|
|
489fbb8800 | ||
|
|
159c19fe08 | ||
|
|
c13e46554d | ||
|
|
6f45e26028 | ||
|
|
7e02481b35 | ||
|
|
79e94a8255 | ||
|
|
288398d4c2 | ||
|
|
92afc4deee | ||
|
|
f6892877c1 | ||
|
|
30c57921d1 | ||
|
|
d23bf569c0 | ||
|
|
796830d2dd | ||
|
|
286ec0325d | ||
|
|
c8338e1759 | ||
|
|
5f8adf51c1 | ||
|
|
c7cc44edf6 | ||
|
|
e958d7c488 | ||
|
|
77ff11990b | ||
|
|
e1538a5028 | ||
|
|
994e0c1eda | ||
|
|
d51e88be60 | ||
|
|
b1ba07a995 | ||
|
|
146a7aba1f | ||
|
|
981c60c78a | ||
|
|
2e85e7fc56 | ||
|
|
99edab675a | ||
|
|
1a8d3a3cdf | ||
|
|
43abd1740e | ||
|
|
261d60f338 | ||
|
|
1a36d7758b | ||
|
|
c09fc39881 | ||
|
|
0a7cd28ab5 | ||
|
|
bf8bf5e4d9 | ||
|
|
1defafd258 | ||
|
|
4854133f46 | ||
|
|
d93879a24d | ||
|
|
8ff6d2063c | ||
|
|
a46ecce6d0 | ||
|
|
49175ae1b1 | ||
|
|
532473df15 | ||
|
|
252ba4dccc | ||
|
|
1ddac304d7 | ||
|
|
44ecebad03 | ||
|
|
67d8c6cb17 | ||
|
|
c52ca7244f | ||
|
|
b42b276054 | ||
|
|
619a279dbb | ||
|
|
56e0c9928e | ||
|
|
25a424266b | ||
|
|
c8b13e07b1 | ||
|
|
9595d528a8 | ||
|
|
48cf4a6ed6 | ||
|
|
9de2b5f7ef | ||
|
|
9bfb27e10a | ||
|
|
be50630d2f | ||
|
|
7d7234a226 | ||
|
|
a7517bed9d | ||
|
|
66fca4dadd | ||
|
|
645b64437f | ||
|
|
efa2755f19 | ||
|
|
4fe0f53878 | ||
|
|
d8b629a5a0 | ||
|
|
5db5b41f7f | ||
|
|
6d0b39f2b6 | ||
|
|
909aa49e39 | ||
|
|
dd3d09f895 | ||
|
|
395182bda5 | ||
|
|
fd7d73756a | ||
|
|
aff95d47dd | ||
|
|
b778f74628 | ||
|
|
9f72d65281 | ||
|
|
6db658c0b3 | ||
|
|
6fb88665bb | ||
|
|
669cc2b883 | ||
|
|
dec262e999 | ||
|
|
cb03047ac3 | ||
|
|
8c5f94ace4 | ||
|
|
6269f02bca | ||
|
|
f20a47542a | ||
|
|
c77e3b7e92 | ||
|
|
e7b033304c | ||
|
|
2b8a8d23eb | ||
|
|
0f59f79a9e | ||
|
|
2904cd1f53 | ||
|
|
d87ae60fea | ||
|
|
0d17cf6e78 | ||
|
|
81739d59f5 | ||
|
|
7704d5afd0 | ||
|
|
da268f2b29 | ||
|
|
01dc251ef2 | ||
|
|
9054d70f4c | ||
|
|
788b265cd4 | ||
|
|
c96640bcb1 | ||
|
|
66fb7b4e81 | ||
|
|
d83a19e316 | ||
|
|
452e39903e | ||
|
|
797fcc172c | ||
|
|
cdb7c919b3 | ||
|
|
0f7f438935 | ||
|
|
7c01eedda8 | ||
|
|
bab7f3e9fc | ||
|
|
761d85a112 | ||
|
|
52e323123a | ||
|
|
01af1677cf | ||
|
|
d4f4fcb10e | ||
|
|
74fd228bfb | ||
|
|
f452d2e5d2 | ||
|
|
3a01348e02 | ||
|
|
b1743ee4a2 | ||
|
|
ab14769387 | ||
|
|
5c800601e4 | ||
|
|
8aea81340b | ||
|
|
8513911f21 | ||
|
|
6a46c453cd | ||
|
|
2029dc5e10 | ||
|
|
70664d1a7a | ||
|
|
7d212ec62f | ||
|
|
fa7b145e07 | ||
|
|
830645cb73 | ||
|
|
94e03b3c18 | ||
|
|
3ace85eebc | ||
|
|
c6cfdd9e90 | ||
|
|
d1b2dfae3e | ||
|
|
98fb345a5a | ||
|
|
481314886f | ||
|
|
ad90cd171a | ||
|
|
8272e0e652 | ||
|
|
f218de2e04 | ||
|
|
53529fc506 | ||
|
|
aef99fb4fd | ||
|
|
86f690c79f | ||
|
|
71f9e90436 | ||
|
|
75608f41b1 | ||
|
|
0730ae5b3f | ||
|
|
a7f537879e | ||
|
|
6066cf1d65 | ||
|
|
ccda236b6e | ||
|
|
32ec348369 | ||
|
|
d85f66171d | ||
|
|
8c6aa46ec8 | ||
|
|
d2f7bc475a | ||
|
|
410cf02518 | ||
|
|
958414017e | ||
|
|
8fbfad9637 | ||
|
|
07e8f94748 | ||
|
|
4db162f9f7 | ||
|
|
459dfb7937 | ||
|
|
56b0536152 | ||
|
|
5bb7dd3ccd | ||
|
|
6e50e4fd8e | ||
|
|
878e1616da | ||
|
|
64a410099e | ||
|
|
9cb8664ddf | ||
|
|
6d5c3c8ad5 | ||
|
|
f07c8fca64 | ||
|
|
944c76ad93 | ||
|
|
ae8f9df02b | ||
|
|
6da3659b7d | ||
|
|
1f1d9f3abd | ||
|
|
530d7f2d81 | ||
|
|
e67ecded2a | ||
|
|
b9343d5e64 | ||
|
|
898393c7ac | ||
|
|
9b2ea5298d | ||
|
|
0d2b56c58f | ||
|
|
076c920dc7 | ||
|
|
638df642ec | ||
|
|
d2f4190612 | ||
|
|
7201f517e8 | ||
|
|
c91365f627 | ||
|
|
f3bc4dbccf | ||
|
|
d4daef6012 | ||
|
|
dbf4f68a44 | ||
|
|
8a7325963b | ||
|
|
fc0d8dffcd | ||
|
|
f8498e3adc | ||
|
|
e4b51ba675 | ||
|
|
83f9ead607 | ||
|
|
bf6778770e | ||
|
|
093b80293a | ||
|
|
34dee314e7 | ||
|
|
313b94168e | ||
|
|
d6085bbdcf | ||
|
|
160dc5d61c | ||
|
|
987b383d7c | ||
|
|
8b4cb1568e | ||
|
|
aef4028180 | ||
|
|
9b779ee8cd | ||
|
|
ccc339cf48 | ||
|
|
6aabbfd944 | ||
|
|
0e87626e34 | ||
|
|
8641181511 | ||
|
|
123c3ef8ab | ||
|
|
07bd5a9d60 | ||
|
|
deca89039a | ||
|
|
1542fa86d8 | ||
|
|
93ca814fe3 | ||
|
|
4d9e5ee302 | ||
|
|
0a697cdc0a | ||
|
|
1b01e476ac | ||
|
|
ee689fb351 | ||
|
|
92a76d80f2 | ||
|
|
a662c1a5fe | ||
|
|
3ffa949276 | ||
|
|
371966e2cf | ||
|
|
8f1a4d2a02 | ||
|
|
3128b6f25a | ||
|
|
0920821f1e | ||
|
|
0f8f9c01ff | ||
|
|
1d9621bc91 | ||
|
|
e138daec5f | ||
|
|
4a51e754d7 | ||
|
|
e6e0bc1703 | ||
|
|
49fbc6e082 | ||
|
|
a0ed610f60 | ||
|
|
9f8c0eb4a2 | ||
|
|
be29fac010 | ||
|
|
b3cefd9bcb | ||
|
|
501d6f2692 | ||
|
|
3d7560024f | ||
|
|
a201b45d04 | ||
|
|
41f88a4015 | ||
|
|
52a131ef93 | ||
|
|
7ab28601ca | ||
|
|
5de509a0de | ||
|
|
2534b14dce | ||
|
|
27f98b95eb | ||
|
|
b08bee78b9 | ||
|
|
a39327a95b | ||
|
|
f979a8dd46 | ||
|
|
ecf1645e05 | ||
|
|
d015bec89c | ||
|
|
92e1d4b8e6 | ||
|
|
a75df456e2 | ||
|
|
5393c2f314 | ||
|
|
c49bcc29db | ||
|
|
3e74fb49ac | ||
|
|
cf885cafb4 | ||
|
|
7a7c605687 | ||
|
|
5676d42801 | ||
|
|
c893a4441d | ||
|
|
c5e1d0847f | ||
|
|
f0b4c2dc79 | ||
|
|
1584f25af5 | ||
|
|
761e7b2344 | ||
|
|
7099c92c39 | ||
|
|
be26ec2651 | ||
|
|
7a2f49ad43 | ||
|
|
22477385f7 | ||
|
|
e7ae0862ba | ||
|
|
f501a7377d | ||
|
|
9ce9ccdb5c | ||
|
|
f8a425b7d1 | ||
|
|
8ab92f8668 | ||
|
|
e598665242 | ||
|
|
1bc984f8fa | ||
|
|
3a0b1a22f0 | ||
|
|
8fd41d5ea7 | ||
|
|
787adc72a5 | ||
|
|
a99b043d95 | ||
|
|
2079c19dc0 | ||
|
|
9f9ba2c915 | ||
|
|
31db584658 | ||
|
|
a09c7db717 | ||
|
|
19bd38bb85 | ||
|
|
7e678a8378 | ||
|
|
93c5d7eb91 | ||
|
|
a9fcf5d510 | ||
|
|
6f1266dcea | ||
|
|
2395fb6986 | ||
|
|
48a0fa5e96 | ||
|
|
95a0f78fa7 | ||
|
|
85f18fe338 | ||
|
|
cbfad8eb79 | ||
|
|
5cd4a92049 | ||
|
|
e5b4de1683 | ||
|
|
cdd07a9f44 | ||
|
|
121eaabe40 | ||
|
|
f559c512fd | ||
|
|
9aa5ed63d0 | ||
|
|
fa9c0e5b3b | ||
|
|
469c6f3b45 | ||
|
|
e23e013432 | ||
|
|
e051ef4935 | ||
|
|
2a4e816448 | ||
|
|
4095530491 | ||
|
|
5a40507b54 | ||
|
|
f438b0898b | ||
|
|
58cfeeb1be | ||
|
|
6dbd521501 | ||
|
|
541cb13ec3 | ||
|
|
e7fbcbbac6 | ||
|
|
7bc3d8a826 | ||
|
|
a814a95c9a | ||
|
|
e95a40f24d | ||
|
|
b5972da08e | ||
|
|
9f488c5539 | ||
|
|
aeea86155c | ||
|
|
843ca2a7c5 | ||
|
|
bbb67856c0 | ||
|
|
1100e82364 | ||
|
|
7dfafaee22 | ||
|
|
cd1aab0b1e | ||
|
|
fa9c2806ca | ||
|
|
736a53c8d0 | ||
|
|
0b713be508 | ||
|
|
715b290174 | ||
|
|
54d241d247 | ||
|
|
bf8f9023e2 | ||
|
|
f57c81efe4 | ||
|
|
6d12cf44b4 | ||
|
|
4e76855a12 | ||
|
|
724b2adbbd | ||
|
|
c95031912a | ||
|
|
4f7c6dacee | ||
|
|
716e434099 | ||
|
|
f1f566d56f | ||
|
|
4cf1b8dbda | ||
|
|
87ce26f3cd | ||
|
|
94c157df7a | ||
|
|
d13ccb8dc7 | ||
|
|
b73d82ba00 | ||
|
|
afdeeeffa7 | ||
|
|
16cd135cb7 | ||
|
|
0c6df91604 | ||
|
|
58a6ced886 | ||
|
|
d0d3f39f5d | ||
|
|
82a96c743c | ||
|
|
a18453c3af | ||
|
|
a75dc61748 | ||
|
|
0a60663548 | ||
|
|
53cac1c299 | ||
|
|
4d624aa6d1 | ||
|
|
ca807c7ec8 | ||
|
|
f245b30d90 | ||
|
|
0cfb29ad6d | ||
|
|
27ed23cb51 | ||
|
|
1794042cea | ||
|
|
6657078a89 | ||
|
|
a156e869fc | ||
|
|
06ffe9d373 | ||
|
|
817fc2fd40 | ||
|
|
2ec4464a52 | ||
|
|
e79874c039 | ||
|
|
72b9d77e44 | ||
|
|
c622b976de | ||
|
|
4e0d570f90 | ||
|
|
ffce8cb0f7 | ||
|
|
6dd2e365ad | ||
|
|
c324729cdf | ||
|
|
5b3eee299c | ||
|
|
2ff6946b91 | ||
|
|
c3a44a413a | ||
|
|
a4050b1476 | ||
|
|
2da6d68fe3 | ||
|
|
ed19b9d328 | ||
|
|
f41e4f2df4 | ||
|
|
410bd7f177 | ||
|
|
caa659020e | ||
|
|
877820f5f5 | ||
|
|
18c6847481 | ||
|
|
274c043f44 | ||
|
|
529d8c1100 | ||
|
|
c05c169948 | ||
|
|
99db3f5416 | ||
|
|
1fa976a43c | ||
|
|
32198144cc | ||
|
|
29420a5306 | ||
|
|
67f6f9b250 | ||
|
|
c2bbc2e61e | ||
|
|
2d74cddf86 | ||
|
|
53049cf1f4 | ||
|
|
6aa012891d | ||
|
|
5a7f3ed101 | ||
|
|
131743e702 | ||
|
|
b5cde9a157 | ||
|
|
b150aad977 | ||
|
|
75d220e74d | ||
|
|
39a3d215d6 | ||
|
|
8fe87ccd04 | ||
|
|
621a2ffbbf | ||
|
|
0f582c59ab | ||
|
|
ce18f41400 | ||
|
|
d780847232 | ||
|
|
c074423f0b | ||
|
|
31cb2fed88 | ||
|
|
225f407545 | ||
|
|
f10dd19446 | ||
|
|
78d5547e08 | ||
|
|
af08f23ca1 | ||
|
|
99d2f14008 | ||
|
|
a90a2b859d | ||
|
|
b0edae1eae | ||
|
|
a5d923c4e3 | ||
|
|
86e118341e | ||
|
|
ed152c9d4c | ||
|
|
8fa805f5eb | ||
|
|
16ce5385f4 | ||
|
|
d1fe581706 | ||
|
|
dc651b5d77 | ||
|
|
be3dabe5a7 | ||
|
|
21326ec3b5 | ||
|
|
8b851463bc | ||
|
|
d4a3eb1026 | ||
|
|
0980120184 | ||
|
|
db275028d1 | ||
|
|
f78004b9d3 | ||
|
|
bac0227675 | ||
|
|
9f84faa776 | ||
|
|
639c52d1d6 | ||
|
|
811db09a1d | ||
|
|
9c61e03542 | ||
|
|
3e4e86bd5a | ||
|
|
5acf253a98 | ||
|
|
84cfcd4352 | ||
|
|
73f3673a11 | ||
|
|
2c18f75152 | ||
|
|
3601ee35bd | ||
|
|
76379f49be | ||
|
|
1f1fc9111f | ||
|
|
334bd55ad6 | ||
|
|
2f9f0964ed | ||
|
|
b5b04f85d0 | ||
|
|
554f5de0af | ||
|
|
5f528c9f6f | ||
|
|
64b98a7a3c | ||
|
|
74c9d5a8e6 | ||
|
|
ff2ca7f18c | ||
|
|
a0203d3310 | ||
|
|
bddd55213f | ||
|
|
fa97c0ede4 | ||
|
|
1dbfe36d1e | ||
|
|
ec898f297a | ||
|
|
67049d2f08 | ||
|
|
a2c7f84907 | ||
|
|
338ba010a2 | ||
|
|
a9737e8352 | ||
|
|
fb8a4b90ca | ||
|
|
6876bd9a6d | ||
|
|
392f107de1 | ||
|
|
17ab2cc717 | ||
|
|
abddb6c686 | ||
|
|
0a5ec4b81c | ||
|
|
ddba654f00 | ||
|
|
27a5833b36 | ||
|
|
c4cc29b452 | ||
|
|
ac56846e1b | ||
|
|
efb7592782 | ||
|
|
6c40c5a20c | ||
|
|
724c79d089 | ||
|
|
7148cb232b | ||
|
|
9943d1794b | ||
|
|
972615c8e6 | ||
|
|
213546b83f | ||
|
|
e23345edc6 | ||
|
|
7af38e8d21 | ||
|
|
b1e62ecb20 | ||
|
|
f05e3924ff | ||
|
|
2ccb9c3a17 | ||
|
|
c64d27f413 | ||
|
|
2a3711d0b4 | ||
|
|
2baace4ef9 | ||
|
|
aa501a4429 | ||
|
|
3095f61011 | ||
|
|
001de70fe8 | ||
|
|
58733450d1 | ||
|
|
0605672c32 | ||
|
|
0c570b0d83 | ||
|
|
0833428b71 | ||
|
|
4c4714a846 | ||
|
|
155cd428f6 | ||
|
|
06bde4f1ce | ||
|
|
6112a9d02d | ||
|
|
a3f4beac61 | ||
|
|
b116821731 | ||
|
|
3439267926 | ||
|
|
1ac55737b4 | ||
|
|
c66cfeb297 | ||
|
|
85f9fe6f3b | ||
|
|
fe9154fde7 | ||
|
|
bdc7bbada4 | ||
|
|
9f4a203abe | ||
|
|
a89872b785 | ||
|
|
b6bc0471b8 | ||
|
|
c38544e6ad | ||
|
|
6122edb091 | ||
|
|
684441040c | ||
|
|
55c733b13a | ||
|
|
dc7571d30c | ||
|
|
699c1d1f23 | ||
|
|
f67fbbd621 | ||
|
|
dbcc7e61c1 | ||
|
|
afd0f5a5ef | ||
|
|
859f1f0cd9 | ||
|
|
3f8ccb69fc | ||
|
|
ba65ccffe4 | ||
|
|
533fff4d30 | ||
|
|
7b0b3d05ad | ||
|
|
e09c101f82 | ||
|
|
c87c657b02 | ||
|
|
4e6b300477 | ||
|
|
7453eb583a | ||
|
|
b5d2eb93aa | ||
|
|
b5b8ab4a8e | ||
|
|
b6010a7ad7 | ||
|
|
ebdb649bd7 | ||
|
|
ec17306992 | ||
|
|
9b6bf4171b | ||
|
|
252b5ef729 | ||
|
|
220d4d1b77 | ||
|
|
2f8e1aeaf2 | ||
|
|
ced41021f0 | ||
|
|
36e3cc4688 | ||
|
|
20db3b0bd2 | ||
|
|
0ab702726d | ||
|
|
6d796c0b20 | ||
|
|
100fec9409 | ||
|
|
0b5beeba85 | ||
|
|
dec5ab6a16 | ||
|
|
909d31b9fe | ||
|
|
d9522cf555 | ||
|
|
e42a877bf6 | ||
|
|
68cbadda4c | ||
|
|
8beeb64cbf | ||
|
|
da3a18e766 | ||
|
|
ffb94b960d | ||
|
|
f73ac0779b | ||
|
|
8003af682e | ||
|
|
cbf7bf18f2 | ||
|
|
ceaa0a8322 | ||
|
|
8ca410d994 | ||
|
|
5fc7f2509d | ||
|
|
f2e1ba3780 | ||
|
|
93ac871640 | ||
|
|
187a8a02a1 | ||
|
|
bcf5686eec | ||
|
|
027507b61e | ||
|
|
49b3d17952 | ||
|
|
e0958cfeec | ||
|
|
00e12b50b7 | ||
|
|
44b8b00106 | ||
|
|
e0855e3092 | ||
|
|
cb0d70430a | ||
|
|
042575ce6b | ||
|
|
5cd18b57d2 | ||
|
|
d1e46e3d9a | ||
|
|
1a3348f2c2 | ||
|
|
75edc5c165 | ||
|
|
60184ebbbe | ||
|
|
ddb6cb7483 | ||
|
|
2ddd44a2fe | ||
|
|
ce55866445 | ||
|
|
2bc7f85a58 | ||
|
|
a27df2c41f | ||
|
|
170581dd28 | ||
|
|
00b0c904ae | ||
|
|
fdab17265f | ||
|
|
96d0a7db00 | ||
|
|
2835928ac0 | ||
|
|
4c22b42b99 | ||
|
|
64ddaa40a8 | ||
|
|
bc7006e193 | ||
|
|
1ae0a9df28 | ||
|
|
a4f9280eba | ||
|
|
2528fc34c8 | ||
|
|
979f07bf9b | ||
|
|
52bff4de1c | ||
|
|
4c017361f8 | ||
|
|
84aa1339d9 | ||
|
|
987cd4a121 | ||
|
|
e50ad5106f | ||
|
|
071cbcb0fb | ||
|
|
43f1cb9af9 | ||
|
|
220c55e9b4 | ||
|
|
927610efb0 | ||
|
|
78fcaf1fa3 | ||
|
|
3bd9af031d | ||
|
|
16ee3d68e8 | ||
|
|
d49ee3c187 | ||
|
|
2e544f1ccf | ||
|
|
1c51125e66 | ||
|
|
1ed47f5d0d | ||
|
|
133fa0cb36 | ||
|
|
295904bf4c | ||
|
|
951230f7e1 | ||
|
|
ee58886206 | ||
|
|
41575f6f13 | ||
|
|
18ae33d417 | ||
|
|
36daf5a762 | ||
|
|
8a41a2cd05 | ||
|
|
61497d2a01 | ||
|
|
a3045a88f3 | ||
|
|
fd072520a9 | ||
|
|
6ef9d8428f | ||
|
|
33a7176165 | ||
|
|
044de7d744 | ||
|
|
801ba05cd8 | ||
|
|
0dc5a4e4f3 | ||
|
|
230ed63e67 | ||
|
|
7316866a1a | ||
|
|
c7be54d9c9 | ||
|
|
dcc118ec5d | ||
|
|
84e98054b7 | ||
|
|
f37308f5a5 | ||
|
|
9688b3be3c | ||
|
|
6490a1ca97 | ||
|
|
c15fc89f52 | ||
|
|
9207030ccb | ||
|
|
018eb44de6 | ||
|
|
bc92b96a6b | ||
|
|
ee57c9223c | ||
|
|
f799ffc61f | ||
|
|
bdb1f2f3b6 | ||
|
|
fd755df67b | ||
|
|
e9edd01d08 | ||
|
|
dea7e0b33e | ||
|
|
25b50baa1a | ||
|
|
8a53657b9c | ||
|
|
c6ecbf4942 | ||
|
|
56d11807a1 | ||
|
|
cf3b4b284a | ||
|
|
953a59cb57 | ||
|
|
f60061a387 | ||
|
|
c627d84273 | ||
|
|
5a16ee0493 | ||
|
|
14252d6e9e | ||
|
|
c0de3e1c4e | ||
|
|
e0c3530ae5 | ||
|
|
8b4070f9ae | ||
|
|
0b6c5c2862 | ||
|
|
ce9ff10cb0 | ||
|
|
de688bfa12 | ||
|
|
f4ef5fc36f | ||
|
|
b1e184c6d1 | ||
|
|
fbf665fd76 | ||
|
|
95fd66a7a6 | ||
|
|
4b98ea79e0 | ||
|
|
2e916a2ba8 | ||
|
|
26a4d1c6ff | ||
|
|
33fef4c90e | ||
|
|
2dc15294fc | ||
|
|
171df33736 | ||
|
|
9b846b45bc | ||
|
|
bc65975f74 | ||
|
|
a5308831f2 | ||
|
|
ef05e4e9f4 | ||
|
|
83f0a81eb7 | ||
|
|
9e28d4a261 | ||
|
|
a9b3320302 | ||
|
|
b67580ee1d | ||
|
|
884ccb5265 | ||
|
|
ac56c3f79e | ||
|
|
e218056683 | ||
|
|
838288a463 | ||
|
|
e74b90d048 | ||
|
|
b2a653a3dc | ||
|
|
48ee7d4cc7 | ||
|
|
1d38f80748 | ||
|
|
c712366737 | ||
|
|
71f40fd440 | ||
|
|
9049ebfa8c | ||
|
|
f4b9356173 | ||
|
|
beaa4a29ba | ||
|
|
632ee66155 | ||
|
|
4446bc3167 | ||
|
|
785934c7cc | ||
|
|
ac36096d55 | ||
|
|
8ec8cb3c56 | ||
|
|
1f7cb2402d | ||
|
|
987ba2faa5 | ||
|
|
a24f697dca | ||
|
|
3825893ec1 | ||
|
|
a4ed78b953 | ||
|
|
c7947d0c46 | ||
|
|
eed9059913 | ||
|
|
20a1053413 | ||
|
|
16aca57f17 | ||
|
|
a225748840 | ||
|
|
fff1be9d07 | ||
|
|
b73ca3f1bc | ||
|
|
93a4f999b6 | ||
|
|
3030643ce4 | ||
|
|
e814ea9ec6 | ||
|
|
de16e9a9ce | ||
|
|
62fba991e2 | ||
|
|
832c63e014 | ||
|
|
46913c3574 | ||
|
|
0194d364b8 | ||
|
|
1c7785f6ba | ||
|
|
1049ec56eb | ||
|
|
734936b605 | ||
|
|
67e1a088ff | ||
|
|
af623631d1 | ||
|
|
8035bc424e | ||
|
|
7e99cd94b3 | ||
|
|
a88218aceb | ||
|
|
e5fd4dac4d | ||
|
|
26d407bd68 | ||
|
|
80ad96cce6 | ||
|
|
1d85ac3428 | ||
|
|
ca5dfd851d | ||
|
|
8c76b88b8d | ||
|
|
ff5616c399 | ||
|
|
2027b5aca9 | ||
|
|
a43e401ce7 | ||
|
|
396e2c176c | ||
|
|
4ab40990f5 | ||
|
|
35e325d8d0 | ||
|
|
b947d667d6 | ||
|
|
b4ab83d2d8 | ||
|
|
74adfb8b3e | ||
|
|
63bea467c3 | ||
|
|
cf449bba31 | ||
|
|
d247557fa9 | ||
|
|
bcd1c9618d | ||
|
|
cb1c87155f | ||
|
|
0b757b94a4 | ||
|
|
4ffcca7978 | ||
|
|
aac68b9624 | ||
|
|
4b0aeea778 | ||
|
|
1b9522f89c | ||
|
|
391f77d6f8 | ||
|
|
feb8a300d9 | ||
|
|
e2e77d59f9 | ||
|
|
2cb2d2cc2d | ||
|
|
d62c83d869 | ||
|
|
0639ab8424 | ||
|
|
9bdc19d3c2 | ||
|
|
6e26c093fa | ||
|
|
ca40c99ac2 | ||
|
|
6e1cef3d2f | ||
|
|
cc6f89366a | ||
|
|
d0e486a97c | ||
|
|
9c3db209d8 | ||
|
|
3ff6b93ccb | ||
|
|
2bfc86323d | ||
|
|
ed1a58cd1f | ||
|
|
3f89bd23af | ||
|
|
e2fa620a81 | ||
|
|
05b3645321 | ||
|
|
0e71e145bd | ||
|
|
f13baad163 | ||
|
|
2d60fa1edc | ||
|
|
2653873ff6 | ||
|
|
d849cf1115 | ||
|
|
28fcdca977 | ||
|
|
3f620ae742 | ||
|
|
0af8dde821 | ||
|
|
522931c64d | ||
|
|
265373bdcb | ||
|
|
0dbd649bff | ||
|
|
8fa4012267 | ||
|
|
477a57571b | ||
|
|
1de853ab95 | ||
|
|
4567d0de78 | ||
|
|
b2cc82d7e1 | ||
|
|
d3710cd8c0 | ||
|
|
2a4a9cbaa7 | ||
|
|
e27d02e782 | ||
|
|
ea1b7502bb | ||
|
|
69c173bc6c | ||
|
|
944fa45e76 | ||
|
|
eb2413085c | ||
|
|
04ecebbfef | ||
|
|
585ae2a58f | ||
|
|
9aae12f9ae | ||
|
|
73c6cabaa7 | ||
|
|
247075e168 | ||
|
|
6791733761 | ||
|
|
f6003088d8 | ||
|
|
95f93351ea | ||
|
|
b5bd7d043b | ||
|
|
8095665835 | ||
|
|
dd3f9d5ff8 | ||
|
|
7c39df74bc | ||
|
|
0a1497e3e8 | ||
|
|
25b81357c7 | ||
|
|
f7f380ff04 | ||
|
|
a09d99fe53 | ||
|
|
bdd6538984 | ||
|
|
2787d3bc72 | ||
|
|
72e53d096f | ||
|
|
acd48513f7 | ||
|
|
6ffa5654ea | ||
|
|
b2dfdb3446 | ||
|
|
dc5934a0ad | ||
|
|
ec586874a6 | ||
|
|
eb99d643b1 | ||
|
|
f6b37f346f | ||
|
|
180b31f6fa | ||
|
|
b16de8591e | ||
|
|
f87f418c1b | ||
|
|
f79fd38478 | ||
|
|
2e13f73b34 | ||
|
|
300f442b22 | ||
|
|
0f1c31e55a | ||
|
|
86633b31d3 | ||
|
|
f60aa78dde | ||
|
|
ae77cb1d77 | ||
|
|
74d99d8cda | ||
|
|
a90e0874bd | ||
|
|
141d20b472 | ||
|
|
6f08ecc1a7 | ||
|
|
3e4d6edac8 | ||
|
|
19784fc09c | ||
|
|
554f8cc37c | ||
|
|
c6153f6af3 | ||
|
|
048f5318fc | ||
|
|
62985c9776 | ||
|
|
9b30c02c22 | ||
|
|
122f18e8bf | ||
|
|
9d316da4e0 | ||
|
|
46439ff394 | ||
|
|
f73a60ad9f | ||
|
|
c05a153719 | ||
|
|
094f39e987 | ||
|
|
c247def1bc | ||
|
|
c7cd372554 | ||
|
|
ea951a8738 | ||
|
|
d9973bf353 | ||
|
|
0baaf82909 | ||
|
|
e62cb881c9 | ||
|
|
a965f6037f | ||
|
|
d6251f995c | ||
|
|
483c971e3e | ||
|
|
3186dcc65f | ||
|
|
e7aeebee8d | ||
|
|
14c3287131 | ||
|
|
4754b2db2f | ||
|
|
8fa0fae265 | ||
|
|
dc4c4bd084 | ||
|
|
6a5239cedc | ||
|
|
9ea9429757 | ||
|
|
20f89cf75a | ||
|
|
e8acf8aaaf | ||
|
|
0fac47e227 | ||
|
|
fe3cc09623 | ||
|
|
91445f2f9c | ||
|
|
053d516bc9 | ||
|
|
63a9f67bd9 | ||
|
|
344f0227e9 | ||
|
|
16384b9f72 | ||
|
|
db9d8e1006 | ||
|
|
c7dd503d80 | ||
|
|
c96265e2a9 | ||
|
|
ff35f7b1ff | ||
|
|
ac1748067b | ||
|
|
a4de09ea36 | ||
|
|
0816831fe1 | ||
|
|
0e83325e92 | ||
|
|
261e52e64d | ||
|
|
f1a990e80a | ||
|
|
a3a8110ae6 | ||
|
|
82a213555b | ||
|
|
3590ff2e33 | ||
|
|
775cfec744 | ||
|
|
9ca1d6608c | ||
|
|
59140b0814 | ||
|
|
90cf300334 | ||
|
|
7bd3c7cb0d | ||
|
|
ce75cc90f5 | ||
|
|
00a911434b | ||
|
|
69840086c9 | ||
|
|
b72f6fa2cc | ||
|
|
9f9d0cb2dc | ||
|
|
6a036595d6 | ||
|
|
f4c57046dd | ||
|
|
7b507f1bab | ||
|
|
c0b8c5e7d2 | ||
|
|
6e49afddf0 | ||
|
|
4908f281a3 | ||
|
|
796b51d620 | ||
|
|
9cc44cf917 | ||
|
|
9f7eecac73 | ||
|
|
cba59fe847 | ||
|
|
07df97ab9e | ||
|
|
0a1322843f | ||
|
|
6c6a3621e8 | ||
|
|
4a075819d1 | ||
|
|
3aa3914f3a | ||
|
|
eef9c3e35c | ||
|
|
fe61fadc09 | ||
|
|
4c931514a2 | ||
|
|
8ad886d871 | ||
|
|
93b8745599 | ||
|
|
fa25dc715f | ||
|
|
c010cf43bf | ||
|
|
51bdd15c9e | ||
|
|
b48f10b45f | ||
|
|
027e928bd3 | ||
|
|
3cfcfb02de | ||
|
|
322df7ff68 | ||
|
|
d58b9cac40 | ||
|
|
cca6567bbd | ||
|
|
26eb194ccb | ||
|
|
9b42ae41e7 | ||
|
|
83916cacd9 | ||
|
|
85b484c04e | ||
|
|
0d302e99af | ||
|
|
ae4a6fa3d2 | ||
|
|
8f64fdd025 | ||
|
|
5ee83505af | ||
|
|
4527358a53 | ||
|
|
51cca50828 | ||
|
|
8f1752575a | ||
|
|
29c39fb4fd | ||
|
|
63663ccf6c | ||
|
|
1ba81c3350 | ||
|
|
f7879f425f | ||
|
|
93ed5dce6b | ||
|
|
a08adcf6d5 | ||
|
|
a7bad6aa58 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -4,13 +4,17 @@
|
||||
/data/preferences/*
|
||||
/data/.backup/*
|
||||
/data/config.php
|
||||
/custom
|
||||
/build
|
||||
/node_modules
|
||||
/client
|
||||
/test.php
|
||||
/main.html
|
||||
/frontend/client/css/bootstrap.css
|
||||
/client/css/espo.css
|
||||
/client/css/espo-vertical.css
|
||||
/client/css/sakura.css
|
||||
/client/css/sakura-vertical.css
|
||||
/client/css/violet.css
|
||||
/client/css/violet-vertical.css
|
||||
/tests/testData/cache/*
|
||||
composer.phar
|
||||
vendor/
|
||||
/custom/Espo/Custom/*
|
||||
@@ -15,6 +15,7 @@ DirectoryIndex index.php index.html
|
||||
RewriteRule ^/?data/logs/ - [F]
|
||||
RewriteRule ^/?data/cache/ - [F]
|
||||
RewriteRule ^/?data/upload/ - [F]
|
||||
RewriteRule ^/?data/\.backup/ - [F]
|
||||
RewriteRule ^/?application/ - [F]
|
||||
RewriteRule ^/?custom/ - [F]
|
||||
RewriteRule ^/?vendor/ - [F]
|
||||
|
||||
3
CONTRIBUTING.md
Normal file
3
CONTRIBUTING.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Before we can merge your pull request you need to accept our CLA [here](https://github.com/espocrm/cla). It's very simple to do.
|
||||
|
||||
[Code Style Guidelines](https://github.com/espocrm/espocrm/wiki/Code-Style-Guidelines).
|
||||
185
Gruntfile.js
185
Gruntfile.js
@@ -1,58 +1,53 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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/.
|
||||
************************************************************************/
|
||||
module.exports = function (grunt) {
|
||||
|
||||
var jsFilesToMinify = [
|
||||
'client/lib/jquery-2.0.2.min.js',
|
||||
'client/lib/underscore-min.js',
|
||||
'client/lib/backbone-min.js',
|
||||
'client/lib/handlebars.js',
|
||||
'client/lib/base64.js',
|
||||
'client/lib/jquery-ui.min.js',
|
||||
'client/lib/moment.min.js',
|
||||
'client/lib/moment-timezone-with-data.min.js',
|
||||
'client/lib/jquery.timepicker.min.js',
|
||||
'client/lib/jquery.autocomplete.js',
|
||||
'client/lib/bootstrap.min.js',
|
||||
'client/lib/bootstrap-datepicker.js',
|
||||
'client/lib/bull.min.js',
|
||||
'client/src/namespace.js',
|
||||
'client/src/exceptions.js',
|
||||
'client/src/app.js',
|
||||
'client/src/utils.js',
|
||||
'client/src/storage.js',
|
||||
'client/src/loader.js',
|
||||
'client/src/pre-loader.js',
|
||||
'client/src/ui.js',
|
||||
'client/src/acl.js',
|
||||
'client/src/model.js',
|
||||
'client/src/model-offline.js',
|
||||
'client/src/metadata.js',
|
||||
'client/src/language.js',
|
||||
'client/src/cache.js',
|
||||
'client/src/controller.js',
|
||||
'client/src/router.js',
|
||||
'client/src/date-time.js',
|
||||
'client/src/field-manager.js',
|
||||
'client/src/search-manager.js',
|
||||
'client/src/collection.js',
|
||||
'client/src/multi-collection.js',
|
||||
'client/src/view-helper.js',
|
||||
'client/src/layout-manager.js',
|
||||
'client/src/model-factory.js',
|
||||
'client/src/collection-factory.js',
|
||||
'client/src/models/settings.js',
|
||||
'client/src/models/user.js',
|
||||
'client/src/models/preferences.js',
|
||||
'client/src/controllers/base.js',
|
||||
'client/src/view.js',
|
||||
'client/lib/jquery-2.1.4.min.js',
|
||||
'client/lib/underscore-min.js',
|
||||
'client/lib/es6-promise.min.js',
|
||||
'client/lib/backbone-min.js',
|
||||
'client/lib/handlebars.js',
|
||||
'client/lib/base64.js',
|
||||
'client/lib/jquery-ui.min.js',
|
||||
'client/lib/moment.min.js',
|
||||
'client/lib/moment-timezone-with-data.min.js',
|
||||
'client/lib/jquery.timepicker.min.js',
|
||||
'client/lib/jquery.autocomplete.js',
|
||||
'client/lib/bootstrap.min.js',
|
||||
'client/lib/bootstrap-datepicker.js',
|
||||
'client/lib/bull.js',
|
||||
'client/src/namespace.js',
|
||||
'client/src/exceptions.js',
|
||||
'client/src/loader.js',
|
||||
'client/src/utils.js'
|
||||
];
|
||||
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
|
||||
|
||||
mkdir: {
|
||||
tmp: {
|
||||
options: {
|
||||
mode: 0775,
|
||||
mode: 0755,
|
||||
create: [
|
||||
'build/tmp',
|
||||
]
|
||||
@@ -65,22 +60,60 @@ module.exports = function (grunt) {
|
||||
final: ['build/tmp'],
|
||||
},
|
||||
less: {
|
||||
bootstrap: {
|
||||
espo: {
|
||||
options: {
|
||||
yuicompress: true,
|
||||
},
|
||||
files: {
|
||||
'frontend/client/css/bootstrap.css': 'frontend/less/espo/main.less',
|
||||
},
|
||||
'client/css/espo.css': 'frontend/less/espo/main.less',
|
||||
}
|
||||
},
|
||||
espoVertical: {
|
||||
options: {
|
||||
yuicompress: true,
|
||||
},
|
||||
files: {
|
||||
'client/css/espo-vertical.css': 'frontend/less/espo-vertical/main.less',
|
||||
}
|
||||
},
|
||||
sakura: {
|
||||
options: {
|
||||
yuicompress: true,
|
||||
},
|
||||
files: {
|
||||
'client/css/sakura.css': 'frontend/less/sakura/main.less',
|
||||
}
|
||||
},
|
||||
sakuraVertical: {
|
||||
options: {
|
||||
yuicompress: true,
|
||||
},
|
||||
files: {
|
||||
'client/css/sakura-vertical.css': 'frontend/less/sakura-vertical/main.less',
|
||||
}
|
||||
},
|
||||
violet: {
|
||||
options: {
|
||||
yuicompress: true,
|
||||
},
|
||||
files: {
|
||||
'client/css/violet.css': 'frontend/less/violet/main.less',
|
||||
}
|
||||
},
|
||||
violetVertical: {
|
||||
options: {
|
||||
yuicompress: true,
|
||||
},
|
||||
files: {
|
||||
'client/css/violet-vertical.css': 'frontend/less/violet-vertical/main.less',
|
||||
}
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
minify: {
|
||||
files: {
|
||||
'build/tmp/client/css/espo.min.css': [
|
||||
'frontend/client/css/bootstrap.css',
|
||||
'frontend/client/css/datepicker.css',
|
||||
'frontend/client/css/jquery.timepicker.css',
|
||||
'build/tmp/client/css/espo.css': [
|
||||
'client/css/espo.css',
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -91,13 +124,13 @@ module.exports = function (grunt) {
|
||||
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
|
||||
},
|
||||
'build/tmp/client/espo.min.js': jsFilesToMinify.map(function (item) {
|
||||
return 'frontend/' + item;
|
||||
return '' + item;
|
||||
})
|
||||
},
|
||||
copy: {
|
||||
frontendFolders: {
|
||||
expand: true,
|
||||
cwd: 'frontend/client',
|
||||
cwd: 'client',
|
||||
src: [
|
||||
'src/**',
|
||||
'res/**',
|
||||
@@ -106,20 +139,22 @@ module.exports = function (grunt) {
|
||||
'modules/**',
|
||||
'img/**',
|
||||
'css/**',
|
||||
'sounds/**',
|
||||
'custom/**'
|
||||
],
|
||||
dest: 'build/tmp/client',
|
||||
},
|
||||
frontendHtml: {
|
||||
src: 'frontend/html/reset.html',
|
||||
src: 'frontend/reset.html',
|
||||
dest: 'build/tmp/reset.html'
|
||||
},
|
||||
frontendLib: {
|
||||
expand: true,
|
||||
dot: true,
|
||||
cwd: 'frontend/client/lib',
|
||||
cwd: 'client/lib',
|
||||
src: '**',
|
||||
dest: 'build/tmp/client/lib/',
|
||||
},
|
||||
},
|
||||
backend: {
|
||||
expand: true,
|
||||
dot: true,
|
||||
@@ -129,10 +164,15 @@ module.exports = function (grunt) {
|
||||
'custom/**',
|
||||
'data/.data',
|
||||
'install/**',
|
||||
'portal/**',
|
||||
'vendor/**',
|
||||
'html/**',
|
||||
'bootstrap.php',
|
||||
'cron.php',
|
||||
'rebuild.php',
|
||||
'clear_cache.php',
|
||||
'upgrade.php',
|
||||
'extension.php',
|
||||
'index.php',
|
||||
'LICENSE.txt',
|
||||
'.htaccess',
|
||||
@@ -152,7 +192,7 @@ module.exports = function (grunt) {
|
||||
options: {
|
||||
mode: '755'
|
||||
},
|
||||
php: {
|
||||
php: {
|
||||
options: {
|
||||
mode: '644'
|
||||
},
|
||||
@@ -160,13 +200,26 @@ module.exports = function (grunt) {
|
||||
'build/EspoCRM-<%= pkg.version %>/**/*.php',
|
||||
'build/EspoCRM-<%= pkg.version %>/**/*.json',
|
||||
'build/EspoCRM-<%= pkg.version %>/**/*.config',
|
||||
'build/EspoCRM-<%= pkg.version %>/**/.htaccess',
|
||||
'build/EspoCRM-<%= pkg.version %>/**/.htaccess',
|
||||
'build/EspoCRM-<%= pkg.version %>/client/**/*.js',
|
||||
'build/EspoCRM-<%= pkg.version %>/client/**/*.css',
|
||||
'build/EspoCRM-<%= pkg.version %>/client/**/*.tpl',
|
||||
'build/EspoCRM-<%= pkg.version %>/**/*.html',
|
||||
'build/EspoCRM-<%= pkg.version %>/**/*.txt',
|
||||
]
|
||||
},
|
||||
folders: {
|
||||
options: {
|
||||
mode: '755'
|
||||
},
|
||||
src: [
|
||||
'build/EspoCRM-<%= pkg.version %>/install',
|
||||
'build/EspoCRM-<%= pkg.version %>/portal',
|
||||
'build/EspoCRM-<%= pkg.version %>/api',
|
||||
'build/EspoCRM-<%= pkg.version %>/api/v1',
|
||||
'build/EspoCRM-<%= pkg.version %>/api/v1/portal-access',
|
||||
'build/EspoCRM-<%= pkg.version %>',
|
||||
]
|
||||
}
|
||||
},
|
||||
replace: {
|
||||
@@ -181,8 +234,12 @@ module.exports = function (grunt) {
|
||||
},
|
||||
files: [
|
||||
{
|
||||
src: 'frontend/html/main.html',
|
||||
dest: 'build/tmp/main.html'
|
||||
src: 'build/tmp/html/main.html',
|
||||
dest: 'build/tmp/html/main.html'
|
||||
},
|
||||
{
|
||||
src: 'build/tmp/html/portal.html',
|
||||
dest: 'build/tmp/html/portal.html'
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -230,7 +287,7 @@ module.exports = function (grunt) {
|
||||
'clean:start',
|
||||
'mkdir:tmp',
|
||||
'less',
|
||||
'cssmin',
|
||||
'cssmin',
|
||||
'uglify',
|
||||
'copy:frontendFolders',
|
||||
'copy:frontendHtml',
|
||||
@@ -240,6 +297,6 @@ module.exports = function (grunt) {
|
||||
'copy:final',
|
||||
'chmod',
|
||||
'clean:final',
|
||||
]);
|
||||
]);
|
||||
|
||||
};
|
||||
|
||||
14
LICENSE.txt
14
LICENSE.txt
@@ -631,29 +631,29 @@ to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
EspoCRM - Open Source CRM
|
||||
Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
EspoCRM is free software: you can redistribute it and/or modify
|
||||
This program 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,
|
||||
This program 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/>.
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
EspoCRM Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
EspoCRM comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
|
||||
34
README.md
34
README.md
@@ -2,10 +2,17 @@
|
||||
|
||||
<a href='http://www.espocrm.com'>EspoCRM is an Open Source CRM</a> (Customer Relationship Management) software that allows you to see, enter and evaluate all your company relationships regardless of the type. People, companies or opportunities - all in an easy and intuitive interface.
|
||||
|
||||
It's a web application with a frontend designed as a single page application based on backbone.js and a RESTful backend written in PHP.
|
||||
It's a web application with a frontend designed as a single page application based on backbone.js and a REST API backend written in PHP.
|
||||
|
||||
Download the latest release from our [website](http://www.espocrm.com).
|
||||
|
||||
### Requirements
|
||||
|
||||
* PHP 5.4 or above (with pdo, json, gd, mcrypt extensions);
|
||||
* MySQL 5.1 or above.
|
||||
|
||||
For more information about server configuration see [this article](http://blog.espocrm.com/administration/server-configuration-for-espocrm/).
|
||||
|
||||
### How to report bug
|
||||
|
||||
Create an issue [here](https://github.com/espocrm/espocrm/issues) or post on our [forum](http://forum.espocrm.com/bug-reports?routestring=forum/bug-reports).
|
||||
@@ -19,13 +26,13 @@ Create an issue [here](https://github.com/espocrm/espocrm/issues) or post on our
|
||||
|
||||
Never update composer dependencies if you are going to contribute code back.
|
||||
|
||||
Now you can build.
|
||||
Now you can build. Build will create compiled css files.
|
||||
|
||||
If your repository is accessible via a web server then you can run EspoCRM by url `http://PROJECT_URL/frontend`. To compose a proper config.php and populate database you can run install by opening `http(s)://{YOUR_CRM_URL}/install` location in a browser. Also you need to run build before to have compiled css.
|
||||
To compose a proper config.php and populate database you can run install by opening `http(s)://{YOUR_CRM_URL}/install` location in a browser. Then open `data/config.php` file and add `isDeveloperMode => true`.
|
||||
|
||||
### How to build
|
||||
|
||||
You need to have nodejs installed.
|
||||
You need to have nodejs and Grunt CLI installed.
|
||||
|
||||
1. Change to the project's root directory.
|
||||
2. Install project dependencies with `npm install`.
|
||||
@@ -33,6 +40,25 @@ You need to have nodejs installed.
|
||||
|
||||
The build will be created in the `build` directory.
|
||||
|
||||
### How to contribute
|
||||
|
||||
Before we can merge your pull request you need to accept our CLA [here](https://github.com/espocrm/cla). It's very simple to do.
|
||||
|
||||
### How to make a translation
|
||||
|
||||
Build po file with command:
|
||||
`node po.js en_EN`
|
||||
(specify needed language instead of en_EN)
|
||||
|
||||
After that translate the generated po file.
|
||||
|
||||
Build json files from the translated po file:
|
||||
|
||||
1. Put your po file espocrm-en_EN.po into `build` directory
|
||||
2. Run `node lang.js en_EN`
|
||||
|
||||
Json files will be created in build directory grouped by folders.
|
||||
|
||||
### License
|
||||
|
||||
EspoCRM is published under the GNU GPLv3 [license](https://raw.githubusercontent.com/espocrm/espocrm/master/LICENSE.txt).
|
||||
|
||||
@@ -1,4 +1,31 @@
|
||||
<?php
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
************************************************************************/
|
||||
|
||||
require_once('../../bootstrap.php');
|
||||
|
||||
|
||||
12
api/v1/portal-access/.htaccess
Executable file
12
api/v1/portal-access/.htaccess
Executable file
@@ -0,0 +1,12 @@
|
||||
RewriteEngine On
|
||||
|
||||
# Some hosts may require you to use the `RewriteBase` directive.
|
||||
# If you need to use the `RewriteBase` directive, it should be the
|
||||
# absolute physical path to the directory that contains this htaccess file.
|
||||
#
|
||||
# RewriteBase /
|
||||
|
||||
RewriteRule .* - [E=HTTP_ESPO_CGI_AUTH:%{HTTP:Authorization}]
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [QSA,L]
|
||||
39
api/v1/portal-access/index.php
Normal file
39
api/v1/portal-access/index.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
************************************************************************/
|
||||
|
||||
require_once('../../../bootstrap.php');
|
||||
|
||||
if (!empty($_GET['portalId'])) {
|
||||
$portalId = $_GET['portalId'];
|
||||
} else {
|
||||
$portalId = explode('/', $_SERVER['REQUEST_URI'])[count(explode('/', $_SERVER['SCRIPT_NAME'])) - 1];
|
||||
}
|
||||
|
||||
$app = new \Espo\Core\Portal\Application($portalId);
|
||||
$app->run();
|
||||
15
api/v1/portal-access/web.config
Executable file
15
api/v1/portal-access/web.config
Executable file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<system.webServer>
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="rule 1G" stopProcessing="true">
|
||||
<match url="^" />
|
||||
<action type="Rewrite" url="index.php" appendQueryString="true" />
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
</system.webServer>
|
||||
|
||||
</configuration>
|
||||
93
application/Espo/Acl/Attachment.php
Normal file
93
application/Espo/Acl/Attachment.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Acl;
|
||||
|
||||
use \Espo\Entities\User as EntityUser;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class Attachment extends \Espo\Core\Acl\Base
|
||||
{
|
||||
public function checkEntityRead(EntityUser $user, Entity $entity, $data)
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($entity->get('parentType') === 'Settings') {
|
||||
return true;
|
||||
}
|
||||
|
||||
$parent = null;
|
||||
$hasParent = false;
|
||||
if ($entity->get('parentId') && $entity->get('parentType')) {
|
||||
$hasParent = true;
|
||||
$parent = $this->getEntityManager()->getEntity($entity->get('parentType'), $entity->get('parentId'));
|
||||
} else if ($entity->get('relatedId') && $entity->get('relatedType')) {
|
||||
$hasParent = true;
|
||||
$parent = $this->getEntityManager()->getEntity($entity->get('relatedType'), $entity->get('relatedId'));
|
||||
}
|
||||
|
||||
if ($hasParent) {
|
||||
if ($parent) {
|
||||
if ($parent->getEntityType() === 'Note') {
|
||||
if ($parent->get('parentId') && $parent->get('parentType')) {
|
||||
$parentOfParent = $this->getEntityManager()->getEntity($parent->get('parentType'), $parent->get('parentId'));
|
||||
if ($parentOfParent && $this->getAclManager()->checkEntity($user, $parentOfParent)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if ($this->getAclManager()->checkEntity($user, $parent)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->checkEntity($user, $entity, $data, 'read')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkIsOwner(EntityUser $user, Entity $entity)
|
||||
{
|
||||
if ($user->id === $entity->get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
121
application/Espo/Acl/Email.php
Normal file
121
application/Espo/Acl/Email.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Acl;
|
||||
|
||||
use \Espo\Entities\User as EntityUser;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class Email extends \Espo\Core\Acl\Base
|
||||
{
|
||||
|
||||
public function checkEntityRead(EntityUser $user, Entity $entity, $data)
|
||||
{
|
||||
if ($this->checkEntity($user, $entity, $data, 'read')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($data === false) {
|
||||
return false;
|
||||
}
|
||||
if (is_object($data)) {
|
||||
if ($data->read === false || $data->read === 'no') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$entity->has('usersIds')) {
|
||||
$entity->loadLinkMultipleField('users');
|
||||
}
|
||||
$userIdList = $entity->get('usersIds');
|
||||
if (is_array($userIdList) && in_array($user->id, $userIdList)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkIsOwner(EntityUser $user, Entity $entity)
|
||||
{
|
||||
if ($user->id === $entity->get('assignedUserId')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->id === $entity->get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($entity->hasLinkMultipleId('assignedUsers', $user->id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkEntityDelete(EntityUser $user, Entity $entity, $data)
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($data === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($data->delete === 'own') {
|
||||
if ($user->id === $entity->get('assignedUserId')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->id === $entity->get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$assignedUserIdList = $entity->getLinkMultipleIdList('assignedUsers');
|
||||
if (count($assignedUserIdList) === 1 && $entity->hasLinkMultipleId('assignedUsers', $user->id)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->checkEntity($user, $entity, $data, 'delete')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($data->edit !== 'no' || $data->create !== 'no') {
|
||||
if ($entity->get('createdById') === $user->id) {
|
||||
if ($entity->get('status') !== 'Sent' && $entity->get('status') !== 'Archived') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
56
application/Espo/Acl/EmailFilter.php
Normal file
56
application/Espo/Acl/EmailFilter.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Acl;
|
||||
|
||||
use \Espo\Entities\User as EntityUser;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class EmailFilter extends \Espo\Core\Acl\Base
|
||||
{
|
||||
public function checkIsOwner(EntityUser $user, Entity $entity)
|
||||
{
|
||||
if ($entity->has('parentId') && $entity->has('parentType')) {
|
||||
$parentType = $entity->get('parentType');
|
||||
$parentId = $entity->get('parentId');
|
||||
if (!$parentType || !$parentId) return;
|
||||
|
||||
$parent = $this->getEntityManager()->getEntity($parentType, $parentId);
|
||||
|
||||
if ($parent->getEntityType() === 'User') {
|
||||
return $parent->id === $user->id;
|
||||
}
|
||||
if ($parent && $parent->has('assignedUserId') && $parent->get('assignedUserId') === $user->id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
45
application/Espo/Acl/Notification.php
Normal file
45
application/Espo/Acl/Notification.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Acl;
|
||||
|
||||
use \Espo\Entities\User as EntityUser;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class Notification extends \Espo\Core\Acl\Base
|
||||
{
|
||||
public function checkIsOwner(EntityUser $user, Entity $entity)
|
||||
{
|
||||
if ($user->id === $entity->get('userId')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
41
application/Espo/Acl/User.php
Normal file
41
application/Espo/Acl/User.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Acl;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class User extends \Espo\Core\Acl\Base
|
||||
{
|
||||
public function checkIsOwner(\Espo\Entities\User $user, Entity $entity)
|
||||
{
|
||||
return $user->id === $entity->id;
|
||||
}
|
||||
}
|
||||
|
||||
93
application/Espo/AclPortal/Attachment.php
Normal file
93
application/Espo/AclPortal/Attachment.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\AclPortal;
|
||||
|
||||
use \Espo\Entities\User as EntityUser;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class Attachment extends \Espo\Core\AclPortal\Base
|
||||
{
|
||||
public function checkEntityRead(EntityUser $user, Entity $entity, $data)
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($entity->get('parentType') === 'Settings') {
|
||||
return true;
|
||||
}
|
||||
|
||||
$parent = null;
|
||||
$hasParent = false;
|
||||
if ($entity->get('parentId') && $entity->get('parentType')) {
|
||||
$hasParent = true;
|
||||
$parent = $this->getEntityManager()->getEntity($entity->get('parentType'), $entity->get('parentId'));
|
||||
} else if ($entity->get('relatedId') && $entity->get('relatedType')) {
|
||||
$hasParent = true;
|
||||
$parent = $this->getEntityManager()->getEntity($entity->get('relatedType'), $entity->get('relatedId'));
|
||||
}
|
||||
|
||||
if ($hasParent) {
|
||||
if ($parent) {
|
||||
if ($parent->getEntityType() === 'Note') {
|
||||
if ($parent->get('parentId') && $parent->get('parentType')) {
|
||||
$parentOfParent = $this->getEntityManager()->getEntity($parent->get('parentType'), $parent->get('parentId'));
|
||||
if ($parentOfParent && $this->getAclManager()->checkEntity($user, $parentOfParent)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if ($this->getAclManager()->checkEntity($user, $parent)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->checkEntity($user, $entity, $data, 'read')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkIsOwner(EntityUser $user, Entity $entity)
|
||||
{
|
||||
if ($user->id === $entity->get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
71
application/Espo/AclPortal/Email.php
Normal file
71
application/Espo/AclPortal/Email.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\AclPortal;
|
||||
|
||||
use \Espo\Entities\User as EntityUser;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class Email extends \Espo\Core\AclPortal\Base
|
||||
{
|
||||
|
||||
public function checkEntityRead(EntityUser $user, Entity $entity, $data)
|
||||
{
|
||||
if ($this->checkEntity($user, $entity, $data, 'read')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($data === false) {
|
||||
return false;
|
||||
}
|
||||
if (is_object($data)) {
|
||||
if ($data->read === false || $data->read === 'no') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$entity->has('usersIds')) {
|
||||
$entity->loadLinkMultipleField('users');
|
||||
}
|
||||
$userIdList = $entity->get('usersIds');
|
||||
if (is_array($userIdList) && in_array($user->id, $userIdList)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkIsOwner(EntityUser $user, Entity $entity)
|
||||
{
|
||||
if ($user->id === $entity->get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
45
application/Espo/AclPortal/Notification.php
Normal file
45
application/Espo/AclPortal/Notification.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\AclPortal;
|
||||
|
||||
use \Espo\Entities\User as EntityUser;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class Notification extends \Espo\Core\AclPortal\Base
|
||||
{
|
||||
public function checkIsOwner(EntityUser $user, Entity $entity)
|
||||
{
|
||||
if ($user->id === $entity->get('userId')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
41
application/Espo/AclPortal/User.php
Normal file
41
application/Espo/AclPortal/User.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\AclPortal;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class User extends \Espo\Core\AclPortal\Base
|
||||
{
|
||||
public function checkIsOwner(\Espo\Entities\User $user, Entity $entity)
|
||||
{
|
||||
return $user->id === $entity->id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,12 +18,21 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Error,
|
||||
\Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class Admin extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
@@ -34,17 +43,19 @@ class Admin extends \Espo\Core\Controllers\Base
|
||||
}
|
||||
}
|
||||
|
||||
public function actionRebuild($params, $data)
|
||||
public function postActionRebuild($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$result = $this->getContainer()->get('dataManager')->rebuild();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function actionClearCache($params, $data)
|
||||
public function postActionClearCache($params, $data)
|
||||
{
|
||||
$result = $this->getContainer()->get('dataManager')->clearCache();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -55,8 +66,13 @@ class Admin extends \Espo\Core\Controllers\Base
|
||||
return $scheduledJob->getAllNamesOnly();
|
||||
}
|
||||
|
||||
public function actionUploadUpgradePackage($params, $data)
|
||||
public function postActionUploadUpgradePackage($params, $data)
|
||||
{
|
||||
if ($this->getConfig()->get('restrictedMode')) {
|
||||
if (!$this->getUser()->get('isSuperAdmin')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
$upgradeManager = new \Espo\Core\UpgradeManager($this->getContainer());
|
||||
|
||||
$upgradeId = $upgradeManager->upload($data);
|
||||
@@ -68,11 +84,16 @@ class Admin extends \Espo\Core\Controllers\Base
|
||||
);
|
||||
}
|
||||
|
||||
public function actionRunUpgrade($params, $data)
|
||||
public function postActionRunUpgrade($params, $data)
|
||||
{
|
||||
$upgradeManager = new \Espo\Core\UpgradeManager($this->getContainer());
|
||||
if ($this->getConfig()->get('restrictedMode')) {
|
||||
if (!$this->getUser()->get('isSuperAdmin')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
$upgradeManager->install($data['id']);
|
||||
$upgradeManager = new \Espo\Core\UpgradeManager($this->getContainer());
|
||||
$upgradeManager->install($data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,33 +18,65 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class App extends \Espo\Core\Controllers\Record
|
||||
class App extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
public function actionUser()
|
||||
{
|
||||
{
|
||||
$preferences = $this->getPreferences()->getValues();
|
||||
unset($preferences['smtpPassword']);
|
||||
|
||||
$user = $this->getUser();
|
||||
if (!$user->has('teamsIds')) {
|
||||
$user->loadLinkMultipleField('teams');
|
||||
}
|
||||
if ($user->get('isPortalUser')) {
|
||||
$user->loadAccountField();
|
||||
$user->loadLinkMultipleField('accounts');
|
||||
}
|
||||
|
||||
$userData = $user->getValues();
|
||||
|
||||
$emailAddressList = [];
|
||||
foreach ($user->get('emailAddresses') as $emailAddress) {
|
||||
if ($emailAddress->get('invalid')) continue;
|
||||
if ($user->get('emailAddrses') === $emailAddress->get('name')) continue;
|
||||
$emailAddressList[] = $emailAddress->get('name');
|
||||
}
|
||||
if ($user->get('emailAddrses')) {
|
||||
array_unshift($emailAddressList, $user->get('emailAddrses'));
|
||||
}
|
||||
$userData['emailAddressList'] = $emailAddressList;
|
||||
|
||||
return array(
|
||||
'user' => $this->getUser()->toArray(),
|
||||
'acl' => $this->getAcl()->toArray(),
|
||||
'preferences' => $this->getPreferences()->toArray(),
|
||||
'user' => $userData,
|
||||
'acl' => $this->getAcl()->getMap(),
|
||||
'preferences' => $preferences,
|
||||
'token' => $this->getUser()->get('token')
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
public function actionDestroyAuthToken($params, $data)
|
||||
{
|
||||
$token = $data['token'];
|
||||
|
||||
public function postActionDestroyAuthToken($params, $data)
|
||||
{
|
||||
$token = $data['token'];
|
||||
if (empty($token)) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$auth = new \Espo\Core\Utils\Auth($this->getContainer());
|
||||
return $auth->destroyAuthToken($token);
|
||||
return $auth->destroyAuthToken($token);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,25 +18,42 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class Attachment extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public function actionUpload($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (!$this->getAcl()->checkScope('Attachment', 'create')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionUpload($params, $data)
|
||||
{
|
||||
list($prefix, $contents) = explode(',', $data);
|
||||
$contents = base64_decode($contents);
|
||||
|
||||
|
||||
$attachment = $this->getEntityManager()->getEntity('Attachment');
|
||||
$this->getEntityManager()->saveEntity($attachment);
|
||||
$this->getEntityManager()->saveEntity($attachment);
|
||||
$this->getContainer()->get('fileManager')->putContents('data/upload/' . $attachment->id, $contents);
|
||||
|
||||
|
||||
return array(
|
||||
'attachmentId' => $attachment->id
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,49 +18,56 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
class AuthToken extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
{
|
||||
protected function checkControllerAccess()
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function actionUpdate($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function actionCreate($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
|
||||
public function actionListLinked($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
|
||||
public function actionMassUpdate($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
|
||||
public function actionCreateLink($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
|
||||
public function actionRemoveLink($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,49 +18,208 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
|
||||
class Email extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public function actionGetCopiedAttachments($params, $data, $request)
|
||||
{
|
||||
$id = $request->get('id');
|
||||
|
||||
public function postActionGetCopiedAttachments($params, $data, $request)
|
||||
{
|
||||
if (empty($data['id'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$id = $data['id'];
|
||||
|
||||
return $this->getRecordService()->getCopiedAttachments($id);
|
||||
}
|
||||
|
||||
|
||||
public function actionSendTestEmail($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (empty($data['password'])) {
|
||||
|
||||
if (!$this->getAcl()->checkScope('Email')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
if (is_null($data['password'])) {
|
||||
if ($data['type'] == 'preferences') {
|
||||
if (!$this->getUser()->isAdmin() && $data['id'] != $this->getUser()->id) {
|
||||
if (!$this->getUser()->isAdmin() && $data['id'] !== $this->getUser()->id) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
$preferences = $this->getEntityManager()->getEntity('Preferences', $data['id']);
|
||||
if (!$preferences) {
|
||||
throw new Error();
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
if (is_null($data['password'])) {
|
||||
$data['password'] = $this->getContainer()->get('crypt')->decrypt($preferences->get('smtpPassword'));
|
||||
}
|
||||
} else if ($data['type'] == 'emailAccount') {
|
||||
if (!$this->getAcl()->checkScope('EmailAccount')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
if (!empty($data['id'])) {
|
||||
$emailAccount = $this->getEntityManager()->getEntity('EmailAccount', $data['id']);
|
||||
if (!$emailAccount) {
|
||||
throw new NotFound();
|
||||
}
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
if ($emailAccount->get('assigniedUserId') !== $this->getUser()->id) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
if (is_null($data['password'])) {
|
||||
$data['password'] = $this->getContainer()->get('crypt')->decrypt($emailAccount->get('smtpPassword'));
|
||||
}
|
||||
}
|
||||
|
||||
$data['password'] = $this->getContainer()->get('crypt')->decrypt($preferences->get('smtpPassword'));
|
||||
} else {
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
$data['password'] = $this->getConfig()->get('smtpPassword');
|
||||
if (is_null($data['password'])) {
|
||||
$data['password'] = $this->getConfig()->get('smtpPassword');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->getRecordService()->sendTestEmail($data);
|
||||
}
|
||||
|
||||
public function postActionMarkAsRead($params, $data, $request)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->markAsReadByIdList($ids);
|
||||
}
|
||||
|
||||
public function postActionMarkAsNotRead($params, $data, $request)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->markAsNotReadByIdList($ids);
|
||||
}
|
||||
|
||||
public function postActionMarkAllAsRead($params, $data, $request)
|
||||
{
|
||||
return $this->getRecordService()->markAllAsRead();
|
||||
}
|
||||
|
||||
public function postActionMarkAsImportant($params, $data, $request)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->markAsImportantByIdList($ids);
|
||||
}
|
||||
|
||||
public function postActionMarkAsNotImportant($params, $data, $request)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->markAsNotImportantByIdList($ids);
|
||||
}
|
||||
|
||||
public function postActionMoveToTrash($params, $data)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->moveToTrashByIdList($ids);
|
||||
}
|
||||
|
||||
public function postActionRetrieveFromTrash($params, $data)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
return $this->getRecordService()->retrieveFromTrashByIdList($ids);
|
||||
}
|
||||
|
||||
public function getActionGetFoldersNotReadCounts(&$params, $request, $data)
|
||||
{
|
||||
return $this->getRecordService()->getFoldersNotReadCounts();
|
||||
}
|
||||
|
||||
protected function fetchListParamsFromRequest(&$params, $request, $data)
|
||||
{
|
||||
parent::fetchListParamsFromRequest($params, $request, $data);
|
||||
|
||||
$folderId = $request->get('folderId');
|
||||
if ($folderId) {
|
||||
$params['folderId'] = $request->get('folderId');
|
||||
}
|
||||
}
|
||||
|
||||
public function postActionMoveToFolder($params, $data)
|
||||
{
|
||||
if (!empty($data['ids'])) {
|
||||
$ids = $data['ids'];
|
||||
} else {
|
||||
if (!empty($data['id'])) {
|
||||
$ids = [$data['id']];
|
||||
} else {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($data['folderId'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
return $this->getRecordService()->moveToFolderByIdList($ids, $data['folderId']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,20 +18,28 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class EmailAccount extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
{
|
||||
public function actionGetFolders($params, $data, $request)
|
||||
{
|
||||
{
|
||||
return $this->getRecordService()->getFolders(array(
|
||||
'host' => $request->get('host'),
|
||||
'port' => $request->get('port'),
|
||||
'ssl' => $request->get('ssl'),
|
||||
'ssl' => $request->get('ssl') === 'true',
|
||||
'username' => $request->get('username'),
|
||||
'password' => $request->get('password'),
|
||||
'id' => $request->get('id')
|
||||
@@ -44,5 +52,27 @@ class EmailAccount extends \Espo\Core\Controllers\Record
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
public function actionTestConnection($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (is_null($data['password'])) {
|
||||
$emailAccount = $this->getEntityManager()->getEntity('EmailAccount', $data['id']);
|
||||
if (!$emailAccount) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
if ($emailAccount->get('assignedUserId') != $this->getUser()->id && !$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$data['password'] = $this->getContainer()->get('crypt')->decrypt($emailAccount->get('password'));
|
||||
}
|
||||
|
||||
return $this->getRecordService()->testConnection($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,14 +18,29 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
class EmailAddress extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public function actionSearchInAddressBook($params, $data, $request)
|
||||
{
|
||||
if (!$this->getAcl()->checkScope('Email')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
if (!$this->getAcl()->checkScope('Email', 'create')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
$q = $request->get('q');
|
||||
$limit = intval($request->get('limit'));
|
||||
if (empty($limit) || $limit > 30) {
|
||||
|
||||
36
application/Espo/Controllers/EmailFilter.php
Normal file
36
application/Espo/Controllers/EmailFilter.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Controllers;
|
||||
|
||||
class EmailFilter extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
63
application/Espo/Controllers/EmailFolder.php
Normal file
63
application/Espo/Controllers/EmailFolder.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class EmailFolder extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public function postActionMoveUp($params, $data, $request)
|
||||
{
|
||||
if (empty($data['id'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$this->getRecordService()->moveUp($data['id']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function postActionMoveDown($params, $data, $request)
|
||||
{
|
||||
if (empty($data['id'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$this->getRecordService()->moveDown($data['id']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getActionListAll()
|
||||
{
|
||||
return $this->getRecordService()->listAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
282
application/Espo/Controllers/EntityManager.php
Normal file
282
application/Espo/Controllers/EntityManager.php
Normal file
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
|
||||
class EntityManager extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
protected function checkControllerAccess()
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
public function actionCreateEntity($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (empty($data['name']) || empty($data['type'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$name = $data['name'];
|
||||
$type = $data['type'];
|
||||
|
||||
$name = filter_var($name, \FILTER_SANITIZE_STRING);
|
||||
$type = filter_var($type, \FILTER_SANITIZE_STRING);
|
||||
|
||||
$params = array();
|
||||
|
||||
if (!empty($data['labelSingular'])) {
|
||||
$params['labelSingular'] = $data['labelSingular'];
|
||||
}
|
||||
if (!empty($data['labelPlural'])) {
|
||||
$params['labelPlural'] = $data['labelPlural'];
|
||||
}
|
||||
if (!empty($data['stream'])) {
|
||||
$params['stream'] = $data['stream'];
|
||||
}
|
||||
if (!empty($data['disabled'])) {
|
||||
$params['disabled'] = $data['disabled'];
|
||||
}
|
||||
if (!empty($data['sortBy'])) {
|
||||
$params['sortBy'] = $data['sortBy'];
|
||||
}
|
||||
if (!empty($data['sortDirection'])) {
|
||||
$params['asc'] = $data['sortDirection'] === 'asc';
|
||||
}
|
||||
if (isset($data['textFilterFields']) && is_array($data['textFilterFields'])) {
|
||||
$params['textFilterFields'] = $data['textFilterFields'];
|
||||
}
|
||||
|
||||
$result = $this->getContainer()->get('entityManagerUtil')->create($name, $type, $params);
|
||||
|
||||
if ($result) {
|
||||
$tabList = $this->getConfig()->get('tabList', []);
|
||||
|
||||
if (!in_array($name, $tabList)) {
|
||||
$tabList[] = $name;
|
||||
$this->getConfig()->set('tabList', $tabList);
|
||||
$this->getConfig()->save();
|
||||
}
|
||||
|
||||
$this->getContainer()->get('dataManager')->rebuild();
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionUpdateEntity($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
if (empty($data['name'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$name = $data['name'];
|
||||
$name = filter_var($name, \FILTER_SANITIZE_STRING);
|
||||
|
||||
if (!empty($data['sortDirection'])) {
|
||||
$data['asc'] = $data['sortDirection'] === 'asc';
|
||||
}
|
||||
|
||||
$result = $this->getContainer()->get('entityManagerUtil')->update($name, $data);
|
||||
|
||||
if ($result) {
|
||||
$this->getContainer()->get('dataManager')->clearCache();
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionRemoveEntity($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (empty($data['name'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$name = $data['name'];
|
||||
$name = filter_var($name, \FILTER_SANITIZE_STRING);
|
||||
|
||||
$result = $this->getContainer()->get('entityManagerUtil')->delete($name);
|
||||
|
||||
if ($result) {
|
||||
$tabList = $this->getConfig()->get('tabList', []);
|
||||
if (($key = array_search($name, $tabList)) !== false) {
|
||||
unset($tabList[$key]);
|
||||
$tabList = array_values($tabList);
|
||||
}
|
||||
$this->getConfig()->set('tabList', $tabList);
|
||||
$this->getConfig()->save();
|
||||
|
||||
$this->getContainer()->get('dataManager')->clearCache();
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionCreateLink($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$paramList = [
|
||||
'entity',
|
||||
'entityForeign',
|
||||
'link',
|
||||
'linkForeign',
|
||||
'label',
|
||||
'labelForeign',
|
||||
'linkType'
|
||||
];
|
||||
|
||||
$additionalParamList = [
|
||||
'relationName',
|
||||
];
|
||||
|
||||
$params = array();
|
||||
|
||||
foreach ($paramList as $item) {
|
||||
if (empty($data[$item])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$params[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
}
|
||||
|
||||
foreach ($additionalParamList as $item) {
|
||||
$params[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
}
|
||||
|
||||
if (array_key_exists('linkMultipleField', $data)) {
|
||||
$params['linkMultipleField'] = $data['linkMultipleField'];
|
||||
}
|
||||
if (array_key_exists('linkMultipleFieldForeign', $data)) {
|
||||
$params['linkMultipleFieldForeign'] = $data['linkMultipleFieldForeign'];
|
||||
}
|
||||
|
||||
$result = $this->getContainer()->get('entityManagerUtil')->createLink($params);
|
||||
|
||||
if ($result) {
|
||||
$this->getContainer()->get('dataManager')->rebuild();
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionUpdateLink($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$paramList = [
|
||||
'entity',
|
||||
'entityForeign',
|
||||
'link',
|
||||
'linkForeign',
|
||||
'label',
|
||||
'labelForeign'
|
||||
];
|
||||
|
||||
$additionalParamList = [];
|
||||
|
||||
$params = array();
|
||||
foreach ($paramList as $item) {
|
||||
$params[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
}
|
||||
|
||||
foreach ($additionalParamList as $item) {
|
||||
$params[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
}
|
||||
|
||||
if (array_key_exists('linkMultipleField', $data)) {
|
||||
$params['linkMultipleField'] = $data['linkMultipleField'];
|
||||
}
|
||||
if (array_key_exists('linkMultipleFieldForeign', $data)) {
|
||||
$params['linkMultipleFieldForeign'] = $data['linkMultipleFieldForeign'];
|
||||
}
|
||||
|
||||
$result = $this->getContainer()->get('entityManagerUtil')->updateLink($params);
|
||||
|
||||
if ($result) {
|
||||
$this->getContainer()->get('dataManager')->clearCache();
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionRemoveLink($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$paramList = [
|
||||
'entity',
|
||||
'link',
|
||||
];
|
||||
$d = array();
|
||||
foreach ($paramList as $item) {
|
||||
$d[$item] = filter_var($data[$item], \FILTER_SANITIZE_STRING);
|
||||
}
|
||||
|
||||
$result = $this->getContainer()->get('entityManagerUtil')->deleteLink($d);
|
||||
|
||||
if ($result) {
|
||||
$this->getContainer()->get('dataManager')->clearCache();
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
@@ -58,10 +65,15 @@ class Extension extends \Espo\Core\Controllers\Record
|
||||
if (!$request->isPost()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
if ($this->getConfig()->get('restrictedMode')) {
|
||||
if (!$this->getUser()->get('isSuperAdmin')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
$manager = new \Espo\Core\ExtensionManager($this->getContainer());
|
||||
|
||||
$manager->install($data['id']);
|
||||
$manager->install($data);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -71,11 +83,14 @@ class Extension extends \Espo\Core\Controllers\Record
|
||||
if (!$request->isPost()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
if ($this->getConfig()->get('restrictedMode')) {
|
||||
if (!$this->getUser()->get('isSuperAdmin')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
$manager = new \Espo\Core\ExtensionManager($this->getContainer());
|
||||
|
||||
$manager->uninstall($data['id']);
|
||||
|
||||
$manager->uninstall($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -99,12 +114,18 @@ class Extension extends \Espo\Core\Controllers\Record
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionDelete($params)
|
||||
public function actionDelete($params, $data, $request)
|
||||
{
|
||||
if (!$request->isDelete()) {
|
||||
throw BadRequest();
|
||||
}
|
||||
if ($this->getConfig()->get('restrictedMode')) {
|
||||
if (!$this->getUser()->get('isSuperAdmin')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
$manager = new \Espo\Core\ExtensionManager($this->getContainer());
|
||||
|
||||
$manager->delete($params['id']);
|
||||
|
||||
$manager->delete($params);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,23 +18,38 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class ExternalAccount extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public static $defaultAction = 'list';
|
||||
|
||||
|
||||
protected function checkControllerAccess()
|
||||
{
|
||||
if (!$this->getAcl()->checkScope('ExternalAccount')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
public function actionList($params, $data, $request)
|
||||
{
|
||||
$integrations = $this->getEntityManager()->getRepository('Integration')->find();
|
||||
$integrations = $this->getEntityManager()->getRepository('Integration')->find();
|
||||
$arr = array();
|
||||
foreach ($integrations as $entity) {
|
||||
if ($entity->get('enabled') && $this->getMetadata()->get('integrations.' . $entity->id .'.allowUserAccounts')) {
|
||||
if ($entity->get('enabled') && $this->getMetadata()->get('integrations.' . $entity->id .'.allowUserAccounts')) {
|
||||
$arr[] = array(
|
||||
'id' => $entity->id
|
||||
);
|
||||
@@ -44,80 +59,83 @@ class ExternalAccount extends \Espo\Core\Controllers\Record
|
||||
'list' => $arr
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function actionGetOAuth2Info($params, $data, $request)
|
||||
{
|
||||
$id = $request->get('id');
|
||||
list($integration, $userId) = explode('__', $id);
|
||||
|
||||
|
||||
|
||||
if ($this->getUser()->id != $userId) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity('Integration', $integration);
|
||||
if ($entity) {
|
||||
return array(
|
||||
'clientId' => $entity->get('clientId'),
|
||||
'redirectUri' => $this->getConfig()->get('siteUrl') . '/oauthcallback',
|
||||
'redirectUri' => $this->getConfig()->get('siteUrl') . '?entryPoint=oauthCallback',
|
||||
'isConnected' => $this->getRecordService()->ping($integration, $userId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionRead($params, $data, $request)
|
||||
{
|
||||
list($integration, $userId) = explode('__', $params['id']);
|
||||
|
||||
if ($this->getUser()->id != $userId) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity('ExternalAccount', $params['id']);
|
||||
return $entity->toArray();
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data)
|
||||
{
|
||||
return $this->actionPatch($params, $data);
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data)
|
||||
{
|
||||
list($integration, $userId) = explode('__', $params['id']);
|
||||
|
||||
|
||||
if ($this->getUser()->id != $userId) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity('ExternalAccount', $params['id']);
|
||||
return $entity->toArray();
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data, $request)
|
||||
{
|
||||
return $this->actionPatch($params, $data, $request);
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPut() && !$request->isPost() && !$request->isPatch()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
list($integration, $userId) = explode('__', $params['id']);
|
||||
|
||||
if ($this->getUser()->id != $userId) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
if (isset($data['enabled']) && !$data['enabled']) {
|
||||
$data['data'] = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity('ExternalAccount', $params['id']);
|
||||
$entity->set($data);
|
||||
$this->getEntityManager()->saveEntity($entity);
|
||||
|
||||
return $entity->toArray();
|
||||
|
||||
return $entity->toArray();
|
||||
}
|
||||
|
||||
|
||||
public function actionAuthorizationCode($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new Error('Bad HTTP method type.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$id = $data['id'];
|
||||
$code = $data['code'];
|
||||
|
||||
list($integration, $userId) = explode('__', $id);
|
||||
|
||||
list($integration, $userId) = explode('__', $id);
|
||||
|
||||
if ($this->getUser()->id != $userId) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$service = $this->getRecordService();
|
||||
|
||||
$service = $this->getRecordService();
|
||||
return $service->authorizationCode($integration, $userId, $code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,7 +18,14 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
@@ -29,11 +36,11 @@ class GlobalSearch extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
public function actionSearch($params, $data, $request)
|
||||
{
|
||||
$query = $params['query'];
|
||||
|
||||
$offset = $request->get('offset');
|
||||
$maxSize = $request->get('maxSize');
|
||||
|
||||
$query = $request->get('q');
|
||||
|
||||
$offset = intval($request->get('offset'));
|
||||
$maxSize = intval($request->get('maxSize'));
|
||||
|
||||
return $this->getService('GlobalSearch')->find($query, $offset, $maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,13 +18,19 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
class I18n extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
|
||||
public function actionRead($params, $data)
|
||||
{
|
||||
return $this->getContainer()->get('language')->getAll();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,50 +18,115 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use Espo\Core\Utils as Utils;
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class Import extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
protected function checkControllerAccess()
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data, $request)
|
||||
{
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data, $request)
|
||||
{
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
public function actionMassUpdate($params, $data, $request)
|
||||
{
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
public function actionCreateLink($params, $data, $request)
|
||||
{
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
public function actionRemoveLink($params, $data, $request)
|
||||
{
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
class Import extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
|
||||
protected function getFileManager()
|
||||
{
|
||||
return $this->getContainer()->get('fileManager');
|
||||
}
|
||||
|
||||
|
||||
protected function getEntityManager()
|
||||
{
|
||||
return $this->getContainer()->get('entityManager');
|
||||
}
|
||||
|
||||
public function actionUploadFile($params, $data)
|
||||
{
|
||||
|
||||
public function actionUploadFile($params, $data, $request)
|
||||
{
|
||||
$contents = $data;
|
||||
|
||||
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$attachment = $this->getEntityManager()->getEntity('Attachment');
|
||||
$attachment->set('type', 'text/csv');
|
||||
$attachment->set('role', 'Import File');
|
||||
$attachment->set('role', 'Import File');
|
||||
$attachment->set('name', 'import-file.csv');
|
||||
$this->getEntityManager()->saveEntity($attachment);
|
||||
|
||||
|
||||
$this->getFileManager()->putContents('data/upload/' . $attachment->id, $contents);
|
||||
|
||||
|
||||
return array(
|
||||
'attachmentId' => $attachment->id
|
||||
);
|
||||
}
|
||||
|
||||
public function actionRevert($params, $data)
|
||||
{
|
||||
return $this->getService('Import')->revert($data['entityType'], $data['idsToRemove']);
|
||||
|
||||
public function actionRevert($params, $data, $request)
|
||||
{
|
||||
if (empty($data['id'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
return $this->getService('Import')->revert($data['id']);
|
||||
}
|
||||
|
||||
public function actionCreate($params, $data)
|
||||
{
|
||||
|
||||
public function actionRemoveDuplicates($params, $data, $request)
|
||||
{
|
||||
if (empty($data['id'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
return $this->getService('Import')->removeDuplicates($data['id']);
|
||||
}
|
||||
|
||||
public function actionCreate($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost() && !$request->isPut()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$importParams = array(
|
||||
'headerRow' => $data['headerRow'],
|
||||
'fieldDelimiter' => $data['fieldDelimiter'],
|
||||
@@ -74,14 +139,27 @@ class Import extends \Espo\Core\Controllers\Base
|
||||
'defaultValues' => $data['defaultValues'],
|
||||
'action' => $data['action'],
|
||||
);
|
||||
|
||||
|
||||
if (array_key_exists('updateBy', $data)) {
|
||||
$importParams['updateBy'] = $data['updateBy'];
|
||||
}
|
||||
|
||||
$attachmentId = $data['attachmentId'];
|
||||
|
||||
|
||||
if (!$this->getAcl()->check($data['entityType'], 'edit')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
|
||||
return $this->getService('Import')->import($data['entityType'], $data['fields'], $attachmentId, $importParams);
|
||||
}
|
||||
|
||||
public function postActionUnmarkAsDuplicate($params, $data)
|
||||
{
|
||||
if (empty($data['id']) || empty($data['entityType']) || empty($data['entityId'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$this->getService('Import')->unmarkAsDuplicate($data['id'], $data['entityType'], $data['entityId']);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
73
application/Espo/Controllers/InboundEmail.php
Normal file
73
application/Espo/Controllers/InboundEmail.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class InboundEmail extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
protected function checkControllerAccess()
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
public function actionGetFolders($params, $data, $request)
|
||||
{
|
||||
return $this->getRecordService()->getFolders(array(
|
||||
'host' => $request->get('host'),
|
||||
'port' => $request->get('port'),
|
||||
'ssl' => $request->get('ssl') === 'true',
|
||||
'username' => $request->get('username'),
|
||||
'password' => $request->get('password'),
|
||||
'id' => $request->get('id')
|
||||
));
|
||||
}
|
||||
|
||||
public function actionTestConnection($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (is_null($data['password'])) {
|
||||
$inboundEmail = $this->getEntityManager()->getEntity('InboundEmail', $data['id']);
|
||||
if (!$inboundEmail) {
|
||||
throw new Error();
|
||||
}
|
||||
$data['password'] = $this->getContainer()->get('crypt')->decrypt($inboundEmail->get('password'));
|
||||
}
|
||||
|
||||
return $this->getRecordService()->testConnection($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,21 +18,30 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class Integration extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
{
|
||||
protected function checkControllerAccess()
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function actionIndex($params, $data, $request)
|
||||
{
|
||||
return false;
|
||||
@@ -40,22 +49,25 @@ class Integration extends \Espo\Core\Controllers\Record
|
||||
|
||||
public function actionRead($params, $data, $request)
|
||||
{
|
||||
$entity = $this->getEntityManager()->getEntity('Integration', $params['id']);
|
||||
$entity = $this->getEntityManager()->getEntity('Integration', $params['id']);
|
||||
return $entity->toArray();
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data)
|
||||
|
||||
public function actionUpdate($params, $data, $request)
|
||||
{
|
||||
return $this->actionPatch($params, $data);
|
||||
return $this->actionPatch($params, $data, $request);
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data)
|
||||
|
||||
public function actionPatch($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPut() && !$request->isPatch()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$entity = $this->getEntityManager()->getEntity('Integration', $params['id']);
|
||||
$entity->set($data);
|
||||
$this->getEntityManager()->saveEntity($entity);
|
||||
|
||||
return $entity->toArray();
|
||||
|
||||
return $entity->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
79
application/Espo/Controllers/Job.php
Normal file
79
application/Espo/Controllers/Job.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
class Job extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
protected function checkControllerAccess()
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
public function actionCreate($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionListLinked($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionMassUpdate($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionCreateLink($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionRemoveLink($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
@@ -26,6 +33,7 @@ use Espo\Core\Utils as Utils;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class Layout extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
@@ -33,30 +41,48 @@ class Layout extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
$data = $this->getContainer()->get('layout')->get($params['scope'], $params['name']);
|
||||
if (empty($data)) {
|
||||
throw new NotFound("Layout " . $params['scope'] . ":" . $params['name'] . ' is not found');
|
||||
throw new NotFound("Layout " . $params['scope'] . ":" . $params['name'] . ' is not found.');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data)
|
||||
public function actionUpdate($params, $data, $request)
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$result = $this->getContainer()->get('layout')->set($data, $params['scope'], $params['name']);
|
||||
|
||||
if (!$request->isPut() && !$request->isPatch()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$layoutManager = $this->getContainer()->get('layout');
|
||||
$layoutManager->set($data, $params['scope'], $params['name']);
|
||||
$result = $layoutManager->save();
|
||||
|
||||
if ($result === false) {
|
||||
throw new Error("Error while saving layout");
|
||||
throw new Error("Error while saving layout.");
|
||||
}
|
||||
|
||||
$this->getContainer()->get('dataManager')->updateCacheTimestamp();
|
||||
|
||||
return $this->getContainer()->get('layout')->get($params['scope'], $params['name']);
|
||||
return $layoutManager->get($params['scope'], $params['name']);
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data)
|
||||
public function actionPatch($params, $data, $request)
|
||||
{
|
||||
return $this->actionUpdate($params, $data);
|
||||
return $this->actionUpdate($params, $data, $request);
|
||||
}
|
||||
|
||||
public function actionResetToDefault($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
if (empty($data['scope']) || empty($data['name'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
return $this->getContainer()->get('layout')->resetToDefault($data['scope'], $data['name']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,7 +18,14 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,49 +18,80 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
|
||||
class Notification extends \Espo\Core\Controllers\Base
|
||||
class Notification extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public static $defaultAction = 'list';
|
||||
|
||||
public function actionList($params, $data, $request)
|
||||
{
|
||||
$scope = $params['scope'];
|
||||
$id = $params['id'];
|
||||
|
||||
$userId = $this->getUser()->id;
|
||||
|
||||
|
||||
$offset = intval($request->get('offset'));
|
||||
$maxSize = intval($request->get('maxSize'));
|
||||
|
||||
$maxSize = intval($request->get('maxSize'));
|
||||
$after = $request->get('after');
|
||||
|
||||
$params = array(
|
||||
'offset' => $offset,
|
||||
'maxSize' => $maxSize,
|
||||
'after' => $after
|
||||
);
|
||||
|
||||
$result = $this->getService('Notification')->getList($userId, $params);
|
||||
|
||||
|
||||
$result = $this->getService('Notification')->getList($userId, $params);
|
||||
|
||||
return array(
|
||||
'total' => $result['total'],
|
||||
'list' => $result['collection']->toArray()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function actionNotReadCount()
|
||||
{
|
||||
$userId = $this->getUser()->id;
|
||||
return $this->getService('Notification')->getNotReadCount($userId);
|
||||
}
|
||||
|
||||
public function actionMarkAllRead($params, $data, $request)
|
||||
|
||||
public function postActionMarkAllRead($params, $data, $request)
|
||||
{
|
||||
$userId = $this->getUser()->id;
|
||||
return $this->getService('Notification')->markAllRead($userId);
|
||||
}
|
||||
|
||||
public function actionExport($params, $data, $request)
|
||||
{
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
public function actionMassUpdate($params, $data, $request)
|
||||
{
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
public function actionCreateLink($params, $data, $request)
|
||||
{
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
public function actionRemoveLink($params, $data, $request)
|
||||
{
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
public function actionMerge($params, $data, $request)
|
||||
{
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
43
application/Espo/Controllers/Portal.php
Normal file
43
application/Espo/Controllers/Portal.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
class Portal extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
protected function checkControllerAccess()
|
||||
{
|
||||
$portalPermission = $this->getAcl()->get('portalPermission');
|
||||
if (!$portalPermission || $portalPermission === 'no') {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
}
|
||||
34
application/Espo/Controllers/PortalRole.php
Normal file
34
application/Espo/Controllers/PortalRole.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Controllers;
|
||||
|
||||
class PortalRole extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,7 +18,14 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
@@ -28,22 +35,22 @@ use \Espo\Core\Exceptions\BadRequest;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
|
||||
class Preferences extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
{
|
||||
protected function getPreferences()
|
||||
{
|
||||
return $this->getContainer()->get('preferences');
|
||||
}
|
||||
|
||||
|
||||
protected function getEntityManager()
|
||||
{
|
||||
return $this->getContainer()->get('entityManager');
|
||||
}
|
||||
|
||||
|
||||
protected function getCrypt()
|
||||
{
|
||||
return $this->getContainer()->get('crypt');
|
||||
}
|
||||
|
||||
|
||||
protected function handleUserAccess($userId)
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
@@ -52,46 +59,61 @@ class Preferences extends \Espo\Core\Controllers\Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function actionDelete($params, $data)
|
||||
|
||||
public function actionDelete($params, $data, $request)
|
||||
{
|
||||
$userId = $params['id'];
|
||||
if (empty($userId)) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
if (!$request->isDelete()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$this->handleUserAccess($userId);
|
||||
|
||||
return $this->getEntityManager()->getRepository('Preferences')->resetToDefaults($userId);
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data)
|
||||
{
|
||||
return $this->actionUpdate($params, $data);
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data)
|
||||
return $this->getEntityManager()->getRepository('Preferences')->resetToDefaults($userId);
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data, $request)
|
||||
{
|
||||
return $this->actionUpdate($params, $data, $request);
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data, $request)
|
||||
{
|
||||
$userId = $params['id'];
|
||||
$this->handleUserAccess($userId);
|
||||
|
||||
|
||||
if (!$request->isPost() && !$request->isPatch() && !$request->isPut()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if ($this->getAcl()->getLevel('Preferences', 'read') === 'no') {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
foreach ($this->getAcl()->getScopeForbiddenAttributeList('Preferences', 'edit') as $attribute) {
|
||||
unset($data[$attribute]);
|
||||
}
|
||||
|
||||
if (array_key_exists('smtpPassword', $data)) {
|
||||
$data['smtpPassword'] = $this->getCrypt()->encrypt($data['smtpPassword']);
|
||||
}
|
||||
|
||||
$user = $this->getEntityManager()->getEntity('User', $userId);
|
||||
|
||||
$user = $this->getEntityManager()->getEntity('User', $userId);
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity('Preferences', $userId);
|
||||
|
||||
if ($entity) {
|
||||
|
||||
if ($entity && $user) {
|
||||
$entity->set($data);
|
||||
$this->getEntityManager()->saveEntity($entity);
|
||||
|
||||
$entity->set('smtpEmailAddress', $user->get('emailAddress'));
|
||||
|
||||
$entity->set('smtpEmailAddress', $user->get('emailAddress'));
|
||||
$entity->set('name', $user->get('name'));
|
||||
|
||||
|
||||
$entity->clear('smtpPassword');
|
||||
|
||||
return $entity->toArray();
|
||||
|
||||
return $entity->toArray();
|
||||
}
|
||||
throw new Error();
|
||||
}
|
||||
@@ -101,18 +123,24 @@ class Preferences extends \Espo\Core\Controllers\Base
|
||||
$userId = $params['id'];
|
||||
$this->handleUserAccess($userId);
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity('Preferences', $userId);
|
||||
$entity = $this->getEntityManager()->getEntity('Preferences', $userId);
|
||||
$user = $this->getEntityManager()->getEntity('User', $userId);
|
||||
|
||||
|
||||
if (!$entity || !$user) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$entity->set('smtpEmailAddress', $user->get('emailAddress'));
|
||||
$entity->set('name', $user->get('name'));
|
||||
|
||||
$entity->set('isPortalUser', $user->get('isPortalUser'));
|
||||
|
||||
$entity->clear('smtpPassword');
|
||||
|
||||
if ($entity) {
|
||||
return $entity->toArray();
|
||||
|
||||
foreach ($this->getAcl()->getScopeForbiddenAttributeList('Preferences', 'read') as $attribute) {
|
||||
$entity->clear($attribute);
|
||||
}
|
||||
throw new NotFound();
|
||||
|
||||
return $entity->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,12 +18,17 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
class Role extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,12 +18,20 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class Settings extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
@@ -38,6 +46,9 @@ class Settings extends \Espo\Core\Controllers\Base
|
||||
unset($data[$field]);
|
||||
}
|
||||
}
|
||||
|
||||
$data['jsLibs'] = $this->getMetadata()->get('app.jsLibs');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -46,17 +57,25 @@ class Settings extends \Espo\Core\Controllers\Base
|
||||
return $this->getConfigData();
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data)
|
||||
public function actionUpdate($params, $data, $request)
|
||||
{
|
||||
return $this->actionPatch($params, $data);
|
||||
return $this->actionPatch($params, $data, $request);
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data)
|
||||
public function actionPatch($params, $data, $request)
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
if (!$request->isPut() && !$request->isPatch()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (isset($data['useCache']) && $data['useCache'] != $this->getConfig()->get('useCache')) {
|
||||
$this->getContainer()->get('dataManager')->clearCache();
|
||||
}
|
||||
|
||||
$this->getConfig()->setData($data, $this->getUser()->isAdmin());
|
||||
$result = $this->getConfig()->save();
|
||||
if ($result === false) {
|
||||
@@ -71,4 +90,23 @@ class Settings extends \Espo\Core\Controllers\Base
|
||||
|
||||
return $this->getConfigData();
|
||||
}
|
||||
|
||||
public function postActionTestLdapConnection($params, $data)
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
if (!isset($data['password'])) {
|
||||
$data['password'] = $this->getConfig()->get('ldapPassword');
|
||||
}
|
||||
|
||||
$ldapUtils = new \Espo\Core\Utils\Authentication\LDAP\Utils();
|
||||
$options = $ldapUtils->normalizeOptions($data);
|
||||
|
||||
$ldapClient = new \Espo\Core\Utils\Authentication\LDAP\Client($options);
|
||||
$ldapClient->bind(); //an exception if no connection
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
@@ -26,7 +33,7 @@ use \Espo\Core\Exceptions\Error;
|
||||
|
||||
class Stream extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
const MAX_SIZE_LIMIT = 400;
|
||||
const MAX_SIZE_LIMIT = 200;
|
||||
|
||||
public static $defaultAction = 'list';
|
||||
|
||||
@@ -38,6 +45,7 @@ class Stream extends \Espo\Core\Controllers\Base
|
||||
$offset = intval($request->get('offset'));
|
||||
$maxSize = intval($request->get('maxSize'));
|
||||
$after = $request->get('after');
|
||||
$filter = $request->get('filter');
|
||||
|
||||
$service = $this->getService('Stream');
|
||||
|
||||
@@ -52,6 +60,7 @@ class Stream extends \Espo\Core\Controllers\Base
|
||||
'offset' => $offset,
|
||||
'maxSize' => $maxSize,
|
||||
'after' => $after,
|
||||
'filter' => $filter
|
||||
));
|
||||
|
||||
return array(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,12 +18,19 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
class Team extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
38
application/Espo/Controllers/Template.php
Normal file
38
application/Espo/Controllers/Template.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
|
||||
class Template extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,40 +18,92 @@
|
||||
*
|
||||
* 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\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
|
||||
class User extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
{
|
||||
public function actionAcl($params, $data, $request)
|
||||
{
|
||||
{
|
||||
$userId = $request->get('id');
|
||||
if (empty($userId)) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
|
||||
if (!$this->getUser()->isAdmin() && $this->getUser()->id != $userId) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
|
||||
$user = $this->getEntityManager()->getEntity('User', $userId);
|
||||
if (empty($user)) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$acl = new \Espo\Core\Acl($user, $this->getConfig(), $this->getContainer()->get('fileManager'), $this->getMetadata());
|
||||
|
||||
return $acl->toArray();
|
||||
|
||||
return $this->getAclManager()->getMap($user);
|
||||
}
|
||||
|
||||
public function actionChangeOwnPassword($params, $data)
|
||||
|
||||
public function postActionChangeOwnPassword($params, $data, $request)
|
||||
{
|
||||
return $this->getService('User')->changePassword($this->getUser()->id, $data['password']);
|
||||
if (!array_key_exists('password', $data) || !array_key_exists('currentPassword', $data)) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
return $this->getService('User')->changePassword($this->getUser()->id, $data['password'], true, $data['currentPassword']);
|
||||
}
|
||||
|
||||
public function postActionChangePasswordByRequest($params, $data, $request)
|
||||
{
|
||||
if (empty($data['requestId']) || empty($data['password'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$p = $this->getEntityManager()->getRepository('PasswordChangeRequest')->where(array(
|
||||
'requestId' => $data['requestId']
|
||||
))->findOne();
|
||||
|
||||
if (!$p) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
$userId = $p->get('userId');
|
||||
if (!$userId) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
$this->getEntityManager()->removeEntity($p);
|
||||
|
||||
if ($this->getService('User')->changePassword($userId, $data['password'])) {
|
||||
return array(
|
||||
'url' => $p->get('url')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function postActionPasswordChangeRequest($params, $data, $request)
|
||||
{
|
||||
if (empty($data['userName']) || empty($data['emailAddress'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$userName = $data['userName'];
|
||||
$emailAddress = $data['emailAddress'];
|
||||
$url = null;
|
||||
if (!empty($data['url'])) {
|
||||
$url = $data['url'];
|
||||
}
|
||||
|
||||
return $this->getService('User')->passwordChangeRequest($userName, $emailAddress, $url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,264 +18,115 @@
|
||||
*
|
||||
* 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\Core;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
use \Espo\Entities\User;
|
||||
|
||||
class Acl
|
||||
{
|
||||
private $data = array();
|
||||
private $user;
|
||||
|
||||
private $cacheFile;
|
||||
private $aclManager;
|
||||
|
||||
private $actionList = array('read', 'edit', 'delete');
|
||||
|
||||
private $levelList = array('all', 'team', 'own', 'no');
|
||||
|
||||
protected $fileManager;
|
||||
|
||||
protected $metadata;
|
||||
|
||||
public function __construct(\Espo\Entities\User $user, $config = null, $fileManager = null, $metadata = null)
|
||||
public function __construct(AclManager $aclManager, User $user)
|
||||
{
|
||||
$this->aclManager = $aclManager;
|
||||
$this->user = $user;
|
||||
|
||||
$this->metadata = $metadata;
|
||||
|
||||
if (!$this->user->isFetched()) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
$this->user->loadLinkMultipleField('teams');
|
||||
|
||||
if ($fileManager) {
|
||||
$this->fileManager = $fileManager;
|
||||
}
|
||||
|
||||
$this->cacheFile = 'data/cache/application/acl/' . $user->id . '.php';
|
||||
|
||||
if ($config && $config->get('useCache') && file_exists($this->cacheFile)) {
|
||||
$cached = include $this->cacheFile;
|
||||
$this->data = $cached;
|
||||
$this->initSolid();
|
||||
} else {
|
||||
$this->load();
|
||||
$this->initSolid();
|
||||
if ($config && $fileManager && $config->get('useCache')) {
|
||||
$this->buildCache();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function checkScope($scope, $action = null, $isOwner = null, $inTeam = null, $entity = null)
|
||||
protected function getAclManager()
|
||||
{
|
||||
if (array_key_exists($scope, $this->data)) {
|
||||
if ($this->data[$scope] === false) {
|
||||
return false;
|
||||
}
|
||||
if ($this->data[$scope] === true) {
|
||||
return true;
|
||||
}
|
||||
if (!is_null($action)) {
|
||||
if (array_key_exists($action, $this->data[$scope])) {
|
||||
$value = $this->data[$scope][$action];
|
||||
|
||||
if ($value === 'all' || $value === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$value || $value === 'no') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_null($isOwner)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($isOwner) {
|
||||
if ($value === 'own' || $value === 'team') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ($inTeam === null && $entity) {
|
||||
$inTeam = $this->checkInTeam($entity);
|
||||
}
|
||||
|
||||
if ($inTeam) {
|
||||
if ($value === 'team') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return $this->aclManager;
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
protected function getUser()
|
||||
{
|
||||
return $this->data;
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function getMap()
|
||||
{
|
||||
return $this->getAclManager()->getMap($this->getUser());
|
||||
}
|
||||
|
||||
public function getLevel($scope, $action)
|
||||
{
|
||||
if ($this->user->isAdmin()) {
|
||||
return 'all';
|
||||
}
|
||||
if (array_key_exists($scope, $this->data)) {
|
||||
if (array_key_exists($action, $this->data[$scope])) {
|
||||
return $this->data[$scope][$action];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return $this->getAclManager()->getLevel($this->getUser(), $scope, $action);
|
||||
}
|
||||
|
||||
public function check($subject, $action = null, $isOwner = null, $inTeam = null)
|
||||
public function get($permission)
|
||||
{
|
||||
if ($this->user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
if (is_string($subject)) {
|
||||
return $this->checkScope($subject, $action, $isOwner, $inTeam);
|
||||
} else {
|
||||
$entity = $subject;
|
||||
if ($entity instanceof Entity) {
|
||||
$entityName = $entity->getEntityName();
|
||||
return $this->checkScope($entityName, $action, $this->checkIsOwner($entity), $inTeam, $entity);
|
||||
}
|
||||
}
|
||||
return $this->getAclManager()->get($this->getUser(), $permission);
|
||||
}
|
||||
|
||||
public function checkReadOnlyTeam($scope)
|
||||
{
|
||||
if (isset($this->data[$scope]) && isset($this->data[$scope]['read'])) {
|
||||
return $this->data[$scope]['read'] === 'team';
|
||||
}
|
||||
return false;
|
||||
return $this->getAclManager()->checkReadOnlyTeam($this->getUser(), $scope);
|
||||
}
|
||||
|
||||
public function checkReadOnlyOwn($scope)
|
||||
{
|
||||
if ($this->user->isAdmin()) {
|
||||
return false;
|
||||
}
|
||||
if (isset($this->data[$scope]) && isset($this->data[$scope]['read'])) {
|
||||
return $this->data[$scope]['read'] === 'own';
|
||||
}
|
||||
return false;
|
||||
return $this->getAclManager()->checkReadOnlyOwn($this->getUser(), $scope);
|
||||
}
|
||||
|
||||
public function checkIsOwner($entity)
|
||||
public function check($subject, $action = null)
|
||||
{
|
||||
if ($this->user->isAdmin()) {
|
||||
return false;
|
||||
}
|
||||
$userId = $this->user->id;
|
||||
if ($userId === $entity->get('assignedUserId') || $userId === $entity->get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return $this->getAclManager()->check($this->getUser(), $subject, $action);
|
||||
}
|
||||
|
||||
public function checkInTeam($entity)
|
||||
public function checkScope($scope, $action = null)
|
||||
{
|
||||
$userTeamIds = $this->user->get('teamsIds');
|
||||
|
||||
if (!$entity->hasRelation('teams') || !$entity->hasField('teamsIds')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$entity->has('teamsIds')) {
|
||||
$entity->loadLinkMultipleField('teams');
|
||||
}
|
||||
|
||||
$teamIds = $entity->get('teamsIds');
|
||||
|
||||
if (empty($teamIds)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($userTeamIds as $id) {
|
||||
if (in_array($id, $teamIds)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return $this->getAclManager()->checkScope($this->getUser(), $scope, $action);
|
||||
}
|
||||
|
||||
private function load()
|
||||
public function checkEntity(Entity $entity, $action = 'read')
|
||||
{
|
||||
$aclTables = array();
|
||||
|
||||
$userRoles = $this->user->get('roles');
|
||||
|
||||
foreach ($userRoles as $role) {
|
||||
$aclTables[] = json_decode($role->get('data'));
|
||||
}
|
||||
|
||||
$teams = $this->user->get('teams');
|
||||
foreach ($teams as $team) {
|
||||
$teamRoles = $team->get('roles');
|
||||
foreach ($teamRoles as $role) {
|
||||
$aclTables[] = json_decode($role->get('data'));
|
||||
}
|
||||
}
|
||||
|
||||
$this->data = $this->merge($aclTables);
|
||||
return $this->getAclManager()->checkEntity($this->getUser(), $entity, $action);
|
||||
}
|
||||
|
||||
private function initSolid()
|
||||
public function checkUser($permission, User $entity)
|
||||
{
|
||||
$data = $this->metadata->get('app.acl.solid', array());
|
||||
|
||||
foreach ($data as $entityName => $item) {
|
||||
$this->data[$entityName] = $item;
|
||||
}
|
||||
return $this->getAclManager()->checkUser($this->getUser(), $permission, $entity);
|
||||
}
|
||||
|
||||
private function merge($tables)
|
||||
public function checkIsOwner(Entity $entity)
|
||||
{
|
||||
$data = array();
|
||||
foreach ($tables as $table) {
|
||||
foreach ($table as $scope => $row) {
|
||||
if ($row == false) {
|
||||
if (!isset($data[$scope])) {
|
||||
$data[$scope] = false;
|
||||
}
|
||||
} else {
|
||||
if (!isset($data[$scope])) {
|
||||
$data[$scope] = array();
|
||||
}
|
||||
if ($data[$scope] == false) {
|
||||
$data[$scope] = array();
|
||||
}
|
||||
foreach ($row as $action => $level) {
|
||||
if (!isset($data[$scope][$action])) {
|
||||
$data[$scope][$action] = $level;
|
||||
} else {
|
||||
if (array_search($data[$scope][$action], $this->levelList) > array_search($level, $this->levelList)) {
|
||||
$data[$scope][$action] = $level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
return $this->getAclManager()->checkIsOwner($this->getUser(), $entity);
|
||||
}
|
||||
|
||||
private function buildCache()
|
||||
public function checkInTeam(Entity $entity)
|
||||
{
|
||||
$contents = '<' . '?'. 'php return ' . var_export($this->data, true) . ';';
|
||||
$this->fileManager->putContents($this->cacheFile, $contents);
|
||||
return $this->getAclManager()->checkInTeam($this->getUser(), $entity);
|
||||
}
|
||||
|
||||
public function getScopeForbiddenAttributeList($scope, $action = 'read', $thresholdLevel = 'no')
|
||||
{
|
||||
return $this->getAclManager()->getScopeForbiddenAttributeList($this->getUser(), $scope, $action, $thresholdLevel);
|
||||
}
|
||||
|
||||
public function getScopeForbiddenFieldList($scope, $action = 'read', $thresholdLevel = 'no')
|
||||
{
|
||||
return $this->getAclManager()->getScopeForbiddenFieldList($this->getUser(), $scope, $action, $thresholdLevel);
|
||||
}
|
||||
|
||||
public function checkUserPermission($target, $permissionType = 'userPermission')
|
||||
{
|
||||
return $this->getAclManager()->checkUserPermission($this->getUser(), $target, $permissionType);
|
||||
}
|
||||
|
||||
public function checkAssignmentPermission($target)
|
||||
{
|
||||
return $this->getAclManager()->checkAssignmentPermission($this->getUser(), $target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
273
application/Espo/Core/Acl/Base.php
Normal file
273
application/Espo/Core/Acl/Base.php
Normal file
@@ -0,0 +1,273 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core\Acl;
|
||||
|
||||
use \Espo\Core\Interfaces\Injectable;
|
||||
|
||||
use \Espo\Entities\User;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class Base implements Injectable
|
||||
{
|
||||
protected $dependencies = array(
|
||||
'config',
|
||||
'entityManager',
|
||||
'aclManager'
|
||||
);
|
||||
|
||||
protected $scope;
|
||||
|
||||
protected $injections = array();
|
||||
|
||||
public function inject($name, $object)
|
||||
{
|
||||
$this->injections[$name] = $object;
|
||||
}
|
||||
|
||||
public function __construct($scope)
|
||||
{
|
||||
$this->init();
|
||||
$this->scope = $scope;
|
||||
}
|
||||
|
||||
protected function init()
|
||||
{
|
||||
}
|
||||
|
||||
protected function getInjection($name)
|
||||
{
|
||||
return $this->injections[$name];
|
||||
}
|
||||
|
||||
protected function addDependencyList(array $list)
|
||||
{
|
||||
foreach ($list as $item) {
|
||||
$this->addDependency($item);
|
||||
}
|
||||
}
|
||||
|
||||
protected function addDependency($name)
|
||||
{
|
||||
$this->dependencies[] = $name;
|
||||
}
|
||||
|
||||
public function getDependencyList()
|
||||
{
|
||||
return $this->dependencies;
|
||||
}
|
||||
|
||||
protected function getConfig()
|
||||
{
|
||||
return $this->getInjection('config');
|
||||
}
|
||||
|
||||
protected function getEntityManager()
|
||||
{
|
||||
return $this->getInjection('entityManager');
|
||||
}
|
||||
|
||||
protected function getAclManager()
|
||||
{
|
||||
return $this->getInjection('aclManager');
|
||||
}
|
||||
|
||||
public function checkReadOnlyTeam(User $user, $data)
|
||||
{
|
||||
if (empty($data) || !is_object($data) || !isset($data->read)) {
|
||||
return false;
|
||||
}
|
||||
return $data->read === 'team';
|
||||
}
|
||||
|
||||
public function checkReadOnlyOwn(User $user, $data)
|
||||
{
|
||||
if (empty($data) || !is_object($data) || !isset($data->read)) {
|
||||
return false;
|
||||
}
|
||||
return $data->read === 'own';
|
||||
}
|
||||
|
||||
public function checkEntity(User $user, Entity $entity, $data, $action)
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
return $this->checkScope($user, $data, $action, $entity);
|
||||
}
|
||||
|
||||
public function checkScope(User $user, $data, $action = null, Entity $entity = null, $entityAccessData = array())
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_null($data)) {
|
||||
return false;
|
||||
}
|
||||
if ($data === false) {
|
||||
return false;
|
||||
}
|
||||
if ($data === true) {
|
||||
return true;
|
||||
}
|
||||
if (is_string($data)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$isOwner = null;
|
||||
if (isset($entityAccessData['isOwner'])) {
|
||||
$isOwner = $entityAccessData['isOwner'];
|
||||
}
|
||||
$inTeam = null;
|
||||
if (isset($entityAccessData['inTeam'])) {
|
||||
$inTeam = $entityAccessData['inTeam'];
|
||||
}
|
||||
|
||||
if (is_null($action)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isset($data->$action)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$value = $data->$action;
|
||||
|
||||
if ($value === 'all' || $value === 'yes' || $value === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$value || $value === 'no') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_null($isOwner)) {
|
||||
if ($entity) {
|
||||
$isOwner = $this->checkIsOwner($user, $entity);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($isOwner) {
|
||||
if ($value === 'own' || $value === 'team') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (is_null($inTeam) && $entity) {
|
||||
$inTeam = $this->checkInTeam($user, $entity);
|
||||
}
|
||||
|
||||
if ($inTeam) {
|
||||
if ($value === 'team') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkIsOwner(User $user, Entity $entity)
|
||||
{
|
||||
if ($entity->hasAttribute('assignedUserId')) {
|
||||
if ($entity->has('assignedUserId')) {
|
||||
if ($user->id === $entity->get('assignedUserId')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if ($entity->hasAttribute('createdById')) {
|
||||
if ($entity->has('createdById')) {
|
||||
if ($user->id === $entity->get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($entity->hasAttribute('assignedUsersIds') && $entity->hasRelation('assignedUsers')) {
|
||||
if ($entity->hasLinkMultipleId('assignedUsers', $user->id)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkInTeam(User $user, Entity $entity)
|
||||
{
|
||||
$userTeamIdList = $user->getLinkMultipleIdList('teams');
|
||||
|
||||
if (!$entity->hasRelation('teams') || !$entity->hasAttribute('teamsIds')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$entityTeamIdList = $entity->getLinkMultipleIdList('teams');
|
||||
|
||||
if (empty($entityTeamIdList)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($userTeamIdList as $id) {
|
||||
if (in_array($id, $entityTeamIdList)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkEntityDelete(User $user, Entity $entity, $data)
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->checkEntity($user, $entity, $data, 'delete')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_object($data)) {
|
||||
if ($data->edit !== 'no' || $data->create !== 'no') {
|
||||
if ($entity->has('createdById') && $entity->get('createdById') == $user->id) {
|
||||
if (!$entity->has('assignedUserId')) {
|
||||
return true;
|
||||
} else {
|
||||
if (!$entity->get('assignedUserId')) {
|
||||
return true;
|
||||
}
|
||||
if ($entity->get('assignedUserId') == $entity->get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
708
application/Espo/Core/Acl/Table.php
Normal file
708
application/Espo/Core/Acl/Table.php
Normal file
@@ -0,0 +1,708 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core\Acl;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
use \Espo\Entities\User;
|
||||
|
||||
use \Espo\Core\Utils\Config;
|
||||
use \Espo\Core\Utils\Metadata;
|
||||
use \Espo\Core\Utils\FieldManager;
|
||||
use \Espo\Core\Utils\File\Manager as FileManager;
|
||||
|
||||
class Table
|
||||
{
|
||||
protected $type = 'acl';
|
||||
|
||||
protected $defaultAclType = 'recordAllTeamOwnNo';
|
||||
|
||||
private $data = null;
|
||||
|
||||
protected $cacheFilePath;
|
||||
|
||||
protected $actionList = ['read', 'stream', 'edit', 'delete', 'create'];
|
||||
|
||||
protected $booleanActionList = ['create'];
|
||||
|
||||
protected $levelList = ['yes', 'all', 'team', 'own', 'no'];
|
||||
|
||||
protected $fieldActionList = ['read', 'edit'];
|
||||
|
||||
protected $fieldLevelList = ['yes', 'no'];
|
||||
|
||||
protected $valuePermissionList = ['assignmentPermission', 'userPermission', 'portalPermission'];
|
||||
|
||||
protected $valuePrtmissionHighestLevels = array(
|
||||
'assignmentPermission' => 'all',
|
||||
'userPermission' => 'all',
|
||||
'portalPermission' => 'yes'
|
||||
);
|
||||
|
||||
private $fileManager;
|
||||
|
||||
private $metadata;
|
||||
|
||||
private $fieldManager;
|
||||
|
||||
protected $forbiddenAttributesCache = array();
|
||||
|
||||
protected $forbiddenFieldsCache = array();
|
||||
|
||||
public function __construct(User $user, Config $config = null, FileManager $fileManager = null, Metadata $metadata = null, FieldManager $fieldManager = null)
|
||||
{
|
||||
$this->data = (object) [
|
||||
'table' => (object) [],
|
||||
'fieldTable' => (object) [],
|
||||
'fieldTableQuickAccess' => (object) [],
|
||||
];
|
||||
|
||||
$this->user = $user;
|
||||
|
||||
$this->metadata = $metadata;
|
||||
|
||||
if ($fieldManager) {
|
||||
$this->fieldManager = $fieldManager;
|
||||
}
|
||||
|
||||
if (!$this->user->isFetched()) {
|
||||
throw new Error('User must be fetched before ACL check.');
|
||||
}
|
||||
|
||||
if ($fileManager) {
|
||||
$this->fileManager = $fileManager;
|
||||
}
|
||||
$this->valuePermissionList = $this->metadata->get('app.' . $this->type . '.defs.valuePermissionList', $this->valuePermissionList);
|
||||
|
||||
$this->initCacheFilePath();
|
||||
|
||||
if ($config && $config->get('useCache') && file_exists($this->cacheFilePath)) {
|
||||
$cached = include $this->cacheFilePath;
|
||||
$this->data = $cached;
|
||||
} else {
|
||||
$this->load();
|
||||
if ($config && $fileManager && $config->get('useCache')) {
|
||||
$this->buildCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function initCacheFilePath()
|
||||
{
|
||||
$this->cacheFilePath = 'data/cache/application/acl/' . $this->getUser()->id . '.php';
|
||||
}
|
||||
|
||||
protected function getUser()
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
protected function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
protected function getFieldManager()
|
||||
{
|
||||
return $this->fieldManager;
|
||||
}
|
||||
|
||||
protected function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
public function getMap()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function getScopeData($scope)
|
||||
{
|
||||
if (isset($this->data->table->$scope)) {
|
||||
$data = $this->data->table->$scope;
|
||||
if (is_string($data)) {
|
||||
$data = $this->getScopeData($data);
|
||||
return $data;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get($permission)
|
||||
{
|
||||
if ($permission == 'table') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isset($this->data->$permission)) {
|
||||
return $this->data->$permission;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getLevel($scope, $action)
|
||||
{
|
||||
if (isset($this->data->table->$scope)) {
|
||||
if (isset($this->data->table->$scope->$action)) {
|
||||
return $this->data->table->$scope->$action;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function load()
|
||||
{
|
||||
$valuePermissionLists = (object)[];
|
||||
foreach ($this->valuePermissionList as $permission) {
|
||||
$valuePermissionLists->$permission = [];
|
||||
}
|
||||
|
||||
$aclTableList = [];
|
||||
$fieldTableList = [];
|
||||
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
$roleList = $this->getRoleList();
|
||||
|
||||
foreach ($roleList as $role) {
|
||||
$aclTableList[] = $role->get('data');
|
||||
$fieldTableList[] = $role->get('fieldData');
|
||||
foreach ($this->valuePermissionList as $permission) {
|
||||
$valuePermissionLists->{$permission}[] = $role->get($permission);
|
||||
}
|
||||
}
|
||||
|
||||
$aclTable = $this->mergeTableList($aclTableList);
|
||||
$fieldTable = $this->mergeFieldTableList($fieldTableList);
|
||||
|
||||
$this->applyDefault($aclTable, $fieldTable);
|
||||
$this->applyDisabled($aclTable, $fieldTable);
|
||||
$this->applyMandatory($aclTable, $fieldTable);
|
||||
$this->applyAdditional($aclTable, $fieldTable, $valuePermissionLists);
|
||||
} else {
|
||||
$aclTable = (object) [];
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
if ($this->metadata->get("scopes.{$scope}.{$this->type}") === 'boolean') {
|
||||
$aclTable->$scope = true;
|
||||
} else {
|
||||
if ($this->metadata->get("scopes.{$scope}.entity")) {
|
||||
$aclTable->$scope = (object) [];
|
||||
foreach ($this->actionList as $action) {
|
||||
$aclTable->$scope->$action = 'all';
|
||||
if (in_array($action, $this->booleanActionList)) {
|
||||
$aclTable->$scope->$action = 'yes';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$fieldTable = (object) [];
|
||||
}
|
||||
|
||||
foreach ($aclTable as $scope => $data) {
|
||||
if (is_string($data)) {
|
||||
if (isset($aclTable->$data)) {
|
||||
$aclTable->$scope = $aclTable->$data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->data->table = $aclTable;
|
||||
$this->data->fieldTable = $fieldTable;
|
||||
|
||||
$this->fillFieldTableQuickAccess();
|
||||
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
foreach ($this->valuePermissionList as $permission) {
|
||||
$this->data->$permission = $this->mergeValueList($valuePermissionLists->$permission, $this->metadata->get('app.'.$this->type.'.default.' . $permission, 'yes'));
|
||||
if ($this->metadata->get('app.'.$this->type.'.mandatory.' . $permission)) {
|
||||
$this->data->$permission = $this->metadata->get('app.'.$this->type.'.mandatory.' . $permission);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
foreach ($this->valuePermissionList as $permission) {
|
||||
if (isset($this->valuePrtmissionHighestLevels[$permission])) {
|
||||
$this->data->$permission = $this->valuePrtmissionHighestLevels[$permission];
|
||||
continue;
|
||||
}
|
||||
$this->data->$permission = 'all';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function getRoleList()
|
||||
{
|
||||
$roleList = [];
|
||||
|
||||
$userRoleList = $this->getUser()->get('roles');
|
||||
if (!(is_array($userRoleList) || $userRoleList instanceof \Traversable)) {
|
||||
throw new Error();
|
||||
}
|
||||
foreach ($userRoleList as $role) {
|
||||
$roleList[] = $role;
|
||||
}
|
||||
|
||||
$teamList = $this->getUser()->get('teams');
|
||||
if (!(is_array($teamList) || $teamList instanceof \Traversable)) {
|
||||
throw new Error();
|
||||
}
|
||||
foreach ($teamList as $team) {
|
||||
$teamRoleList = $team->get('roles');
|
||||
foreach ($teamRoleList as $role) {
|
||||
$roleList[] = $role;
|
||||
}
|
||||
}
|
||||
|
||||
return $roleList;
|
||||
}
|
||||
|
||||
public function getScopeForbiddenAttributeList($scope, $action = 'read', $thresholdLevel = 'no')
|
||||
{
|
||||
$key = $scope . '_'. $action . '_' . $thresholdLevel;
|
||||
if (isset($this->forbiddenAttributesCache[$key])) {
|
||||
return $this->forbiddenAttributesCache[$key];
|
||||
}
|
||||
|
||||
$fieldTableQuickAccess = $this->data->fieldTableQuickAccess;
|
||||
|
||||
if (!isset($fieldTableQuickAccess->$scope) || !isset($fieldTableQuickAccess->$scope->attributes) || !isset($fieldTableQuickAccess->$scope->attributes->$action)) {
|
||||
$this->forbiddenAttributesCache[$key] = [];
|
||||
return [];
|
||||
}
|
||||
|
||||
$levelList = [];
|
||||
foreach ($this->fieldLevelList as $level) {
|
||||
if (array_search($level, $this->fieldLevelList) >= array_search($thresholdLevel, $this->fieldLevelList)) {
|
||||
$levelList[] = $level;
|
||||
}
|
||||
}
|
||||
|
||||
$attributeList = [];
|
||||
|
||||
foreach ($levelList as $level) {
|
||||
if (!isset($fieldTableQuickAccess->$scope->attributes->$action->$level)) continue;
|
||||
foreach ($fieldTableQuickAccess->$scope->attributes->$action->$level as $attribute) {
|
||||
if (in_array($attribute, $attributeList)) continue;
|
||||
$attributeList[] = $attribute;
|
||||
}
|
||||
}
|
||||
|
||||
$this->forbiddenAttributesCache[$key] = $attributeList;
|
||||
|
||||
return $attributeList;
|
||||
}
|
||||
|
||||
public function getScopeForbiddenFieldList($scope, $action = 'read', $thresholdLevel = 'no')
|
||||
{
|
||||
$key = $scope . '_'. $action . '_' . $thresholdLevel;
|
||||
if (isset($this->forbiddenFieldsCache[$key])) {
|
||||
return $this->forbiddenFieldsCache[$key];
|
||||
}
|
||||
|
||||
$fieldTableQuickAccess = $this->data->fieldTableQuickAccess;
|
||||
|
||||
if (!isset($fieldTableQuickAccess->$scope) || !isset($fieldTableQuickAccess->$scope->fields) || !isset($fieldTableQuickAccess->$scope->fields->$action)) {
|
||||
$this->forbiddenFieldsCache[$key] = [];
|
||||
return [];
|
||||
}
|
||||
|
||||
$levelList = [];
|
||||
foreach ($this->fieldLevelList as $level) {
|
||||
if (array_search($level, $this->fieldLevelList) >= array_search($thresholdLevel, $this->fieldLevelList)) {
|
||||
$levelList[] = $level;
|
||||
}
|
||||
}
|
||||
|
||||
$fieldList = [];
|
||||
|
||||
foreach ($levelList as $level) {
|
||||
if (!isset($fieldTableQuickAccess->$scope->fields->$action->$level)) continue;
|
||||
foreach ($fieldTableQuickAccess->$scope->fields->$action->$level as $field) {
|
||||
if (in_array($field, $fieldList)) continue;
|
||||
$fieldList[] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
$this->forbiddenFieldsCache[$key] = $fieldList;
|
||||
|
||||
return $fieldList;
|
||||
}
|
||||
|
||||
protected function fillFieldTableQuickAccess()
|
||||
{
|
||||
$fieldTable = $this->data->fieldTable;
|
||||
|
||||
$fieldTableQuickAccess = (object) [];
|
||||
|
||||
foreach (get_object_vars($fieldTable) as $scope => $scopeData) {
|
||||
$fieldTableQuickAccess->$scope = (object) [
|
||||
'attributes' => (object) [],
|
||||
'fields' => (object) []
|
||||
];
|
||||
|
||||
foreach ($this->fieldActionList as $action) {
|
||||
$fieldTableQuickAccess->$scope->attributes->$action = (object) [];
|
||||
$fieldTableQuickAccess->$scope->fields->$action = (object) [];
|
||||
foreach ($this->fieldLevelList as $level) {
|
||||
$fieldTableQuickAccess->$scope->attributes->$action->$level = [];
|
||||
$fieldTableQuickAccess->$scope->fields->$action->$level = [];
|
||||
}
|
||||
}
|
||||
|
||||
foreach (get_object_vars($scopeData) as $field => $fieldData) {
|
||||
$attributeList = $this->getFieldManager()->getAttributeList($scope, $field);
|
||||
|
||||
foreach ($this->fieldActionList as $action) {
|
||||
if (!isset($fieldData->$action)) continue;
|
||||
foreach ($this->fieldLevelList as $level) {
|
||||
if ($fieldData->$action === $level) {
|
||||
$fieldTableQuickAccess->$scope->fields->$action->{$level}[] = $field;
|
||||
foreach ($attributeList as $attribute) {
|
||||
$fieldTableQuickAccess->$scope->attributes->$action->{$level}[] = $attribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->data->fieldTableQuickAccess = $fieldTableQuickAccess;
|
||||
}
|
||||
|
||||
protected function applyDefault(&$table, &$fieldTable)
|
||||
{
|
||||
if ($this->getUser()->isAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $this->metadata->get('app.'.$this->type.'.default.scopeLevel', array());
|
||||
|
||||
foreach ($data as $scope => $item) {
|
||||
if (isset($table->$scope)) continue;
|
||||
$value = $item;
|
||||
if (is_array($item)) {
|
||||
$value = (object) $item;
|
||||
}
|
||||
$table->$scope = $value;
|
||||
}
|
||||
|
||||
$defaultFieldData = $this->metadata->get('app.'.$this->type.'.default.fieldLevel', array());
|
||||
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
if (isset($table->$scope) && $table->$scope === false) continue;
|
||||
if (!$this->getMetadata()->get('scopes.' . $scope . '.entity')) continue;
|
||||
|
||||
$fieldList = array_keys($this->getMetadata()->get("entityDefs.{$scope}.fields", []));
|
||||
|
||||
$defaultScopeFieldData = $this->metadata->get('app.'.$this->type.'.default.scopeFieldLevel.' . $scope, array());
|
||||
|
||||
foreach (array_merge($defaultFieldData, $defaultScopeFieldData) as $field => $f) {
|
||||
if (!in_array($field, $fieldList)) continue;
|
||||
if (!isset($fieldTable->$scope)) {
|
||||
$fieldTable->$scope = (object) [];
|
||||
}
|
||||
if (isset($fieldTable->$scope->$field)) continue;
|
||||
$fieldTable->$scope->$field = (object) [];
|
||||
foreach ($this->fieldActionList as $action) {
|
||||
$level = 'no';
|
||||
if ($f === true) {
|
||||
$level = 'yes';
|
||||
} else {
|
||||
if (is_array($f) && isset($f[$action])) {
|
||||
$level = $f[$action];
|
||||
}
|
||||
}
|
||||
$fieldTable->$scope->$field->$action = $level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getScopeWithAclList() as $scope) {
|
||||
if (!isset($table->$scope)) {
|
||||
$aclType = $this->metadata->get('scopes.' . $scope . '.' . $this->type);
|
||||
if ($aclType === true) {
|
||||
$aclType = $this->defaultAclType;
|
||||
}
|
||||
if (!empty($aclType)) {
|
||||
$defaultValue = $this->metadata->get('app.'.$this->type.'.scopeLevelTypesDefaults.' . $aclType, $this->metadata->get('app.'.$this->type.'.scopeLevelTypesDefaults.record'));
|
||||
if (is_array($defaultValue)) {
|
||||
$defaultValue = (object) $defaultValue;
|
||||
}
|
||||
$table->$scope = $defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function applyMandatory(&$table, &$fieldTable)
|
||||
{
|
||||
if ($this->getUser()->isAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $this->metadata->get('app.'.$this->type.'.mandatory.scopeLevel', array());
|
||||
|
||||
foreach ($data as $scope => $item) {
|
||||
$value = $item;
|
||||
if (is_array($item)) {
|
||||
$value = (object) $item;
|
||||
}
|
||||
$table->$scope = $value;
|
||||
}
|
||||
|
||||
$mandatoryFieldData = $this->metadata->get('app.'.$this->type.'.mandatory.fieldLevel', array());
|
||||
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
if (isset($table->$scope) && $table->$scope === false) continue;
|
||||
if (!$this->getMetadata()->get('scopes.' . $scope . '.entity')) continue;
|
||||
|
||||
$fieldList = array_keys($this->getMetadata()->get("entityDefs.{$scope}.fields", []));
|
||||
|
||||
$mandatoryScopeFieldData = $this->metadata->get('app.'.$this->type.'.mandatory.scopeFieldLevel.' . $scope, array());
|
||||
|
||||
foreach (array_merge($mandatoryFieldData, $mandatoryScopeFieldData) as $field => $f) {
|
||||
if (!in_array($field, $fieldList)) continue;
|
||||
if (!isset($fieldTable->$scope)) {
|
||||
$fieldTable->$scope = (object) [];
|
||||
}
|
||||
$fieldTable->$scope->$field = (object) [];
|
||||
foreach ($this->fieldActionList as $action) {
|
||||
$level = 'no';
|
||||
if ($f === true) {
|
||||
$level = 'yes';
|
||||
} else {
|
||||
if (is_array($f) && isset($f[$action])) {
|
||||
$level = $f[$action];
|
||||
}
|
||||
}
|
||||
$fieldTable->$scope->$field->$action = $level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function applyDisabled(&$table, &$fieldTable)
|
||||
{
|
||||
if ($this->getUser()->isAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
if ($this->getMetadata()->get('scopes.' . $scope . '.disabled')) {
|
||||
$table->$scope = false;
|
||||
unset($fieldTable->$scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function applyAdditional(&$table, &$fieldTable, &$valuePermissionLists)
|
||||
{
|
||||
if ($this->getUser()->get('isPortalUser')) {
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
$table->$scope = false;
|
||||
unset($fieldTable->$scope);
|
||||
}
|
||||
foreach ($this->valuePermissionList as $permission) {
|
||||
$valuePermissionLists->{$permission}[] = 'no';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function mergeValueList(array $list, $defaultValue)
|
||||
{
|
||||
$result = null;
|
||||
foreach ($list as $level) {
|
||||
if ($level != 'not-set') {
|
||||
if (is_null($result)) {
|
||||
$result = $level;
|
||||
continue;
|
||||
}
|
||||
if (array_search($result, $this->levelList) > array_search($level, $this->levelList)) {
|
||||
$result = $level;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_null($result)) {
|
||||
$result = $defaultValue;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function getScopeWithAclList()
|
||||
{
|
||||
$scopeList = [];
|
||||
$scopes = $this->metadata->get('scopes');
|
||||
foreach ($scopes as $scope => $d) {
|
||||
if (empty($d['acl'])) continue;
|
||||
$scopeList[] = $scope;
|
||||
}
|
||||
return $scopeList;
|
||||
}
|
||||
|
||||
protected function getScopeList()
|
||||
{
|
||||
$scopeList = [];
|
||||
$scopes = $this->metadata->get('scopes');
|
||||
foreach ($scopes as $scope => $d) {
|
||||
$scopeList[] = $scope;
|
||||
}
|
||||
return $scopeList;
|
||||
}
|
||||
|
||||
private function mergeTableList(array $tableList)
|
||||
{
|
||||
$data = (object) [];
|
||||
$scopeList = $this->getScopeWithAclList();
|
||||
|
||||
foreach ($tableList as $table) {
|
||||
foreach ($scopeList as $scope) {
|
||||
if (!isset($table->$scope)) continue;
|
||||
|
||||
$row = $table->$scope;
|
||||
|
||||
if ($row == false) {
|
||||
if (!isset($data->$scope)) {
|
||||
$data->$scope = false;
|
||||
}
|
||||
} else if ($row === true) {
|
||||
$data->$scope = true;
|
||||
} else {
|
||||
if (!isset($data->$scope)) {
|
||||
$data->$scope = (object) [];
|
||||
}
|
||||
if ($data->$scope === false) {
|
||||
$data->$scope = (object) [];
|
||||
}
|
||||
|
||||
if (!is_object($row)) continue;
|
||||
|
||||
foreach ($this->actionList as $i => $action) {
|
||||
if (isset($row->$action)) {
|
||||
$level = $row->$action;
|
||||
if (!isset($data->$scope->$action)) {
|
||||
$data->$scope->$action = $level;
|
||||
} else {
|
||||
if (array_search($data->$scope->$action, $this->levelList) > array_search($level, $this->levelList)) {
|
||||
$data->$scope->$action = $level;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($i > 0) {
|
||||
// TODO remove it
|
||||
$previousAction = $this->actionList[$i - 1];
|
||||
if (in_array($action, $this->booleanActionList)) {
|
||||
$data->$scope->$action = 'yes';
|
||||
} else {
|
||||
if (isset($data->$scope->$previousAction)) {
|
||||
$data->$scope->$action = $data->$scope->$previousAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function mergeFieldTableList(array $tableList)
|
||||
{
|
||||
$data = (object) [];
|
||||
$scopeList = $this->getScopeWithAclList();
|
||||
|
||||
foreach ($tableList as $table) {
|
||||
foreach ($scopeList as $scope) {
|
||||
if (!isset($table->$scope)) continue;
|
||||
|
||||
if (!isset($data->$scope)) {
|
||||
$data->$scope = (object) [];
|
||||
}
|
||||
|
||||
if (!is_object($table->$scope)) continue;
|
||||
|
||||
$fieldList = array_keys($this->getMetadata()->get("entityDefs.{$scope}.fields", []));
|
||||
|
||||
foreach (get_object_vars($table->$scope) as $field => $row) {
|
||||
if (!is_object($row)) continue;
|
||||
|
||||
if (!in_array($field, $fieldList)) continue;
|
||||
|
||||
if (!isset($data->$scope->$field)) {
|
||||
$data->$scope->$field = (object) [];
|
||||
}
|
||||
|
||||
foreach ($this->fieldActionList as $i => $action) {
|
||||
if (!isset($row->$action)) continue;
|
||||
|
||||
$level = $row->$action;
|
||||
if (!isset($data->$scope->$field->$action)) {
|
||||
$data->$scope->$field->$action = $level;
|
||||
} else {
|
||||
if (array_search($data->$scope->$field->$action, $this->fieldLevelList) > array_search($level, $this->fieldLevelList)) {
|
||||
$data->$scope->$field->$action = $level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function buildCache()
|
||||
{
|
||||
$contents = '<' . '?'. 'php return ' . $this->varExport($this->data) . ';';
|
||||
$this->fileManager->putContents($this->cacheFilePath, $contents);
|
||||
}
|
||||
|
||||
private function varExport($variable)
|
||||
{
|
||||
if ($variable instanceof \StdClass) {
|
||||
$result = '(object) ' . $this->varExport(get_object_vars($variable), true);
|
||||
} else if (is_array($variable)) {
|
||||
$array = array();
|
||||
foreach ($variable as $key => $value) {
|
||||
$array[] = var_export($key, true).' => ' . $this->varExport($value, true);
|
||||
}
|
||||
$result = '['.implode(', ', $array).']';
|
||||
} else {
|
||||
$result = var_export($variable, true);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
274
application/Espo/Core/AclManager.php
Normal file
274
application/Espo/Core/AclManager.php
Normal file
@@ -0,0 +1,274 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
use \Espo\Entities\User;
|
||||
use \Espo\Core\Utils\Util;
|
||||
|
||||
class AclManager
|
||||
{
|
||||
private $container;
|
||||
|
||||
private $metadata;
|
||||
|
||||
private $implementationHashMap = array();
|
||||
|
||||
private $tableHashMap = array();
|
||||
|
||||
protected $tableClassName = '\\Espo\\Core\\Acl\\Table';
|
||||
|
||||
public function __construct(Container $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->metadata = $container->get('metadata');
|
||||
}
|
||||
|
||||
protected function getContainer()
|
||||
{
|
||||
return $this->container;
|
||||
}
|
||||
|
||||
protected function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
public function getImplementation($scope)
|
||||
{
|
||||
if (empty($this->implementationHashMap[$scope])) {
|
||||
$normalizedName = Util::normilizeClassName($scope);
|
||||
|
||||
$className = '\\Espo\\Custom\\Acl\\' . $normalizedName;
|
||||
if (!class_exists($className)) {
|
||||
$moduleName = $this->metadata->getScopeModuleName($scope);
|
||||
if ($moduleName) {
|
||||
$className = '\\Espo\\Modules\\' . $moduleName . '\\Acl\\' . $normalizedName;
|
||||
} else {
|
||||
$className = '\\Espo\\Acl\\' . $normalizedName;
|
||||
}
|
||||
if (!class_exists($className)) {
|
||||
$className = '\\Espo\\Core\\Acl\\Base';
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists($className)) {
|
||||
$acl = new $className($scope);
|
||||
$dependencies = $acl->getDependencyList();
|
||||
foreach ($dependencies as $name) {
|
||||
$acl->inject($name, $this->getContainer()->get($name));
|
||||
}
|
||||
$this->implementationHashMap[$scope] = $acl;
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->implementationHashMap[$scope];
|
||||
}
|
||||
|
||||
protected function getTable(User $user)
|
||||
{
|
||||
$key = $user->id;
|
||||
if (empty($key)) {
|
||||
$key = spl_object_hash($user);
|
||||
}
|
||||
|
||||
if (empty($this->tableHashMap[$key])) {
|
||||
$config = $this->getContainer()->get('config');
|
||||
$fileManager = $this->getContainer()->get('fileManager');
|
||||
$metadata = $this->getContainer()->get('metadata');
|
||||
$fieldManager = $this->getContainer()->get('fieldManager');
|
||||
|
||||
$this->tableHashMap[$key] = new $this->tableClassName($user, $config, $fileManager, $metadata, $fieldManager);
|
||||
}
|
||||
|
||||
return $this->tableHashMap[$key];
|
||||
}
|
||||
|
||||
public function getMap(User $user)
|
||||
{
|
||||
return $this->getTable($user)->getMap();
|
||||
}
|
||||
|
||||
public function getLevel(User $user, $scope, $action)
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return 'all';
|
||||
}
|
||||
return $this->getTable($user)->getLevel($scope, $action);
|
||||
}
|
||||
|
||||
public function get(User $user, $permission)
|
||||
{
|
||||
return $this->getTable($user)->get($permission);
|
||||
}
|
||||
|
||||
public function checkReadOnlyTeam(User $user, $scope)
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return false;
|
||||
}
|
||||
$data = $this->getTable($user)->getScopeData($scope);
|
||||
return $this->getImplementation($scope)->checkReadOnlyTeam($user, $data);
|
||||
}
|
||||
|
||||
public function checkReadOnlyOwn(User $user, $scope)
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return false;
|
||||
}
|
||||
$data = $this->getTable($user)->getScopeData($scope);
|
||||
return $this->getImplementation($scope)->checkReadOnlyOwn($user, $data);
|
||||
}
|
||||
|
||||
public function check(User $user, $subject, $action = null)
|
||||
{
|
||||
if (is_string($subject)) {
|
||||
return $this->checkScope($user, $subject, $action);
|
||||
} else {
|
||||
$entity = $subject;
|
||||
if ($entity instanceof Entity) {
|
||||
return $this->checkEntity($user, $entity, $action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function checkEntity(User $user, Entity $entity, $action = 'read')
|
||||
{
|
||||
$scope = $entity->getEntityType();
|
||||
|
||||
$data = $this->getTable($user)->getScopeData($scope);
|
||||
|
||||
$impl = $this->getImplementation($scope);
|
||||
|
||||
$methodName = 'checkEntity' . ucfirst($action);
|
||||
if (method_exists($impl, $methodName)) {
|
||||
return $impl->$methodName($user, $entity, $data);
|
||||
}
|
||||
|
||||
return $impl->checkEntity($user, $entity, $data, $action);
|
||||
}
|
||||
|
||||
public function checkIsOwner(User $user, Entity $entity)
|
||||
{
|
||||
return $this->getImplementation($entity->getEntityType())->checkIsOwner($user, $entity);
|
||||
}
|
||||
|
||||
public function checkInTeam(User $user, Entity $entity)
|
||||
{
|
||||
return $this->getImplementation($entity->getEntityType())->checkInTeam($user, $entity);
|
||||
}
|
||||
|
||||
public function checkScope(User $user, $scope, $action = null)
|
||||
{
|
||||
$data = $this->getTable($user)->getScopeData($scope);
|
||||
return $this->getImplementation($scope)->checkScope($user, $data, $action);
|
||||
}
|
||||
|
||||
public function checkUser(User $user, $permission, User $entity)
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
if ($this->get($user, $permission) === 'no') {
|
||||
if ($entity->id !== $user->id) {
|
||||
return false;
|
||||
}
|
||||
} else if ($this->get($user, $permission) === 'team') {
|
||||
if ($entity->id != $user->id) {
|
||||
$teamIdList1 = $user->getTeamIdList();
|
||||
$teamIdList2 = $entity->getTeamIdList();
|
||||
|
||||
$inTeam = false;
|
||||
foreach ($teamIdList1 as $id) {
|
||||
if (in_array($id, $teamIdList2)) {
|
||||
$inTeam = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$inTeam) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getScopeForbiddenAttributeList(User $user, $scope, $action = 'read', $thresholdLevel = 'no')
|
||||
{
|
||||
if ($user->isAdmin()) return [];
|
||||
return $this->getTable($user)->getScopeForbiddenAttributeList($scope, $action, $thresholdLevel);
|
||||
}
|
||||
|
||||
public function getScopeForbiddenFieldList(User $user, $scope, $action = 'read', $thresholdLevel = 'no')
|
||||
{
|
||||
if ($user->isAdmin()) return [];
|
||||
return $this->getTable($user)->getScopeForbiddenFieldList($scope, $action, $thresholdLevel);
|
||||
}
|
||||
|
||||
public function checkUserPermission(User $user, $target, $permissionType = 'userPermission')
|
||||
{
|
||||
$permission = $this->get($user, $permissionType);
|
||||
|
||||
if (is_object($target)) {
|
||||
$userId = $target->id;
|
||||
} else {
|
||||
$userId = $target;
|
||||
}
|
||||
|
||||
if ($user->id === $userId) return true;
|
||||
|
||||
if ($permission === 'no') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($permission === 'yes') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($permission === 'team') {
|
||||
$teamIdList = $user->getLinkMultipleIdList('teams');
|
||||
if (!$this->getContainer()->get('entityManager')->getRepository('User')->checkBelongsToAnyOfTeams($userId, $teamIdList)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkAssignmentPermission(User $user, $target)
|
||||
{
|
||||
return $this->checkUserPermission($user, $target, 'assignmentPermission');
|
||||
}
|
||||
}
|
||||
|
||||
212
application/Espo/Core/AclPortal/Base.php
Normal file
212
application/Espo/Core/AclPortal/Base.php
Normal file
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core\AclPortal;
|
||||
|
||||
use \Espo\Entities\User;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class Base extends \Espo\Core\Acl\Base
|
||||
{
|
||||
public function checkScope(User $user, $data, $action = null, Entity $entity = null, $entityAccessData = array())
|
||||
{
|
||||
if ($user->isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_null($data)) {
|
||||
return false;
|
||||
}
|
||||
if ($data === false) {
|
||||
return false;
|
||||
}
|
||||
if ($data === true) {
|
||||
return true;
|
||||
}
|
||||
if (is_string($data)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$isOwner = null;
|
||||
if (isset($entityAccessData['isOwner'])) {
|
||||
$isOwner = $entityAccessData['isOwner'];
|
||||
}
|
||||
$inAccount = null;
|
||||
if (isset($entityAccessData['inAccount'])) {
|
||||
$inAccount = $entityAccessData['inAccount'];
|
||||
}
|
||||
$isOwnContact = null;
|
||||
if (isset($entityAccessData['isOwnContact'])) {
|
||||
$isOwnContact = $entityAccessData['isOwnContact'];
|
||||
}
|
||||
|
||||
if (is_null($action)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isset($data->$action)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$value = $data->$action;
|
||||
|
||||
if ($value === 'all' || $value === 'yes' || $value === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$value || $value === 'no') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_null($isOwner)) {
|
||||
if ($entity) {
|
||||
$isOwner = $this->checkIsOwner($user, $entity);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($isOwner) {
|
||||
if ($value === 'own' || $value === 'account' || $value === 'contact') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($value === 'account') {
|
||||
if (is_null($inAccount) && $entity) {
|
||||
$inAccount = $this->checkInAccount($user, $entity);
|
||||
}
|
||||
if ($inAccount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($value === 'contact') {
|
||||
if (is_null($isOwnContact) && $entity) {
|
||||
$isOwnContact = $this->checkIsOwnContact($user, $entity);
|
||||
}
|
||||
if ($isOwnContact) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public function checkReadOnlyAccount(User $user, $data)
|
||||
{
|
||||
if (empty($data) || !is_object($data) || !isset($data->read)) {
|
||||
return false;
|
||||
}
|
||||
return $data->read === 'account';
|
||||
}
|
||||
|
||||
public function checkReadOnlyContact(User $user, $data)
|
||||
{
|
||||
if (empty($data) || !is_object($data) || !isset($data->read)) {
|
||||
return false;
|
||||
}
|
||||
return $data->read === 'contact';
|
||||
}
|
||||
|
||||
public function checkIsOwner(User $user, Entity $entity)
|
||||
{
|
||||
if ($entity->hasAttribute('createdById')) {
|
||||
if ($entity->has('createdById')) {
|
||||
if ($user->id === $entity->get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkInAccount(User $user, Entity $entity)
|
||||
{
|
||||
$accountIdList = $user->getLinkMultipleIdList('accounts');
|
||||
if (count($accountIdList)) {
|
||||
if ($entity->hasAttribute('accountId')) {
|
||||
if (in_array($entity->get('accountId'), $accountIdList)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($entity->hasRelation('accounts')) {
|
||||
$repository = $this->getEntityManager()->getRepository($entity->getEntityType());
|
||||
foreach ($accountIdList as $accountId) {
|
||||
if ($repository->isRelated($entity, 'accounts', $accountId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($entity->hasAttribute('parentId') && $entity->hasRelation('parent')) {
|
||||
if ($entity->get('parentType') === 'Account') {
|
||||
if (in_array($entity->get('parentId'), $accountIdList)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkIsOwnContact(User $user, Entity $entity)
|
||||
{
|
||||
$contactId = $user->get('contactId');
|
||||
if ($contactId) {
|
||||
if ($entity->hasAttribute('contactId')) {
|
||||
if ($entity->get('contactId') === $contactId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($entity->hasRelation('contacts')) {
|
||||
$repository = $this->getEntityManager()->getRepository($entity->getEntityType());
|
||||
if ($repository->isRelated($entity, 'contacts', $contactId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($entity->hasAttribute('parentId') && $entity->hasRelation('parent')) {
|
||||
if ($entity->get('parentType') === 'Contact') {
|
||||
if ($entity->get('parentId') === $contactId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
135
application/Espo/Core/AclPortal/Table.php
Normal file
135
application/Espo/Core/AclPortal/Table.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core\AclPortal;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
use \Espo\Entities\User;
|
||||
use \Espo\Entities\Portal;
|
||||
|
||||
use \Espo\Core\Utils\Config;
|
||||
use \Espo\Core\Utils\Metadata;
|
||||
use \Espo\Core\Utils\FieldManager;
|
||||
use \Espo\Core\Utils\File\Manager as FileManager;
|
||||
|
||||
class Table extends \Espo\Core\Acl\Table
|
||||
{
|
||||
protected $type = 'aclPortal';
|
||||
|
||||
protected $portal;
|
||||
|
||||
protected $defaultAclType = 'recordAllOwnNo';
|
||||
|
||||
protected $levelList = ['yes', 'all', 'account', 'contact', 'own', 'no'];
|
||||
|
||||
protected $valuePermissionList = [];
|
||||
|
||||
public function __construct(User $user, Portal $portal, Config $config = null, FileManager $fileManager = null, Metadata $metadata = null, FieldManager $fieldManager = null)
|
||||
{
|
||||
if (empty($portal)) {
|
||||
throw new Error("No portal was passed to AclPortal\\Table constructor.");
|
||||
}
|
||||
$this->portal = $portal;
|
||||
parent::__construct($user, $config, $fileManager, $metadata, $fieldManager);
|
||||
}
|
||||
|
||||
protected function getPortal()
|
||||
{
|
||||
return $this->portal;
|
||||
}
|
||||
|
||||
protected function initCacheFilePath()
|
||||
{
|
||||
$this->cacheFilePath = 'data/cache/application/acl-portal/'.$this->getPortal()->id.'/' . $this->getUser()->id . '.php';
|
||||
}
|
||||
|
||||
protected function getRoleList()
|
||||
{
|
||||
$roleList = [];
|
||||
|
||||
$userRoleList = $this->getUser()->get('portalRoles');
|
||||
if (!(is_array($userRoleList) || $userRoleList instanceof \Traversable)) {
|
||||
throw new Error();
|
||||
}
|
||||
foreach ($userRoleList as $role) {
|
||||
$roleList[] = $role;
|
||||
}
|
||||
|
||||
$portalRoleList = $this->getPortal()->get('portalRoles');
|
||||
if (!(is_array($portalRoleList) || $portalRoleList instanceof \Traversable)) {
|
||||
throw new Error();
|
||||
}
|
||||
foreach ($portalRoleList as $role) {
|
||||
$roleList[] = $role;
|
||||
}
|
||||
|
||||
return $roleList;
|
||||
}
|
||||
|
||||
protected function getScopeWithAclList()
|
||||
{
|
||||
$scopeList = [];
|
||||
$scopes = $this->getMetadata()->get('scopes');
|
||||
foreach ($scopes as $scope => $d) {
|
||||
if (empty($d['acl'])) continue;
|
||||
if (empty($d['aclPortal'])) continue;
|
||||
$scopeList[] = $scope;
|
||||
}
|
||||
return $scopeList;
|
||||
}
|
||||
|
||||
protected function applyDefault(&$table, &$fieldTable)
|
||||
{
|
||||
parent::applyDefault($table, $fieldTable);
|
||||
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
if (!isset($table->$scope)) {
|
||||
$table->$scope = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function applyDisabled(&$table, &$fieldTable)
|
||||
{
|
||||
foreach ($this->getScopeList() as $scope) {
|
||||
$d = $this->getMetadata()->get('scopes.' . $scope);
|
||||
if (!empty($d['disabled']) || !empty($d['portalDisabled'])) {
|
||||
$table->$scope = false;
|
||||
unset($fieldTable->$scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function applyAdditional(&$table, &$fieldTable, &$valuePermissionLists)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,31 +18,41 @@
|
||||
*
|
||||
* 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\Core;
|
||||
|
||||
|
||||
class Application
|
||||
{
|
||||
private $metadata;
|
||||
|
||||
private $container;
|
||||
protected $container;
|
||||
|
||||
private $slim;
|
||||
|
||||
private $auth;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->container = new Container();
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
$GLOBALS['log'] = $this->container->get('log');
|
||||
$this->initContainer();
|
||||
|
||||
$GLOBALS['log'] = $this->getContainer()->get('log');
|
||||
|
||||
$this->initAutoloads();
|
||||
}
|
||||
|
||||
protected function initContainer()
|
||||
{
|
||||
$this->container = new Container();
|
||||
}
|
||||
|
||||
public function getSlim()
|
||||
@@ -61,12 +71,9 @@ class Application
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
protected function getAuth()
|
||||
protected function createAuth()
|
||||
{
|
||||
if (empty($this->auth)) {
|
||||
$this->auth = new \Espo\Core\Utils\Auth($this->container);
|
||||
}
|
||||
return $this->auth;
|
||||
return new \Espo\Core\Utils\Auth($this->container);
|
||||
}
|
||||
|
||||
public function getContainer()
|
||||
@@ -83,16 +90,10 @@ class Application
|
||||
|
||||
public function runClient()
|
||||
{
|
||||
$config = $this->getContainer()->get('config');
|
||||
|
||||
$html = file_get_contents('main.html');
|
||||
$html = str_replace('{{cacheTimestamp}}', $config->get('cacheTimestamp', 0), $html);
|
||||
$html = str_replace('{{useCache}}', $config->get('useCache') ? 'true' : 'false' , $html);
|
||||
echo $html;
|
||||
exit;
|
||||
$this->getContainer()->get('clientManager')->display();
|
||||
}
|
||||
|
||||
public function runEntryPoint($entryPoint)
|
||||
public function runEntryPoint($entryPoint, $data = array(), $final = false)
|
||||
{
|
||||
if (empty($entryPoint)) {
|
||||
throw new \Error();
|
||||
@@ -101,28 +102,38 @@ class Application
|
||||
$slim = $this->getSlim();
|
||||
$container = $this->getContainer();
|
||||
|
||||
$slim->get('/', function() {});
|
||||
$slim->any('.*', function() {});
|
||||
|
||||
$entryPointManager = new \Espo\Core\EntryPointManager($container);
|
||||
|
||||
$auth = $this->getAuth();
|
||||
$apiAuth = new \Espo\Core\Utils\Api\Auth($auth, $entryPointManager->checkAuthRequired($entryPoint), true);
|
||||
$slim->add($apiAuth);
|
||||
|
||||
$slim->hook('slim.before.dispatch', function () use ($entryPoint, $entryPointManager, $container) {
|
||||
try {
|
||||
$entryPointManager->run($entryPoint);
|
||||
} catch (\Exception $e) {
|
||||
$container->get('output')->processError($e->getMessage(), $e->getCode(), true);
|
||||
try {
|
||||
$authRequired = $entryPointManager->checkAuthRequired($entryPoint);
|
||||
$authNotStrict = $entryPointManager->checkNotStrictAuth($entryPoint);
|
||||
if ($authRequired && !$authNotStrict) {
|
||||
if (!$final && $portalId = $this->detectedPortalId()) {
|
||||
$app = new \Espo\Core\Portal\Application($portalId);
|
||||
$app->setBasePath($this->getBasePath());
|
||||
$app->runEntryPoint($entryPoint, $data, true);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
});
|
||||
$auth = new \Espo\Core\Utils\Auth($this->container, $authNotStrict);
|
||||
$apiAuth = new \Espo\Core\Utils\Api\Auth($auth, $authRequired, true);
|
||||
$slim->add($apiAuth);
|
||||
|
||||
$slim->run();
|
||||
$slim->hook('slim.before.dispatch', function () use ($entryPoint, $entryPointManager, $container, $data) {
|
||||
$entryPointManager->run($entryPoint, $data);
|
||||
});
|
||||
|
||||
$slim->run();
|
||||
} catch (\Exception $e) {
|
||||
$container->get('output')->processError($e->getMessage(), $e->getCode(), true);
|
||||
}
|
||||
}
|
||||
|
||||
public function runCron()
|
||||
{
|
||||
$auth = $this->getAuth();
|
||||
$auth = $this->createAuth();
|
||||
$auth->useNoAuth(true);
|
||||
|
||||
$cronManager = new \Espo\Core\CronManager($this->container);
|
||||
@@ -135,6 +146,12 @@ class Application
|
||||
$dataManager->rebuild();
|
||||
}
|
||||
|
||||
public function runClearCache()
|
||||
{
|
||||
$dataManager = $this->getContainer()->get('dataManager');
|
||||
$dataManager->clearCache();
|
||||
}
|
||||
|
||||
public function isInstalled()
|
||||
{
|
||||
$config = $this->getContainer()->get('config');
|
||||
@@ -146,16 +163,25 @@ class Application
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function createApiAuth($auth)
|
||||
{
|
||||
return new \Espo\Core\Utils\Api\Auth($auth);
|
||||
}
|
||||
|
||||
protected function routeHooks()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$slim = $this->getSlim();
|
||||
|
||||
$auth = $this->getAuth();
|
||||
try {
|
||||
$auth = $this->createAuth();
|
||||
} catch (\Exception $e) {
|
||||
$container->get('output')->processError($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$apiAuth = $this->createApiAuth($auth);
|
||||
|
||||
$apiAuth = new \Espo\Core\Utils\Api\Auth($auth);
|
||||
$this->getSlim()->add($apiAuth);
|
||||
|
||||
$this->getSlim()->hook('slim.before.dispatch', function () use ($slim, $container) {
|
||||
|
||||
$route = $slim->router()->getCurrentRoute();
|
||||
@@ -215,14 +241,19 @@ class Application
|
||||
});
|
||||
}
|
||||
|
||||
protected function getRouteList()
|
||||
{
|
||||
$routes = new \Espo\Core\Utils\Route($this->getContainer()->get('config'), $this->getMetadata(), $this->getContainer()->get('fileManager'));
|
||||
|
||||
|
||||
return $routes->getAll();
|
||||
}
|
||||
|
||||
protected function initRoutes()
|
||||
{
|
||||
$routes = new \Espo\Core\Utils\Route($this->getContainer()->get('config'), $this->getMetadata(), $this->getContainer()->get('fileManager'));
|
||||
$crudList = array_keys( $this->getContainer()->get('config')->get('crud') );
|
||||
|
||||
foreach ($routes->getAll() as $route) {
|
||||
$crudList = array_keys($this->getContainer()->get('config')->get('crud'));
|
||||
|
||||
foreach ($this->getRouteList() as $route) {
|
||||
$method = strtolower($route['method']);
|
||||
if (!in_array($method, $crudList)) {
|
||||
$GLOBALS['log']->error('Route: Method ['.$method.'] does not exist. Please check your route ['.$route['route'].']');
|
||||
@@ -238,5 +269,66 @@ class Application
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function initAutoloads()
|
||||
{
|
||||
$autoload = new \Espo\Core\Utils\Autoload($this->getContainer()->get('config'), $this->getMetadata(), $this->getContainer()->get('fileManager'));
|
||||
|
||||
try {
|
||||
$autoloadList = $autoload->getAll();
|
||||
} catch (\Exception $e) {} //bad permissions
|
||||
|
||||
if (empty($autoloadList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$namespacesPath = 'vendor/composer/autoload_namespaces.php';
|
||||
$existingNamespaces = file_exists($namespacesPath) ? include($namespacesPath) : array();
|
||||
if (!empty($existingNamespaces) && is_array($existingNamespaces)) {
|
||||
$existingNamespaces = array_keys($existingNamespaces);
|
||||
}
|
||||
|
||||
$classLoader = new \Composer\Autoload\ClassLoader();
|
||||
|
||||
foreach ($autoloadList as $prefix => $path) {
|
||||
if (!in_array($prefix, $existingNamespaces)) {
|
||||
$classLoader->add($prefix, $path);
|
||||
}
|
||||
}
|
||||
|
||||
$classLoader->register(true);
|
||||
}
|
||||
|
||||
public function setBasePath($basePath)
|
||||
{
|
||||
$this->getContainer()->get('clientManager')->setBasePath($basePath);
|
||||
}
|
||||
|
||||
public function getBasePath()
|
||||
{
|
||||
return $this->getContainer()->get('clientManager')->getBasePath();
|
||||
}
|
||||
|
||||
public function detectedPortalId()
|
||||
{
|
||||
if (!empty($_GET['portalId'])) {
|
||||
return $_GET['portalId'];
|
||||
}
|
||||
if (!empty($_COOKIE['auth-token'])) {
|
||||
$token = $this->getContainer()->get('entityManager')->getRepository('AuthToken')->where(array('token' => $_COOKIE['auth-token']))->findOne();
|
||||
|
||||
if ($token && $token->get('portalId')) {
|
||||
return $token->get('portalId');
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setupSystemUser()
|
||||
{
|
||||
$user = $this->getContainer()->get('entityManager')->getEntity('User', 'system');
|
||||
$this->getContainer()->setUser($user);
|
||||
$this->getContainer()->get('entityManager')->setUser($user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core;
|
||||
@@ -33,7 +40,6 @@ class Container
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function get($name)
|
||||
@@ -41,7 +47,15 @@ class Container
|
||||
if (empty($this->data[$name])) {
|
||||
$this->load($name);
|
||||
}
|
||||
return $this->data[$name];
|
||||
if (isset($this->data[$name])) {
|
||||
return $this->data[$name];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function set($name, $obj)
|
||||
{
|
||||
$this->data[$name] = $obj;
|
||||
}
|
||||
|
||||
private function load($name)
|
||||
@@ -51,9 +65,16 @@ class Container
|
||||
$obj = $this->$loadMethod();
|
||||
$this->data[$name] = $obj;
|
||||
} else {
|
||||
$className = '\Espo\Custom\Core\Loaders\\'.ucfirst($name);
|
||||
if (!class_exists($className)) {
|
||||
$className = '\Espo\Core\Loaders\\'.ucfirst($name);
|
||||
|
||||
try {
|
||||
$className = $this->get('metadata')->get('app.loaders.' . ucfirst($name));
|
||||
} catch (\Exception $e) {}
|
||||
|
||||
if (!isset($className) || !class_exists($className)) {
|
||||
$className = '\Espo\Custom\Core\Loaders\\'.ucfirst($name);
|
||||
if (!class_exists($className)) {
|
||||
$className = '\Espo\Core\Loaders\\'.ucfirst($name);
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists($className)) {
|
||||
@@ -64,7 +85,7 @@ class Container
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
protected function getServiceClassName($name, $default)
|
||||
{
|
||||
$metadata = $this->get('metadata');
|
||||
@@ -72,58 +93,84 @@ class Container
|
||||
return $className;
|
||||
}
|
||||
|
||||
protected function loadLog()
|
||||
{
|
||||
$config = $this->get('config');
|
||||
|
||||
$path = $config->get('logger.path', 'data/logs/espo.log');
|
||||
$rotation = $config->get('logger.rotation', true);
|
||||
|
||||
$log = new \Espo\Core\Utils\Log('Espo');
|
||||
$levelCode = $log->getLevelCode($config->get('logger.level', 'WARNING'));
|
||||
|
||||
if ($rotation) {
|
||||
$maxFileNumber = $config->get('logger.maxFileNumber', 30);
|
||||
$handler = new \Espo\Core\Utils\Log\Monolog\Handler\RotatingFileHandler($path, $maxFileNumber, $levelCode);
|
||||
} else {
|
||||
$handler = new \Espo\Core\Utils\Log\Monolog\Handler\StreamHandler($path, $levelCode);
|
||||
}
|
||||
$log->pushHandler($handler);
|
||||
|
||||
$errorHandler = new \Monolog\ErrorHandler($log);
|
||||
$errorHandler->registerExceptionHandler(null, false);
|
||||
$errorHandler->registerErrorHandler(array(), false);
|
||||
|
||||
return $log;
|
||||
}
|
||||
|
||||
protected function loadContainer()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function loadSlim()
|
||||
protected function loadSlim()
|
||||
{
|
||||
return new \Espo\Core\Utils\Api\Slim();
|
||||
}
|
||||
|
||||
private function loadFileManager()
|
||||
protected function loadFileManager()
|
||||
{
|
||||
return new \Espo\Core\Utils\File\Manager(
|
||||
$this->get('config')
|
||||
);
|
||||
}
|
||||
|
||||
private function loadPreferences()
|
||||
protected function loadPreferences()
|
||||
{
|
||||
return $this->get('entityManager')->getEntity('Preferences', $this->get('user')->id);
|
||||
}
|
||||
|
||||
private function loadConfig()
|
||||
protected function loadConfig()
|
||||
{
|
||||
return new \Espo\Core\Utils\Config(
|
||||
new \Espo\Core\Utils\File\Manager()
|
||||
);
|
||||
}
|
||||
|
||||
private function loadHookManager()
|
||||
protected function loadHookManager()
|
||||
{
|
||||
return new \Espo\Core\HookManager(
|
||||
$this
|
||||
);
|
||||
}
|
||||
|
||||
private function loadOutput()
|
||||
protected function loadOutput()
|
||||
{
|
||||
return new \Espo\Core\Utils\Api\Output(
|
||||
$this->get('slim')
|
||||
);
|
||||
}
|
||||
|
||||
private function loadMailSender()
|
||||
protected function loadMailSender()
|
||||
{
|
||||
$className = $this->getServiceClassName('mailSernder', '\\Espo\\Core\\Mail\\Sender');
|
||||
return new $className(
|
||||
$this->get('config')
|
||||
$this->get('config'),
|
||||
$this->get('entityManager')
|
||||
);
|
||||
}
|
||||
|
||||
private function loadDateTime()
|
||||
protected function loadDateTime()
|
||||
{
|
||||
return new \Espo\Core\Utils\DateTime(
|
||||
$this->get('config')->get('dateFormat'),
|
||||
@@ -132,24 +179,34 @@ class Container
|
||||
);
|
||||
}
|
||||
|
||||
private function loadServiceFactory()
|
||||
protected function loadNumber()
|
||||
{
|
||||
return new \Espo\Core\Utils\Number(
|
||||
$this->get('config')->get('decimalMark'),
|
||||
$this->get('config')->get('thousandSeparator')
|
||||
);
|
||||
}
|
||||
|
||||
protected function loadServiceFactory()
|
||||
{
|
||||
return new \Espo\Core\ServiceFactory(
|
||||
$this
|
||||
);
|
||||
}
|
||||
|
||||
private function loadSelectManagerFactory()
|
||||
protected function loadSelectManagerFactory()
|
||||
{
|
||||
return new \Espo\Core\SelectManagerFactory(
|
||||
$this->get('entityManager'),
|
||||
$this->get('user'),
|
||||
$this->get('acl'),
|
||||
$this->get('metadata')
|
||||
$this->get('aclManager'),
|
||||
$this->get('metadata'),
|
||||
$this->get('config')
|
||||
);
|
||||
}
|
||||
|
||||
private function loadMetadata()
|
||||
protected function loadMetadata()
|
||||
{
|
||||
return new \Espo\Core\Utils\Metadata(
|
||||
$this->get('config'),
|
||||
@@ -157,26 +214,33 @@ class Container
|
||||
);
|
||||
}
|
||||
|
||||
private function loadLayout()
|
||||
protected function loadLayout()
|
||||
{
|
||||
return new \Espo\Core\Utils\Layout(
|
||||
$this->get('fileManager'),
|
||||
$this->get('metadata')
|
||||
$this->get('metadata'),
|
||||
$this->get('user')
|
||||
);
|
||||
}
|
||||
|
||||
private function loadAcl()
|
||||
protected function loadAclManager()
|
||||
{
|
||||
$className = $this->getServiceClassName('acl', '\\Espo\\Core\\AclManager');
|
||||
return new $className(
|
||||
$this->get('container')
|
||||
);
|
||||
}
|
||||
|
||||
protected function loadAcl()
|
||||
{
|
||||
$className = $this->getServiceClassName('acl', '\\Espo\\Core\\Acl');
|
||||
return new $className(
|
||||
$this->get('user'),
|
||||
$this->get('config'),
|
||||
$this->get('fileManager'),
|
||||
$this->get('metadata')
|
||||
$this->get('aclManager'),
|
||||
$this->get('user')
|
||||
);
|
||||
}
|
||||
|
||||
private function loadSchema()
|
||||
protected function loadSchema()
|
||||
{
|
||||
return new \Espo\Core\Utils\Database\Schema\Schema(
|
||||
$this->get('config'),
|
||||
@@ -187,7 +251,7 @@ class Container
|
||||
);
|
||||
}
|
||||
|
||||
private function loadClassParser()
|
||||
protected function loadClassParser()
|
||||
{
|
||||
return new \Espo\Core\Utils\File\ClassParser(
|
||||
$this->get('fileManager'),
|
||||
@@ -196,47 +260,65 @@ class Container
|
||||
);
|
||||
}
|
||||
|
||||
private function loadLanguage()
|
||||
protected function loadLanguage()
|
||||
{
|
||||
return new \Espo\Core\Utils\Language(
|
||||
$this->get('fileManager'),
|
||||
$this->get('config'),
|
||||
$this->get('metadata'),
|
||||
$this->get('preferences')
|
||||
);
|
||||
}
|
||||
|
||||
private function loadCrypt()
|
||||
|
||||
protected function loadCrypt()
|
||||
{
|
||||
return new \Espo\Core\Utils\Crypt(
|
||||
$this->get('config')
|
||||
);
|
||||
}
|
||||
|
||||
private function loadScheduledJob()
|
||||
protected function loadScheduledJob()
|
||||
{
|
||||
return new \Espo\Core\Cron\ScheduledJob(
|
||||
return new \Espo\Core\Utils\ScheduledJob(
|
||||
$this
|
||||
);
|
||||
}
|
||||
|
||||
private function loadDataManager()
|
||||
protected function loadDataManager()
|
||||
{
|
||||
return new \Espo\Core\DataManager(
|
||||
$this
|
||||
);
|
||||
}
|
||||
|
||||
private function loadFieldManager()
|
||||
protected function loadFieldManager()
|
||||
{
|
||||
return new \Espo\Core\Utils\FieldManager(
|
||||
$this->get('metadata'),
|
||||
$this->get('language')
|
||||
$this->get('language'),
|
||||
$this
|
||||
);
|
||||
}
|
||||
|
||||
public function setUser($user)
|
||||
protected function loadThemeManager()
|
||||
{
|
||||
$this->data['user'] = $user;
|
||||
return new \Espo\Core\Utils\ThemeManager(
|
||||
$this->get('config'),
|
||||
$this->get('metadata')
|
||||
);
|
||||
}
|
||||
|
||||
protected function loadClientManager()
|
||||
{
|
||||
return new \Espo\Core\Utils\ClientManager(
|
||||
$this->get('config'),
|
||||
$this->get('themeManager')
|
||||
);
|
||||
}
|
||||
|
||||
public function setUser(\Espo\Entities\User $user)
|
||||
{
|
||||
$this->set('user', $user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core;
|
||||
@@ -87,23 +94,32 @@ class ControllerManager
|
||||
$actionNameUcfirst = ucfirst($actionName);
|
||||
|
||||
$beforeMethodName = 'before' . $actionNameUcfirst;
|
||||
$actionMethodName = 'action' . $actionNameUcfirst;
|
||||
$afterMethodName = 'after' . $actionNameUcfirst;
|
||||
|
||||
$fullActionMethodName = strtolower($request->getMethod()) . ucfirst($actionMethodName);
|
||||
|
||||
if (method_exists($controller, $fullActionMethodName)) {
|
||||
$primaryActionMethodName = $fullActionMethodName;
|
||||
} else {
|
||||
$primaryActionMethodName = $actionMethodName;
|
||||
}
|
||||
|
||||
if (!method_exists($controller, $primaryActionMethodName)) {
|
||||
throw new NotFound("Action '$actionName' (".$request->getMethod().") does not exist in controller '$controllerName'");
|
||||
}
|
||||
|
||||
if (method_exists($controller, $beforeMethodName)) {
|
||||
$controller->$beforeMethodName($params, $data, $request);
|
||||
}
|
||||
$actionMethodName = 'action' . $actionNameUcfirst;
|
||||
|
||||
if (!method_exists($controller, $actionMethodName)) {
|
||||
throw new NotFound("Action '$actionMethodName' does not exist in controller '$controller'");
|
||||
}
|
||||
$result = $controller->$primaryActionMethodName($params, $data, $request);
|
||||
|
||||
$result = $controller->$actionMethodName($params, $data, $request);
|
||||
|
||||
$afterMethodName = 'after' . $actionNameUcfirst;
|
||||
if (method_exists($controller, $afterMethodName)) {
|
||||
$controller->$afterMethodName($params, $data, $request);
|
||||
}
|
||||
|
||||
if (is_array($result) || is_bool($result)) {
|
||||
if (is_array($result) || is_bool($result) || $result instanceof \StdClass) {
|
||||
return \Espo\Core\Utils\Json::encode($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* 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\Core\Controllers;
|
||||
|
||||
use \Espo\Core\Container;
|
||||
use \Espo\Core\ServiceFactory;
|
||||
use \Espo\Core\Utils\Util;
|
||||
@@ -90,6 +96,11 @@ abstract class Base
|
||||
return $this->container->get('acl');
|
||||
}
|
||||
|
||||
protected function getAclManager()
|
||||
{
|
||||
return $this->container->get('aclManager');
|
||||
}
|
||||
|
||||
protected function getConfig()
|
||||
{
|
||||
return $this->container->get('config');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Controllers;
|
||||
@@ -25,6 +32,7 @@ namespace Espo\Core\Controllers;
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
use \Espo\Core\Utils\Util;
|
||||
|
||||
class Record extends Base
|
||||
@@ -33,6 +41,8 @@ class Record extends Base
|
||||
|
||||
public static $defaultAction = 'list';
|
||||
|
||||
protected $defaultRecordServiceName = 'Record';
|
||||
|
||||
protected function getEntityManager()
|
||||
{
|
||||
return $this->getContainer()->get('entityManager');
|
||||
@@ -47,14 +57,14 @@ class Record extends Base
|
||||
if ($this->getServiceFactory()->checkExists($name)) {
|
||||
$service = $this->getServiceFactory()->create($name);
|
||||
} else {
|
||||
$service = $this->getServiceFactory()->create('Record');
|
||||
$service->setEntityName($name);
|
||||
$service = $this->getServiceFactory()->create($this->defaultRecordServiceName);
|
||||
$service->setEntityType($name);
|
||||
}
|
||||
|
||||
return $service;
|
||||
}
|
||||
|
||||
public function actionRead($params)
|
||||
public function actionRead($params, $data, $request)
|
||||
{
|
||||
$id = $params['id'];
|
||||
$entity = $this->getRecordService()->getEntity($id);
|
||||
@@ -66,14 +76,18 @@ class Record extends Base
|
||||
return $entity->toArray();
|
||||
}
|
||||
|
||||
public function actionPatch($params, $data)
|
||||
public function actionPatch($params, $data, $request)
|
||||
{
|
||||
return $this->actionUpdate($params, $data);
|
||||
return $this->actionUpdate($params, $data, $request);
|
||||
}
|
||||
|
||||
public function actionCreate($params, $data)
|
||||
public function actionCreate($params, $data, $request)
|
||||
{
|
||||
if (!$this->getAcl()->check($this->name, 'edit')) {
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (!$this->getAcl()->check($this->name, 'create')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
@@ -86,8 +100,12 @@ class Record extends Base
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
public function actionUpdate($params, $data)
|
||||
public function actionUpdate($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPut() && !$request->isPatch()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (!$this->getAcl()->check($this->name, 'edit')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
@@ -110,32 +128,48 @@ class Record extends Base
|
||||
$where = $request->get('where');
|
||||
$offset = $request->get('offset');
|
||||
$maxSize = $request->get('maxSize');
|
||||
$asc = $request->get('asc') === 'true';
|
||||
$asc = $request->get('asc', 'true') === 'true';
|
||||
$sortBy = $request->get('sortBy');
|
||||
$q = $request->get('q');
|
||||
$textFilter = $request->get('textFilter');
|
||||
|
||||
if (empty($maxSize)) {
|
||||
$maxSize = self::MAX_SIZE_LIMIT;
|
||||
}
|
||||
if (!empty($maxSize) && $maxSize > self::MAX_SIZE_LIMIT) {
|
||||
throw new Forbidden();
|
||||
throw new Forbidden("Max should should not exceed " . self::MAX_SIZE_LIMIT . ". Use pagination (offset, limit).");
|
||||
}
|
||||
|
||||
$result = $this->getRecordService()->findEntities(array(
|
||||
$params = array(
|
||||
'where' => $where,
|
||||
'offset' => $offset,
|
||||
'maxSize' => $maxSize,
|
||||
'asc' => $asc,
|
||||
'sortBy' => $sortBy,
|
||||
'q' => $q,
|
||||
));
|
||||
'textFilter' => $textFilter
|
||||
);
|
||||
|
||||
$this->fetchListParamsFromRequest($params, $request, $data);
|
||||
|
||||
$result = $this->getRecordService()->findEntities($params);
|
||||
|
||||
return array(
|
||||
'total' => $result['total'],
|
||||
'list' => $result['collection']->toArray()
|
||||
'list' => isset($result['collection']) ? $result['collection']->toArray() : $result['list']
|
||||
);
|
||||
}
|
||||
|
||||
protected function fetchListParamsFromRequest(&$params, $request, $data)
|
||||
{
|
||||
if ($request->get('primaryFilter')) {
|
||||
$params['primaryFilter'] = $request->get('primaryFilter');
|
||||
}
|
||||
if ($request->get('boolFilterList')) {
|
||||
$params['boolFilterList'] = $request->get('boolFilterList');
|
||||
}
|
||||
}
|
||||
|
||||
public function actionListLinked($params, $data, $request)
|
||||
{
|
||||
$id = $params['id'];
|
||||
@@ -144,9 +178,10 @@ class Record extends Base
|
||||
$where = $request->get('where');
|
||||
$offset = $request->get('offset');
|
||||
$maxSize = $request->get('maxSize');
|
||||
$asc = $request->get('asc') === 'true';
|
||||
$asc = $request->get('asc', 'true') === 'true';
|
||||
$sortBy = $request->get('sortBy');
|
||||
$q = $request->get('q');
|
||||
$textFilter = $request->get('textFilter');
|
||||
|
||||
if (empty($maxSize)) {
|
||||
$maxSize = self::MAX_SIZE_LIMIT;
|
||||
@@ -155,24 +190,32 @@ class Record extends Base
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$result = $this->getRecordService()->findLinkedEntities($id, $link, array(
|
||||
$params = array(
|
||||
'where' => $where,
|
||||
'offset' => $offset,
|
||||
'maxSize' => $maxSize,
|
||||
'asc' => $asc,
|
||||
'sortBy' => $sortBy,
|
||||
'q' => $q,
|
||||
));
|
||||
'textFilter' => $textFilter
|
||||
);
|
||||
|
||||
$this->fetchListParamsFromRequest($params, $request, $data);
|
||||
|
||||
$result = $this->getRecordService()->findLinkedEntities($id, $link, $params);
|
||||
|
||||
return array(
|
||||
'total' => $result['total'],
|
||||
'list' => $result['collection']->toArray()
|
||||
'list' => isset($result['collection']) ? $result['collection']->toArray() : $result['list']
|
||||
);
|
||||
}
|
||||
|
||||
public function actionDelete($params)
|
||||
public function actionDelete($params, $data, $request)
|
||||
{
|
||||
if (!$request->isDelete()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$id = $params['id'];
|
||||
|
||||
if ($this->getRecordService()->deleteEntity($id)) {
|
||||
@@ -183,7 +226,7 @@ class Record extends Base
|
||||
|
||||
public function actionExport($params, $data, $request)
|
||||
{
|
||||
if ($this->getConfig()->get('disableExport') && !$this->getUser()->isAdmin()) {
|
||||
if ($this->getConfig()->get('exportDisabled') && !$this->getUser()->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
@@ -193,74 +236,141 @@ class Record extends Base
|
||||
|
||||
$ids = $request->get('ids');
|
||||
$where = $request->get('where');
|
||||
$byWhere = $request->get('byWhere');
|
||||
$selectData = $request->get('selectData');
|
||||
|
||||
$params = array();
|
||||
if ($byWhere) {
|
||||
$params['selectData'] = $selectData;
|
||||
$params['where'] = $where;
|
||||
} else {
|
||||
$params['ids'] = $ids;
|
||||
}
|
||||
|
||||
return array(
|
||||
'id' => $this->getRecordService()->export($ids, $where)
|
||||
'id' => $this->getRecordService()->export($params)
|
||||
);
|
||||
}
|
||||
|
||||
public function actionMassUpdate($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPut()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (!$this->getAcl()->check($this->name, 'edit')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
if (empty($data['attributes'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$params = array();
|
||||
if (array_key_exists('where', $data) && !empty($data['byWhere'])) {
|
||||
$params['where'] = json_decode(json_encode($data['where']), true);
|
||||
if (array_key_exists('selectData', $data)) {
|
||||
$params['selectData'] = json_decode(json_encode($data['selectData']), true);
|
||||
}
|
||||
} else if (array_key_exists('ids', $data)) {
|
||||
$params['ids'] = $data['ids'];
|
||||
}
|
||||
|
||||
$ids = $data['ids'];
|
||||
$where = $data['where'];
|
||||
$attributes = $data['attributes'];
|
||||
|
||||
$idsUpdated = $this->getRecordService()->massUpdate($attributes, $ids, $where);
|
||||
$idsUpdated = $this->getRecordService()->massUpdate($attributes, $params);
|
||||
|
||||
return $idsUpdated;
|
||||
}
|
||||
|
||||
public function actionMassDelete($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
if (!$this->getAcl()->check($this->name, 'delete')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$ids = $data['ids'];
|
||||
$where = $data['where'];
|
||||
$params = array();
|
||||
if (array_key_exists('where', $data) && !empty($data['byWhere'])) {
|
||||
$where = json_decode(json_encode($data['where']), true);
|
||||
$params['where'] = $where;
|
||||
if (array_key_exists('selectData', $data)) {
|
||||
$params['selectData'] = json_decode(json_encode($data['selectData']), true);
|
||||
}
|
||||
}
|
||||
if (array_key_exists('ids', $data)) {
|
||||
$params['ids'] = $data['ids'];
|
||||
}
|
||||
|
||||
$idsRemoved = $this->getRecordService()->massRemove($ids, $where);
|
||||
$idsRemoved = $this->getRecordService()->massRemove($params);
|
||||
|
||||
return $idsRemoved;
|
||||
}
|
||||
|
||||
public function actionCreateLink($params, $data)
|
||||
public function actionCreateLink($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (empty($params['id']) || empty($params['link'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$id = $params['id'];
|
||||
$link = $params['link'];
|
||||
|
||||
$foreignIds = array();
|
||||
if (isset($data['id'])) {
|
||||
$foreignIds[] = $data['id'];
|
||||
}
|
||||
if (isset($data['ids']) && is_array($data['ids'])) {
|
||||
foreach ($data['ids'] as $foreignId) {
|
||||
$foreignIds[] = $foreignId;
|
||||
if (!empty($data['massRelate'])) {
|
||||
if (!is_array($data['where'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
}
|
||||
$where = json_decode(json_encode($data['where']), true);
|
||||
|
||||
$result = false;
|
||||
foreach ($foreignIds as $foreignId) {
|
||||
if ($this->getRecordService()->linkEntity($id, $link, $foreignId)) {
|
||||
$result = $result || true;
|
||||
$selectData = null;
|
||||
if (isset($data['selectData']) && is_array($data['selectData'])) {
|
||||
$selectData = json_decode(json_encode($data['selectData']), true);
|
||||
}
|
||||
|
||||
return $this->getRecordService()->linkEntityMass($id, $link, $where, $selectData);
|
||||
} else {
|
||||
$foreignIdList = array();
|
||||
if (isset($data['id'])) {
|
||||
$foreignIdList[] = $data['id'];
|
||||
}
|
||||
if (isset($data['ids']) && is_array($data['ids'])) {
|
||||
foreach ($data['ids'] as $foreignId) {
|
||||
$foreignIdList[] = $foreignId;
|
||||
}
|
||||
}
|
||||
|
||||
$result = false;
|
||||
foreach ($foreignIdList as $foreignId) {
|
||||
if ($this->getRecordService()->linkEntity($id, $link, $foreignId)) {
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
public function actionRemoveLink($params, $data)
|
||||
public function actionRemoveLink($params, $data, $request)
|
||||
{
|
||||
if (!$request->isDelete()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$id = $params['id'];
|
||||
$link = $params['link'];
|
||||
|
||||
if (empty($params['id']) || empty($params['link'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$foreignIds = array();
|
||||
if (isset($data['id'])) {
|
||||
$foreignIds[] = $data['id'];
|
||||
@@ -284,22 +394,64 @@ class Record extends Base
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
public function actionFollow($params)
|
||||
public function actionFollow($params, $data, $request)
|
||||
{
|
||||
if (!$this->getAcl()->check($this->name, 'read')) {
|
||||
if (!$request->isPut()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
if (!$this->getAcl()->check($this->name, 'stream')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
$id = $params['id'];
|
||||
return $this->getRecordService()->follow($id);
|
||||
}
|
||||
|
||||
public function actionUnfollow($params)
|
||||
public function actionUnfollow($params, $data, $request)
|
||||
{
|
||||
if (!$request->isDelete()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
if (!$this->getAcl()->check($this->name, 'read')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
$id = $params['id'];
|
||||
return $this->getRecordService()->unfollow($id);
|
||||
}
|
||||
|
||||
public function actionMerge($params, $data, $request)
|
||||
{
|
||||
if (!$request->isPost()) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (empty($data['targetId']) || empty($data['sourceIds']) || !is_array($data['sourceIds']) || !($data['attributes'] instanceof \StdClass)) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
$targetId = $data['targetId'];
|
||||
$sourceIds = $data['sourceIds'];
|
||||
$attributes = get_object_vars($data['attributes']);
|
||||
|
||||
if (!$this->getAcl()->check($this->name, 'edit')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
return $this->getRecordService()->merge($targetId, $sourceIds, $attributes);
|
||||
}
|
||||
|
||||
public function postActionGetDuplicateAttributes($params, $data, $request)
|
||||
{
|
||||
if (empty($data['id'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
if (!$this->getAcl()->check($this->name, 'create')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
if (!$this->getAcl()->check($this->name, 'read')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
return $this->getRecordService()->getDuplicateAttributes($data['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
65
application/Espo/Core/Controllers/RecordTree.php
Normal file
65
application/Espo/Core/Controllers/RecordTree.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
use \Espo\Core\Exceptions\BadRequest;
|
||||
use \Espo\Core\Utils\Util;
|
||||
|
||||
class RecordTree extends Record
|
||||
{
|
||||
public static $defaultAction = 'list';
|
||||
|
||||
protected $defaultRecordServiceName = 'RecordTree';
|
||||
|
||||
public function actionListTree($params, $data, $request)
|
||||
{
|
||||
if (!$this->getAcl()->check($this->name, 'read')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$where = $request->get('where');
|
||||
$parentId = $request->get('parentId');
|
||||
$maxDepth = $request->get('maxDepth');
|
||||
$onlyNotEmpty = $request->get('onlyNotEmpty');
|
||||
|
||||
$collection = $this->getRecordService()->getTree($parentId, array(
|
||||
'where' => $where,
|
||||
'onlyNotEmpty' => $onlyNotEmpty
|
||||
), 0, $maxDepth);
|
||||
return array(
|
||||
'list' => $collection->toArray(),
|
||||
'path' => $this->getRecordService()->getTreeItemPath($parentId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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/.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Cron;
|
||||
|
||||
use Espo\Core\Utils\Json,
|
||||
Espo\Core\Exceptions\NotFound;
|
||||
|
||||
class Service
|
||||
{
|
||||
private $serviceFactory;
|
||||
|
||||
public function __construct(\Espo\Core\ServiceFactory $serviceFactory)
|
||||
{
|
||||
$this->serviceFactory = $serviceFactory;
|
||||
}
|
||||
|
||||
protected function getServiceFactory()
|
||||
{
|
||||
return $this->serviceFactory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function run($job)
|
||||
{
|
||||
$serviceName = $job['service_name'];
|
||||
|
||||
if (!$this->getServiceFactory()->checkExists($serviceName)) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$service = $this->getServiceFactory()->create($serviceName);
|
||||
$serviceMethod = $job['method'];
|
||||
|
||||
if (!method_exists($service, $serviceMethod)) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$data = $job['data'];
|
||||
if (Json::isJSON($data)) {
|
||||
$data = Json::decode($data, true);
|
||||
}
|
||||
|
||||
$service->$serviceMethod($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,42 +18,54 @@
|
||||
*
|
||||
* 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\Core;
|
||||
use \PDO;
|
||||
use Espo\Core\Utils\Json;
|
||||
use Espo\Core\Exceptions\NotFound;
|
||||
|
||||
class CronManager
|
||||
{
|
||||
private $container;
|
||||
|
||||
private $config;
|
||||
|
||||
private $fileManager;
|
||||
|
||||
private $scheduledJobCron;
|
||||
private $serviceCron;
|
||||
private $entityManager;
|
||||
|
||||
private $jobService;
|
||||
private $scheduledJobService;
|
||||
private $scheduledJobUtil;
|
||||
|
||||
const PENDING = 'Pending';
|
||||
|
||||
const RUNNING = 'Running';
|
||||
|
||||
const SUCCESS = 'Success';
|
||||
|
||||
const FAILED = 'Failed';
|
||||
|
||||
protected $lastRunTime = 'data/cache/application/cronLastRunTime.php';
|
||||
|
||||
|
||||
public function __construct(\Espo\Core\Container $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
|
||||
$this->config = $this->container->get('config');
|
||||
$this->fileManager = $this->container->get('fileManager');
|
||||
$this->entityManager = $this->container->get('entityManager');
|
||||
$this->serviceFactory = $this->container->get('serviceFactory');
|
||||
|
||||
$this->scheduledJobCron = $this->container->get('scheduledJob');
|
||||
$this->serviceCron = new \Espo\Core\Cron\Service( $this->container->get('serviceFactory'));
|
||||
|
||||
$this->jobService = $this->container->get('serviceFactory')->create('job');
|
||||
$this->scheduledJobService = $this->container->get('serviceFactory')->create('scheduledJob');
|
||||
$this->scheduledJobUtil = $this->container->get('scheduledJob');
|
||||
$this->cronJob = new \Espo\Core\Utils\Cron\Job($this->config, $this->entityManager);
|
||||
$this->cronScheduledJob = new \Espo\Core\Utils\Cron\ScheduledJob($this->config, $this->entityManager);
|
||||
}
|
||||
|
||||
protected function getContainer()
|
||||
@@ -71,32 +83,38 @@ class CronManager
|
||||
return $this->fileManager;
|
||||
}
|
||||
|
||||
protected function getJobService()
|
||||
protected function getEntityManager()
|
||||
{
|
||||
return $this->jobService;
|
||||
return $this->entityManager;
|
||||
}
|
||||
|
||||
protected function getScheduledJobService()
|
||||
protected function getServiceFactory()
|
||||
{
|
||||
return $this->scheduledJobService;
|
||||
return $this->serviceFactory;
|
||||
}
|
||||
|
||||
protected function getScheduledJobCron()
|
||||
protected function getScheduledJobUtil()
|
||||
{
|
||||
return $this->scheduledJobCron;
|
||||
return $this->scheduledJobUtil;
|
||||
}
|
||||
|
||||
protected function getServiceCron()
|
||||
protected function getCronJob()
|
||||
{
|
||||
return $this->serviceCron;
|
||||
return $this->cronJob;
|
||||
}
|
||||
|
||||
protected function getCronScheduledJob()
|
||||
{
|
||||
return $this->cronScheduledJob;
|
||||
}
|
||||
|
||||
protected function getLastRunTime()
|
||||
{
|
||||
$lastRunTime = $this->getFileManager()->getContents($this->lastRunTime);
|
||||
if (!is_int($lastRunTime)) {
|
||||
$lastRunTime = time() - (intval($this->getConfig()->get('cron.minExecutionTime')) + 60);
|
||||
$lastRunData = $this->getFileManager()->getPhpContents($this->lastRunTime);
|
||||
|
||||
$lastRunTime = time() - intval($this->getConfig()->get('cron.minExecutionTime')) - 1;
|
||||
if (is_array($lastRunData) && !empty($lastRunData['time'])) {
|
||||
$lastRunTime = $lastRunData['time'];
|
||||
}
|
||||
|
||||
return $lastRunTime;
|
||||
@@ -104,7 +122,10 @@ class CronManager
|
||||
|
||||
protected function setLastRunTime($time)
|
||||
{
|
||||
return $this->getFileManager()->putContentsPHP($this->lastRunTime, $time);
|
||||
$data = array(
|
||||
'time' => $time,
|
||||
);
|
||||
return $this->getFileManager()->putPhpContents($this->lastRunTime, $data);
|
||||
}
|
||||
|
||||
protected function checkLastRunTime()
|
||||
@@ -120,96 +141,188 @@ class CronManager
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run Cron
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if (!$this->checkLastRunTime()) {
|
||||
$GLOBALS['log']->info('Cron Manager: Stop cron running, too frequency execution');
|
||||
return; //stop cron running, too frequency execution
|
||||
$GLOBALS['log']->info('CronManager: Stop cron running, too frequent execution.');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setLastRunTime(time());
|
||||
|
||||
//Check scheduled jobs and create related jobs
|
||||
$this->getCronJob()->markFailedJobs();
|
||||
$this->getCronJob()->updateFailedJobAttempts();
|
||||
$this->createJobsFromScheduledJobs();
|
||||
$this->getCronJob()->removePendingJobDuplicates();
|
||||
|
||||
$pendingJobs = $this->getJobService()->getPendingJobs();
|
||||
$pendingJobList = $this->getCronJob()->getPendingJobList();
|
||||
|
||||
foreach ($pendingJobs as $job) {
|
||||
foreach ($pendingJobList as $job) {
|
||||
$jobEntity = $this->getEntityManager()->getEntity('Job', $job['id']);
|
||||
|
||||
$this->getJobService()->updateEntity($job['id'], array(
|
||||
'status' => self::RUNNING,
|
||||
));
|
||||
if (!isset($jobEntity)) {
|
||||
$GLOBALS['log']->error('CronManager: empty Job entity ['.$job['id'].'].');
|
||||
continue;
|
||||
}
|
||||
|
||||
$jobEntity->set('status', self::RUNNING);
|
||||
$this->getEntityManager()->saveEntity($jobEntity);
|
||||
|
||||
$isSuccess = true;
|
||||
|
||||
try {
|
||||
if (!empty($job['scheduled_job_id'])) {
|
||||
$this->getScheduledJobCron()->run($job);
|
||||
$this->runScheduledJob($job);
|
||||
} else {
|
||||
$this->getServiceCron()->run($job);
|
||||
$this->runService($job);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$isSuccess = false;
|
||||
$GLOBALS['log']->error('Failed job running, job ['.$job['id'].']. Error Details: '.$e->getMessage());
|
||||
$GLOBALS['log']->error('CronManager: Failed job running, job ['.$job['id'].']. Error Details: '.$e->getMessage());
|
||||
}
|
||||
|
||||
$status = $isSuccess ? self::SUCCESS : self::FAILED;
|
||||
|
||||
$this->getJobService()->updateEntity($job['id'], array(
|
||||
'status' => $status,
|
||||
));
|
||||
$jobEntity->set('status', $status);
|
||||
$this->getEntityManager()->saveEntity($jobEntity);
|
||||
|
||||
//set status in the schedulerJobLog
|
||||
if (!empty($job['scheduled_job_id'])) {
|
||||
$this->getScheduledJobService()->addLogRecord($job['scheduled_job_id'], $status);
|
||||
$this->getCronScheduledJob()->addLogRecord($job['scheduled_job_id'], $status, null, $job['target_id'], $job['target_type']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run Scheduled Job
|
||||
*
|
||||
* @param array $job
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function runScheduledJob(array $job)
|
||||
{
|
||||
$jobName = $job['method'];
|
||||
|
||||
$className = $this->getScheduledJobUtil()->get($jobName);
|
||||
if ($className === false) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$jobClass = new $className($this->container);
|
||||
$method = 'run';
|
||||
if (!method_exists($jobClass, $method)) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$data = null;
|
||||
if (!empty($job['data'])) {
|
||||
$data = $job['data'];
|
||||
if (Json::isJSON($data)) {
|
||||
$data = Json::decode($data, true);
|
||||
}
|
||||
}
|
||||
|
||||
$jobClass->$method($data, $job['target_id'], $job['target_type']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run Service
|
||||
*
|
||||
* @param array $job
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function runService(array $job)
|
||||
{
|
||||
$serviceName = $job['service_name'];
|
||||
|
||||
if (!$this->getServiceFactory()->checkExists($serviceName)) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$service = $this->getServiceFactory()->create($serviceName);
|
||||
$serviceMethod = $job['method'];
|
||||
|
||||
if (!method_exists($service, $serviceMethod)) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$data = $job['data'];
|
||||
if (Json::isJSON($data)) {
|
||||
$data = Json::decode($data, true);
|
||||
}
|
||||
|
||||
$service->$serviceMethod($data, $job['target_id'], $job['target_type']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check scheduled jobs and create related jobs
|
||||
* @return array List of created Jobs
|
||||
*
|
||||
* @return array List of created Jobs
|
||||
*/
|
||||
protected function createJobsFromScheduledJobs()
|
||||
{
|
||||
$activeScheduledJobs = $this->getScheduledJobService()->getActiveJobs();
|
||||
$activeScheduledJobList = $this->getCronScheduledJob()->getActiveScheduledJobList();
|
||||
|
||||
$createdJobs = array();
|
||||
foreach ($activeScheduledJobs as $scheduledJob) {
|
||||
$runningScheduledJobIdList = $this->getCronJob()->getRunningScheduledJobIdList();
|
||||
|
||||
$createdJobIdList = array();
|
||||
foreach ($activeScheduledJobList as $scheduledJob) {
|
||||
$scheduling = $scheduledJob['scheduling'];
|
||||
|
||||
$cronExpression = \Cron\CronExpression::factory($scheduling);
|
||||
try {
|
||||
$cronExpression = \Cron\CronExpression::factory($scheduling);
|
||||
} catch (\Exception $e) {
|
||||
$GLOBALS['log']->error('CronManager (ScheduledJob ['.$scheduledJob['id'].']): Scheduling string error - '. $e->getMessage() . '.');
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$prevDate = $cronExpression->getPreviousRunDate()->format('Y-m-d H:i:s');
|
||||
$previousDate = $cronExpression->getPreviousRunDate()->format('Y-m-d H:i:s');
|
||||
} catch (\Exception $e) {
|
||||
$GLOBALS['log']->error('ScheduledJob ['.$scheduledJob['id'].']: CronExpression - Impossible CRON expression ['.$scheduling.']');
|
||||
$GLOBALS['log']->error('CronManager (ScheduledJob ['.$scheduledJob['id'].']): Unsupported CRON expression ['.$scheduling.']');
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($cronExpression->isDue()) {
|
||||
$prevDate = date('Y-m-d H:i:00');
|
||||
$previousDate = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
$existsJob = $this->getJobService()->getJobByScheduledJob($scheduledJob['id'], $prevDate);
|
||||
$existingJob = $this->getCronJob()->getJobByScheduledJob($scheduledJob['id'], $previousDate);
|
||||
if ($existingJob) continue;
|
||||
|
||||
if (!isset($existsJob) || empty($existsJob)) {
|
||||
//create a job
|
||||
$data = array(
|
||||
'name' => $scheduledJob['name'],
|
||||
'status' => self::PENDING,
|
||||
'scheduledJobId' => $scheduledJob['id'],
|
||||
'executeTime' => $prevDate,
|
||||
'method' => $scheduledJob['job'],
|
||||
);
|
||||
$createdJobs[] = $this->getJobService()->createEntity($data);
|
||||
$className = $this->getScheduledJobUtil()->get($scheduledJob['job']);
|
||||
if ($className) {
|
||||
if (method_exists($className, 'prepare')) {
|
||||
$implementation = new $className($this->container);
|
||||
$implementation->prepare($scheduledJob, $previousDate);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($scheduledJob['id'], $runningScheduledJobIdList)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$jobEntity = $this->getEntityManager()->getEntity('Job');
|
||||
$jobEntity->set(array(
|
||||
'name' => $scheduledJob['name'],
|
||||
'status' => self::PENDING,
|
||||
'scheduledJobId' => $scheduledJob['id'],
|
||||
'executeTime' => $previousDate,
|
||||
'method' => $scheduledJob['job']
|
||||
));
|
||||
$this->getEntityManager()->saveEntity($jobEntity);
|
||||
|
||||
$createdJobIdList[] = $jobEntity->id;
|
||||
}
|
||||
|
||||
return $createdJobs;
|
||||
return $createdJobIdList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* 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\Core;
|
||||
|
||||
class DataManager
|
||||
{
|
||||
private $container;
|
||||
|
||||
50
application/Espo/Core/Entities/CategoryTreeItem.php
Normal file
50
application/Espo/Core/Entities/CategoryTreeItem.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core\Entities;
|
||||
|
||||
class CategoryTreeItem extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
public function toArray()
|
||||
{
|
||||
$data = parent::toArray();
|
||||
$childList = $this->get('childList');
|
||||
if (is_null($childList)) {
|
||||
$data['childList'] = null;
|
||||
} else {
|
||||
$arr = [];
|
||||
foreach ($childList as $entity) {
|
||||
$arr[] = $entity->toArray();
|
||||
}
|
||||
$data['childList'] = $arr;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,18 +18,23 @@
|
||||
*
|
||||
* 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\Core\Entities;
|
||||
|
||||
class Person extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
public static $person = true;
|
||||
|
||||
public function _setLastName($value)
|
||||
{
|
||||
$this->setValue('lastName', $value);
|
||||
|
||||
|
||||
$firstName = $this->get('firstName');
|
||||
if (empty($firstName)) {
|
||||
$this->setValue('name', $value);
|
||||
@@ -37,11 +42,11 @@ class Person extends \Espo\Core\ORM\Entity
|
||||
$this->setValue('name', $firstName . ' ' . $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function _setFirstName($value)
|
||||
{
|
||||
$this->setValue('firstName', $value);
|
||||
|
||||
|
||||
$lastName = $this->get('lastName');
|
||||
if (empty($lastName)) {
|
||||
$this->setValue('name', $value);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,19 +18,25 @@
|
||||
*
|
||||
* 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\Core;
|
||||
|
||||
use \Espo\Core\Exceptions\NotFound,
|
||||
\Espo\Core\Utils\Util;
|
||||
|
||||
|
||||
class EntryPointManager
|
||||
{
|
||||
private $container;
|
||||
|
||||
private $fileManager;
|
||||
private $container;
|
||||
|
||||
private $fileManager;
|
||||
|
||||
protected $data = null;
|
||||
|
||||
@@ -38,7 +44,7 @@ class EntryPointManager
|
||||
|
||||
protected $allowedMethods = array(
|
||||
'run',
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array - path to entryPoint files
|
||||
@@ -46,14 +52,14 @@ class EntryPointManager
|
||||
private $paths = array(
|
||||
'corePath' => 'application/Espo/EntryPoints',
|
||||
'modulePath' => 'application/Espo/Modules/{*}/EntryPoints',
|
||||
'customPath' => 'custom/Espo/Custom/EntryPoints',
|
||||
'customPath' => 'custom/Espo/Custom/EntryPoints',
|
||||
);
|
||||
|
||||
|
||||
public function __construct(\Espo\Core\Container $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->fileManager = $container->get('fileManager');
|
||||
$this->container = $container;
|
||||
$this->fileManager = $container->get('fileManager');
|
||||
}
|
||||
|
||||
protected function getContainer()
|
||||
@@ -69,27 +75,36 @@ class EntryPointManager
|
||||
public function checkAuthRequired($name)
|
||||
{
|
||||
$className = $this->getClassName($name);
|
||||
if ($className === false) {
|
||||
if (!$className) {
|
||||
throw new NotFound();
|
||||
}
|
||||
return $className::$authRequired;
|
||||
return $className::$authRequired;
|
||||
}
|
||||
|
||||
public function run($name)
|
||||
public function checkNotStrictAuth($name)
|
||||
{
|
||||
$className = $this->getClassName($name);
|
||||
if ($className === false) {
|
||||
if (!$className) {
|
||||
throw new NotFound();
|
||||
}
|
||||
return $className::$notStrictAuth;
|
||||
}
|
||||
|
||||
public function run($name, $data = array())
|
||||
{
|
||||
$className = $this->getClassName($name);
|
||||
if (!$className) {
|
||||
throw new NotFound();
|
||||
}
|
||||
$entryPoint = new $className($this->container);
|
||||
|
||||
$entryPoint->run();
|
||||
$entryPoint->run($data);
|
||||
}
|
||||
|
||||
protected function getClassName($name)
|
||||
{
|
||||
$name = Util::normilizeClassName($name);
|
||||
|
||||
|
||||
if (!isset($this->data)) {
|
||||
$this->init();
|
||||
}
|
||||
@@ -98,8 +113,8 @@ class EntryPointManager
|
||||
if (isset($this->data[$name])) {
|
||||
return $this->data[$name];
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,8 +123,7 @@ class EntryPointManager
|
||||
$classParser = $this->getContainer()->get('classParser');
|
||||
$classParser->setAllowedMethods($this->allowedMethods);
|
||||
$this->data = $classParser->getData($this->paths, $this->cacheFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,7 +18,14 @@
|
||||
*
|
||||
* 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\Core\EntryPoints;
|
||||
|
||||
@@ -29,50 +36,75 @@ use \Espo\Core\Exceptions\Forbidden;
|
||||
abstract class Base
|
||||
{
|
||||
private $container;
|
||||
|
||||
|
||||
public static $authRequired = true;
|
||||
|
||||
|
||||
public static $notStrictAuth = false;
|
||||
|
||||
protected function getContainer()
|
||||
{
|
||||
return $this->container;
|
||||
}
|
||||
|
||||
|
||||
protected function getUser()
|
||||
{
|
||||
return $this->getContainer()->get('user');
|
||||
}
|
||||
|
||||
|
||||
protected function getAcl()
|
||||
{
|
||||
return $this->getContainer()->get('acl');
|
||||
}
|
||||
|
||||
|
||||
protected function getEntityManager()
|
||||
{
|
||||
return $this->getContainer()->get('entityManager');
|
||||
}
|
||||
|
||||
|
||||
protected function getServiceFactory()
|
||||
{
|
||||
return $this->getContainer()->get('serviceFactory');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function getConfig()
|
||||
{
|
||||
return $this->getContainer()->get('config');
|
||||
}
|
||||
|
||||
|
||||
protected function getMetadata()
|
||||
{
|
||||
return $this->getContainer()->get('metadata');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function getDateTime()
|
||||
{
|
||||
return $this->getContainer()->get('dateTime');
|
||||
}
|
||||
|
||||
protected function getNumber()
|
||||
{
|
||||
return $this->getContainer()->get('number');
|
||||
}
|
||||
|
||||
protected function getFileManager()
|
||||
{
|
||||
return $this->getContainer()->get('fileManager');
|
||||
}
|
||||
|
||||
protected function getLanguage()
|
||||
{
|
||||
return $this->getContainer()->get('language');
|
||||
}
|
||||
|
||||
protected function getClientManager()
|
||||
{
|
||||
return $this->getContainer()->get('clientManager');
|
||||
}
|
||||
|
||||
public function __construct(Container $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
abstract public function run();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Exceptions;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Exceptions;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Exceptions;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Exceptions;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Exceptions;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Exceptions;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Exceptions;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core;
|
||||
@@ -28,7 +35,6 @@ class ExtensionManager extends Upgrades\Base
|
||||
|
||||
protected $params = array(
|
||||
'packagePath' => 'data/upload/extensions',
|
||||
|
||||
'backupPath' => 'data/.backup/extensions',
|
||||
|
||||
'scriptNames' => array(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\ExternalAccount;
|
||||
@@ -29,33 +36,33 @@ use \Espo\Core\Exceptions\NotFound;
|
||||
class ClientManager
|
||||
{
|
||||
protected $entityManager;
|
||||
|
||||
|
||||
protected $metadata;
|
||||
|
||||
|
||||
protected $clientMap = array();
|
||||
|
||||
|
||||
public function __construct($entityManager, $metadata, $config)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
$this->metadata = $metadata;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
|
||||
protected function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
|
||||
protected function getEntityManager()
|
||||
{
|
||||
return $this->entityManager;
|
||||
}
|
||||
|
||||
|
||||
protected function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
|
||||
public function storeAccessToken($hash, $data)
|
||||
{
|
||||
if (!empty($this->clientMap[$hash]) && !empty($this->clientMap[$hash]['externalAccountEntity'])) {
|
||||
@@ -64,37 +71,37 @@ class ClientManager
|
||||
$externalAccountEntity->set('tokenType', $data['tokenType']);
|
||||
$this->getEntityManager()->saveEntity($externalAccountEntity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function create($integration, $userId)
|
||||
{
|
||||
$authMethod = $this->getMetadata()->get("integrations.{$integration}.authMethod");
|
||||
$methodName = 'create' . ucfirst($authMethod);
|
||||
return $this->$methodName($integration, $userId);
|
||||
$authMethod = $this->getMetadata()->get("integrations.{$integration}.authMethod");
|
||||
$methodName = 'create' . ucfirst($authMethod);
|
||||
return $this->$methodName($integration, $userId);
|
||||
}
|
||||
|
||||
|
||||
protected function createOAuth2($integration, $userId)
|
||||
{
|
||||
{
|
||||
$integrationEntity = $this->getEntityManager()->getEntity('Integration', $integration);
|
||||
$externalAccountEntity = $this->getEntityManager()->getEntity('ExternalAccount', $integration . '__' . $userId);
|
||||
|
||||
|
||||
$className = $this->getMetadata()->get("integrations.{$integration}.clientClassName");
|
||||
|
||||
$redirectUri = $this->getConfig()->get('siteUrl') . '/oauthcallback'; // TODO move to client class
|
||||
|
||||
|
||||
$redirectUri = $this->getConfig()->get('siteUrl') . '?entryPoint=oauthCallback'; // TODO move to client class
|
||||
|
||||
if (!$externalAccountEntity) {
|
||||
throw new Error("External Account {$integration} not found for {$userId}");
|
||||
}
|
||||
|
||||
|
||||
if (!$integrationEntity->get('enabled')) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (!$externalAccountEntity->get('enabled')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$oauth2Client = new \Espo\Core\ExternalAccount\OAuth2\Client();
|
||||
|
||||
}
|
||||
|
||||
$oauth2Client = new \Espo\Core\ExternalAccount\OAuth2\Client();
|
||||
|
||||
$client = new $className($oauth2Client, array(
|
||||
'endpoint' => $this->getMetadata()->get("integrations.{$integration}.params.endpoint"),
|
||||
'tokenEndpoint' => $this->getMetadata()->get("integrations.{$integration}.params.tokenEndpoint"),
|
||||
@@ -105,12 +112,12 @@ class ClientManager
|
||||
'refreshToken' => $externalAccountEntity->get('refreshToken'),
|
||||
'tokenType' => $externalAccountEntity->get('tokenType'),
|
||||
), $this);
|
||||
|
||||
|
||||
$this->addToClientMap($client, $integrationEntity, $externalAccountEntity, $userId);
|
||||
|
||||
return $client;
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
||||
|
||||
protected function addToClientMap($client, $integrationEntity, $externalAccountEntity, $userId)
|
||||
{
|
||||
$this->clientMap[spl_object_hash($client)] = array(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\ExternalAccount\Clients;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\ExternalAccount\Clients;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\ExternalAccount\Clients;
|
||||
@@ -29,9 +36,9 @@ use \Espo\Core\ExternalAccount\OAuth2\Client;
|
||||
abstract class OAuth2Abstract implements IClient
|
||||
{
|
||||
protected $client = null;
|
||||
|
||||
|
||||
protected $manager = null;
|
||||
|
||||
|
||||
protected $paramList = array(
|
||||
'endpoint',
|
||||
'tokenEndpoint',
|
||||
@@ -42,33 +49,33 @@ abstract class OAuth2Abstract implements IClient
|
||||
'refreshToken',
|
||||
'redirectUri',
|
||||
);
|
||||
|
||||
|
||||
protected $clientId = null;
|
||||
|
||||
|
||||
protected $clientSecret = null;
|
||||
|
||||
|
||||
protected $accessToken = null;
|
||||
|
||||
|
||||
protected $refreshToken = null;
|
||||
|
||||
|
||||
protected $redirectUri = null;
|
||||
|
||||
|
||||
public function __construct($client, array $params = array(), $manager = null)
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
$this->setParams($params);
|
||||
|
||||
|
||||
$this->manager = $manager;
|
||||
}
|
||||
|
||||
|
||||
public function getParam($name)
|
||||
{
|
||||
if (in_array($name, $this->paramList)) {
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function setParam($name, $value)
|
||||
{
|
||||
if (in_array($name, $this->paramList)) {
|
||||
@@ -79,7 +86,7 @@ abstract class OAuth2Abstract implements IClient
|
||||
$this->$name = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function setParams(array $params)
|
||||
{
|
||||
foreach ($this->paramList as $name) {
|
||||
@@ -88,42 +95,41 @@ abstract class OAuth2Abstract implements IClient
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function afterTokenRefreshed($data)
|
||||
{
|
||||
if ($this->manager) {
|
||||
$this->manager->storeAccessToken(spl_object_hash($this), $data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getAccessTokenFromAuthorizationCode($code)
|
||||
{
|
||||
$r = $this->client->getAccessToken($this->getParam('tokenEndpoint'), Client::GRANT_TYPE_AUTHORIZATION_CODE, array(
|
||||
'code' => $code,
|
||||
'redirect_uri' => $this->getParam('redirectUri')
|
||||
));
|
||||
|
||||
|
||||
|
||||
if ($r['code'] == 200) {
|
||||
$data = array();
|
||||
if (!empty($r['result'])) {
|
||||
$data['accessToken'] = $r['result']['access_token'];
|
||||
$data['tokenType'] = $r['result']['token_type'];
|
||||
$data['refreshToken'] = $r['result']['refresh_token'];
|
||||
$data['refreshToken'] = $r['result']['refresh_token'];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
abstract protected function getPingUrl();
|
||||
|
||||
|
||||
public function ping()
|
||||
{
|
||||
if (empty($this->accessToken) || empty($this->clientId) || empty($this->clientSecret)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$url = $this->getPingUrl();
|
||||
|
||||
try {
|
||||
@@ -133,35 +139,48 @@ abstract class OAuth2Abstract implements IClient
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function request($url, $params = array(), $httpMethod = Client::HTTP_METHOD_GET, $allowRenew = true)
|
||||
|
||||
public function request($url, $params = null, $httpMethod = Client::HTTP_METHOD_GET, $contentType = null, $allowRenew = true)
|
||||
{
|
||||
$r = $this->client->request($url, $params, $httpMethod);
|
||||
|
||||
$httpHeaders = array();
|
||||
if (!empty($contentType)) {
|
||||
$httpHeaders['Content-Type'] = $contentType;
|
||||
switch ($contentType) {
|
||||
case Client::CONTENT_TYPE_MULTIPART_FORM_DATA:
|
||||
$httpHeaders['Content-Length'] = strlen($params);
|
||||
break;
|
||||
case Client::CONTENT_TYPE_APPLICATION_JSON:
|
||||
$httpHeaders['Content-Length'] = strlen($params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$r = $this->client->request($url, $params, $httpMethod, $httpHeaders);
|
||||
|
||||
$code = null;
|
||||
if (!empty($r['code'])) {
|
||||
$code = $r['code'];
|
||||
}
|
||||
|
||||
if ($code == 200) {
|
||||
}
|
||||
|
||||
if ($code >= 200 && $code < 300) {
|
||||
return $r['result'];
|
||||
} else {
|
||||
$handledData = $this->handleErrorResponse($r);
|
||||
|
||||
|
||||
if ($allowRenew && is_array($handledData)) {
|
||||
if ($handledData['action'] == 'refreshToken') {
|
||||
if ($this->refreshToken()) {
|
||||
return $this->request($url, $params, $httpMethod, false);
|
||||
if ($this->refreshToken()) {
|
||||
return $this->request($url, $params, $httpMethod, $contentType, false);
|
||||
}
|
||||
} else if ($handledData['action'] == 'renew') {
|
||||
return $this->request($url, $params, $httpMethod, false);
|
||||
return $this->request($url, $params, $httpMethod, $contentType, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
throw new Error("Error after requesting {$httpMethod} {$url}.", $code);
|
||||
}
|
||||
|
||||
|
||||
protected function refreshToken()
|
||||
{
|
||||
if (!empty($this->refreshToken)) {
|
||||
@@ -183,11 +202,11 @@ abstract class OAuth2Abstract implements IClient
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function handleErrorResponse($r)
|
||||
{
|
||||
if ($r['code'] == 401 && !empty($r['result'])) {
|
||||
$result = $r['result'];
|
||||
$result = $r['result'];
|
||||
if (strpos($r['header'], 'error=invalid_token') !== false) {
|
||||
return array(
|
||||
'action' => 'refreshToken'
|
||||
@@ -198,7 +217,7 @@ abstract class OAuth2Abstract implements IClient
|
||||
);
|
||||
}
|
||||
} else if ($r['code'] == 400 && !empty($r['result'])) {
|
||||
if ($r['result']['error'] == 'invalid_token') {
|
||||
if ($r['result']['error'] == 'invalid_token') {
|
||||
return array(
|
||||
'action' => 'refreshToken'
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\ExternalAccount\OAuth2;
|
||||
@@ -32,8 +39,9 @@ class Client
|
||||
const TOKEN_TYPE_BEARER = 'Bearer';
|
||||
const TOKEN_TYPE_OAUTH = 'OAuth';
|
||||
|
||||
const CONTENT_TYPE_APPLICATION = 0;
|
||||
const CONTENT_TYPE_MULTIPART = 1;
|
||||
const CONTENT_TYPE_APPLICATION_X_WWW_FORM_URLENENCODED = 'application/x-www-form-urlencoded';
|
||||
const CONTENT_TYPE_MULTIPART_FORM_DATA = 'multipart/form-data';
|
||||
const CONTENT_TYPE_APPLICATION_JSON = 'application/json';
|
||||
|
||||
const HTTP_METHOD_GET = 'GET';
|
||||
const HTTP_METHOD_POST = 'POST';
|
||||
@@ -118,7 +126,7 @@ class Client
|
||||
$this->accessTokenSecret = $accessTokenSecret;
|
||||
}
|
||||
|
||||
public function request($url, $params = array(), $httpMethod = self::HTTP_METHOD_GET, array $httpHeaders = array(), $contentType = self::CONTENT_TYPE_MULTIPART)
|
||||
public function request($url, $params = null, $httpMethod = self::HTTP_METHOD_GET, array $httpHeaders = array())
|
||||
{
|
||||
if ($this->accessToken) {
|
||||
switch ($this->tokenType) {
|
||||
@@ -137,10 +145,10 @@ class Client
|
||||
}
|
||||
}
|
||||
|
||||
return $this->execute($url, $params, $httpMethod, $httpHeaders, $contentType);
|
||||
return $this->execute($url, $params, $httpMethod, $httpHeaders);
|
||||
}
|
||||
|
||||
private function execute($url, $params = array(), $httpMethod, array $httpHeaders = array(), $contentType = self::CONTENT_TYPE_MULTIPART)
|
||||
private function execute($url, $params = null, $httpMethod, array $httpHeaders = array())
|
||||
{
|
||||
$curlOptions = array(
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
@@ -153,8 +161,10 @@ class Client
|
||||
$curlOptions[CURLOPT_POST] = true;
|
||||
case self::HTTP_METHOD_PUT:
|
||||
case self::HTTP_METHOD_PATCH:
|
||||
if (self::CONTENT_TYPE_APPLICATION === $contentType) {
|
||||
if (is_array($params)) {
|
||||
$postFields = http_build_query($params, null, '&');
|
||||
} else {
|
||||
$postFields = $params;
|
||||
}
|
||||
$curlOptions[CURLOPT_POSTFIELDS] = $postFields;
|
||||
break;
|
||||
@@ -165,7 +175,9 @@ class Client
|
||||
if (strpos($url, '?') === false) {
|
||||
$url .= '?';
|
||||
}
|
||||
$url .= http_build_query($params, null, '&');
|
||||
if (is_array($params)) {
|
||||
$url .= http_build_query($params, null, '&');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -228,7 +240,7 @@ class Client
|
||||
$params['grant_type'] = $grantType;
|
||||
|
||||
$httpHeaders = array();
|
||||
switch ($this->clientAuth) {
|
||||
switch ($this->tokenType) {
|
||||
case self::AUTH_TYPE_URI:
|
||||
case self::AUTH_TYPE_FORM:
|
||||
$params['client_id'] = $this->clientId;
|
||||
@@ -242,7 +254,7 @@ class Client
|
||||
throw new \Exception();
|
||||
}
|
||||
|
||||
return $this->execute($url, $params, self::HTTP_METHOD_POST, $httpHeaders, self::CONTENT_TYPE_APPLICATION);
|
||||
return $this->execute($url, $params, self::HTTP_METHOD_POST, $httpHeaders);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,10 +18,16 @@
|
||||
*
|
||||
* 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\Core;
|
||||
|
||||
use \Espo\Core\Exceptions\Error,
|
||||
\Espo\Core\Utils\Util;
|
||||
|
||||
@@ -73,7 +79,7 @@ class HookManager
|
||||
protected function loadHooks()
|
||||
{
|
||||
if ($this->getConfig()->get('useCache') && file_exists($this->cacheFile)) {
|
||||
$this->data = $this->getFileManager()->getContents($this->cacheFile);
|
||||
$this->data = $this->getFileManager()->getPhpContents($this->cacheFile);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -83,20 +89,20 @@ class HookManager
|
||||
|
||||
foreach ($metadata->getModuleList() as $moduleName) {
|
||||
$modulePath = str_replace('{*}', $moduleName, $this->paths['modulePath']);
|
||||
$this->data = array_merge($this->data, $this->getHookData($modulePath));
|
||||
$this->data = array_merge_recursive($this->data, $this->getHookData($modulePath));
|
||||
}
|
||||
|
||||
$this->data = array_merge($this->data, $this->getHookData($this->paths['customPath']));
|
||||
$this->data = array_merge_recursive($this->data, $this->getHookData($this->paths['customPath']));
|
||||
|
||||
if ($this->getConfig()->get('useCache')) {
|
||||
$this->getFileManager()->putContentsPHP($this->cacheFile, $this->data);
|
||||
$this->getFileManager()->putPhpContents($this->cacheFile, $this->data);
|
||||
}
|
||||
}
|
||||
|
||||
public function process($scope, $hookName, $injection = null)
|
||||
public function process($scope, $hookName, $injection = null, array $options = array())
|
||||
{
|
||||
if ($scope != 'Common') {
|
||||
$this->process('Common', $hookName, $injection);
|
||||
$this->process('Common', $hookName, $injection, $options);
|
||||
}
|
||||
|
||||
if (!empty($this->data[$scope])) {
|
||||
@@ -104,9 +110,12 @@ class HookManager
|
||||
foreach ($this->data[$scope][$hookName] as $className) {
|
||||
if (empty($this->hooks[$className])) {
|
||||
$this->hooks[$className] = $this->createHookByClassName($className);
|
||||
if (empty($this->hooks[$className])) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$hook = $this->hooks[$className];
|
||||
$hook->$hookName($injection);
|
||||
$hook->$hookName($injection, $options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,7 +131,7 @@ class HookManager
|
||||
}
|
||||
return $hook;
|
||||
}
|
||||
throw new Error("Class '$className' does not exist");
|
||||
$GLOBALS['log']->error("Hook class '{$className}' does not exist.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +179,9 @@ class HookManager
|
||||
$sortedHookList = array_merge($sortedHookList, $hookDetails);
|
||||
}
|
||||
|
||||
$hooks[$scopeName][$hookName] = isset($hooks[$scopeName][$hookName]) ? array_merge($hooks[$scopeName][$hookName], $sortedHookList) : $sortedHookList;
|
||||
$normalizedScopeName = Util::normilizeScopeName($scopeName);
|
||||
|
||||
$hooks[$normalizedScopeName][$hookName] = isset($hooks[$normalizedScopeName][$hookName]) ? array_merge($hooks[$normalizedScopeName][$hookName], $sortedHookList) : $sortedHookList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,19 +18,27 @@
|
||||
*
|
||||
* 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\Core\Hooks;
|
||||
|
||||
use \Espo\Core\Interfaces\Injectable;
|
||||
use Espo\Core\Interfaces\Injectable;
|
||||
|
||||
class Base implements Injectable
|
||||
abstract class Base implements Injectable
|
||||
{
|
||||
protected $dependencies = array(
|
||||
'container',
|
||||
'entityManager',
|
||||
'config',
|
||||
'metadata',
|
||||
'acl',
|
||||
'aclManager',
|
||||
'user',
|
||||
);
|
||||
|
||||
@@ -52,6 +60,18 @@ class Base implements Injectable
|
||||
return $this->dependencies;
|
||||
}
|
||||
|
||||
protected function addDependencyList(array $list)
|
||||
{
|
||||
foreach ($list as $item) {
|
||||
$this->addDependency($item);
|
||||
}
|
||||
}
|
||||
|
||||
protected function addDependency($name)
|
||||
{
|
||||
$this->dependencies[] = $name;
|
||||
}
|
||||
|
||||
protected function getInjection($name)
|
||||
{
|
||||
return $this->injections[$name];
|
||||
@@ -62,29 +82,39 @@ class Base implements Injectable
|
||||
$this->injections[$name] = $object;
|
||||
}
|
||||
|
||||
protected function getContainer()
|
||||
{
|
||||
return $this->getInjection('container');
|
||||
}
|
||||
|
||||
protected function getEntityManager()
|
||||
{
|
||||
return $this->injections['entityManager'];
|
||||
return $this->getInjection('entityManager');
|
||||
}
|
||||
|
||||
protected function getUser()
|
||||
{
|
||||
return $this->injections['user'];
|
||||
return $this->getInjection('user');
|
||||
}
|
||||
|
||||
protected function getAcl()
|
||||
{
|
||||
return $this->injections['acl'];
|
||||
return $this->getContainer()->get('acl');
|
||||
}
|
||||
|
||||
protected function getAclManager()
|
||||
{
|
||||
return $this->getInjection('aclManager');
|
||||
}
|
||||
|
||||
protected function getConfig()
|
||||
{
|
||||
return $this->injections['config'];
|
||||
return $this->getInjection('config');
|
||||
}
|
||||
|
||||
protected function getMetadata()
|
||||
{
|
||||
return $this->injections['metadata'];
|
||||
return $this->getInjection('metadata');
|
||||
}
|
||||
|
||||
protected function getRepository()
|
||||
|
||||
195
application/Espo/Core/Htmlizer/Htmlizer.php
Normal file
195
application/Espo/Core/Htmlizer/Htmlizer.php
Normal file
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core\Htmlizer;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\Core\Exceptions\Error;
|
||||
|
||||
use Espo\Core\Utils\File\Manager as FileManager;
|
||||
use Espo\Core\Utils\DateTime;
|
||||
use Espo\Core\Utils\Number;
|
||||
|
||||
require('vendor/zordius/lightncandy/src/lightncandy.php');
|
||||
|
||||
class Htmlizer
|
||||
{
|
||||
protected $fileManager;
|
||||
|
||||
protected $dateTime;
|
||||
|
||||
protected $config;
|
||||
|
||||
protected $acl;
|
||||
|
||||
public function __construct(FileManager $fileManager, DateTime $dateTime, Number $number, $acl = null)
|
||||
{
|
||||
$this->fileManager = $fileManager;
|
||||
$this->dateTime = $dateTime;
|
||||
$this->number = $number;
|
||||
$this->acl = $acl;
|
||||
}
|
||||
|
||||
protected function getAcl()
|
||||
{
|
||||
return $this->acl;
|
||||
}
|
||||
|
||||
protected function formatNumber($value)
|
||||
{
|
||||
return $this->number->format($value);
|
||||
}
|
||||
|
||||
protected function format($value)
|
||||
{
|
||||
if (is_float($value) || is_int($value)) {
|
||||
$value = $this->formatNumber($value);
|
||||
} else if (is_string($value)) {
|
||||
$value = nl2br($value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function getDataFromEntity(Entity $entity, $skipLinks = false)
|
||||
{
|
||||
$data = $entity->toArray();
|
||||
|
||||
$fieldDefs = $entity->getFields();
|
||||
$fieldList = array_keys($fieldDefs);
|
||||
|
||||
$forbidenAttributeList = [];
|
||||
|
||||
if ($this->getAcl()) {
|
||||
$forbidenAttributeList = $this->getAcl()->getScopeForbiddenAttributeList($entity->getEntityType(), 'read');
|
||||
}
|
||||
|
||||
foreach ($fieldList as $field) {
|
||||
if (in_array($field, $forbidenAttributeList)) continue;
|
||||
|
||||
|
||||
$type = $entity->getAttributeType($field);
|
||||
|
||||
if ($type == Entity::DATETIME) {
|
||||
if (!empty($data[$field])) {
|
||||
$data[$field] = $this->dateTime->convertSystemDateTime($data[$field]);
|
||||
}
|
||||
} else if ($type == Entity::DATE) {
|
||||
if (!empty($data[$field])) {
|
||||
$data[$field] = $this->dateTime->convertSystemDate($data[$field]);
|
||||
}
|
||||
} else if ($type == Entity::JSON_ARRAY) {
|
||||
if (!empty($data[$field])) {
|
||||
$list = $data[$field];
|
||||
$newList = [];
|
||||
foreach ($list as $item) {
|
||||
$v = $item;
|
||||
if ($item instanceof \StdClass) {
|
||||
$v = get_object_vars($v);
|
||||
}
|
||||
foreach ($v as $k => $w) {
|
||||
$v[$k] = $this->format($v[$k]);
|
||||
}
|
||||
$newList[] = $v;
|
||||
}
|
||||
$data[$field] = $newList;
|
||||
}
|
||||
} else if ($type == Entity::JSON_OBJECT) {
|
||||
if (!empty($data[$field])) {
|
||||
$value = $data[$field];
|
||||
if ($value instanceof \StdClass) {
|
||||
$data[$field] = get_object_vars($value);
|
||||
}
|
||||
foreach ($data[$field] as $k => $w) {
|
||||
$data[$field][$k] = $this->format($data[$field][$k]);
|
||||
}
|
||||
}
|
||||
} else if ($type === Entity::PASSWORD) {
|
||||
unset($data[$field]);
|
||||
}
|
||||
|
||||
if (array_key_exists($field, $data)) {
|
||||
$data[$field] = $this->format($data[$field]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$skipLinks) {
|
||||
$relationDefs = $entity->getRelations();
|
||||
foreach ($entity->getRelationList() as $relation) {
|
||||
if (
|
||||
!empty($relationDefs[$relation]['type'])
|
||||
&&
|
||||
($entity->getRelationType($relation) === 'belongsTo' || $entity->getRelationType($relation) === 'belongsToParent')
|
||||
) {
|
||||
$relatedEntity = $entity->get($relation);
|
||||
if (!$relatedEntity) continue;
|
||||
if ($this->getAcl()) {
|
||||
if (!$this->getAcl()->check($relatedEntity, 'read')) continue;
|
||||
}
|
||||
|
||||
$data[$relation] = $this->getDataFromEntity($relatedEntity, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function render(Entity $entity, $template, $id = null, $additionalData = array(), $skipLinks = false)
|
||||
{
|
||||
$code = \LightnCandy::compile($template);
|
||||
|
||||
$toRemove = false;
|
||||
if ($id === null) {
|
||||
$id = uniqid('', true);
|
||||
$toRemove = true;
|
||||
}
|
||||
|
||||
$fileName = 'data/cache/templates/' . $id . '.php';
|
||||
|
||||
$this->fileManager->putContents($fileName, $code);
|
||||
$renderer = $this->fileManager->getPhpContents($fileName);
|
||||
|
||||
if ($toRemove) {
|
||||
$this->fileManager->removeFile($fileName);
|
||||
}
|
||||
|
||||
$data = $this->getDataFromEntity($entity, $skipLinks);
|
||||
|
||||
foreach ($additionalData as $k => $value) {
|
||||
$data[$k] = $value;
|
||||
}
|
||||
|
||||
$html = $renderer($data);
|
||||
|
||||
$html = str_replace('?entryPoint=attachment&', '?entryPoint=attachment&', $html);
|
||||
$html = preg_replace('/\?entryPoint=attachment\&id=(.*)/', 'data/upload/$1', $html);
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,14 +18,21 @@
|
||||
*
|
||||
* 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\Core\Interfaces;
|
||||
|
||||
interface Injectable
|
||||
{
|
||||
public function getDependencyList();
|
||||
|
||||
|
||||
public function inject($name, $object);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Interfaces;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,13 +18,19 @@
|
||||
*
|
||||
* 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\Core\Jobs;
|
||||
|
||||
use \Espo\Core\Container;
|
||||
|
||||
|
||||
abstract class Base
|
||||
{
|
||||
private $container;
|
||||
@@ -64,7 +70,5 @@ abstract class Base
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
abstract public function run();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Loaders;
|
||||
|
||||
43
application/Espo/Core/Loaders/EmailFilterManager.php
Normal file
43
application/Espo/Core/Loaders/EmailFilterManager.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core\Loaders;
|
||||
|
||||
class EmailFilterManager extends Base
|
||||
{
|
||||
public function load()
|
||||
{
|
||||
$emailFilterManager = new \Espo\Core\Utils\EmailFilterManager(
|
||||
$this->getContainer()->get('entityManager')
|
||||
);
|
||||
|
||||
return $emailFilterManager;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,13 @@
|
||||
*
|
||||
* 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\Core\Loaders;
|
||||
@@ -33,9 +40,12 @@ class EntityManager extends Base
|
||||
'port' => $config->get('database.port'),
|
||||
'dbname' => $config->get('database.dbname'),
|
||||
'user' => $config->get('database.user'),
|
||||
'charset' => $config->get('database.charset', 'utf8'),
|
||||
'password' => $config->get('database.password'),
|
||||
'metadata' => $this->getContainer()->get('metadata')->getOrmMetadata(),
|
||||
'repositoryFactoryClassName' => '\\Espo\\Core\\ORM\\RepositoryFactory',
|
||||
'driver' => $config->get('database.driver'),
|
||||
'platform' => $config->get('database.platform')
|
||||
);
|
||||
|
||||
$entityManager = new \Espo\Core\ORM\EntityManager($params);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
@@ -18,35 +18,28 @@
|
||||
*
|
||||
* 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\Core\Loaders;
|
||||
|
||||
use Espo\Core\Utils,
|
||||
Espo\Core\Utils\Log\Monolog\Handler;
|
||||
|
||||
class Log extends Base
|
||||
class EntityManagerUtil extends Base
|
||||
{
|
||||
public function load()
|
||||
{
|
||||
$logConfig = $this->getContainer()->get('config')->get('logger');
|
||||
$entityManager = new \Espo\Core\Utils\EntityManager(
|
||||
$this->getContainer()->get('metadata'),
|
||||
$this->getContainer()->get('language'),
|
||||
$this->getContainer()->get('fileManager')
|
||||
);
|
||||
|
||||
$log = new Utils\Log('Espo');
|
||||
|
||||
$levelCode = $log->getLevelCode($logConfig['level']);
|
||||
|
||||
if ($logConfig['isRotate']) {
|
||||
$handler = new Handler\RotatingFileHandler($logConfig['path'], $logConfig['maxRotateFiles'], $levelCode);
|
||||
} else {
|
||||
$handler = new Handler\StreamHandler($logConfig['path'], $levelCode);
|
||||
}
|
||||
$log->pushHandler($handler);
|
||||
|
||||
$errorHandler = new \Monolog\ErrorHandler($log);
|
||||
$errorHandler->registerExceptionHandler(null, false);
|
||||
$errorHandler->registerErrorHandler(array(), false);
|
||||
|
||||
return $log;
|
||||
return $entityManager;
|
||||
}
|
||||
}
|
||||
|
||||
120
application/Espo/Core/Mail/FiltersMatcher.php
Normal file
120
application/Espo/Core/Mail/FiltersMatcher.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core\Mail;
|
||||
|
||||
|
||||
use \Espo\Entities\Email;
|
||||
|
||||
class FiltersMatcher
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function match(Email $email, $subject, $skipBody = false)
|
||||
{
|
||||
if (is_array($subject) || $subject instanceof \Traversable) {
|
||||
$filterList = $subject;
|
||||
} else {
|
||||
$filterList = [$subject];
|
||||
}
|
||||
|
||||
foreach ($filterList as $filter) {
|
||||
if ($filter->get('from')) {
|
||||
if ($this->matchString(strtolower($filter->get('from')), strtolower($email->get('from')))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ($filter->get('to')) {
|
||||
if ($email->get('to')) {
|
||||
$toArr = explode(';', $email->get('to'));
|
||||
foreach ($toArr as $to) {
|
||||
if ($this->matchString(strtolower($filter->get('to')), strtolower($to))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($filter->get('subject')) {
|
||||
if ($this->matchString($filter->get('subject'), $email->get('name'))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$skipBody) {
|
||||
if ($this->matchBody($email, $filterList)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function matchBody(Email $email, $subject)
|
||||
{
|
||||
if (is_array($subject) || $subject instanceof \Traversable) {
|
||||
$filterList = $subject;
|
||||
} else {
|
||||
$filterList = [$subject];
|
||||
}
|
||||
|
||||
foreach ($filterList as $filter) {
|
||||
if ($filter->get('bodyContains')) {
|
||||
$phraseList = $filter->get('bodyContains');
|
||||
$body = $email->get('body');
|
||||
$bodyPlain = $email->get('bodyPlain');
|
||||
foreach ($phraseList as $phrase) {
|
||||
if (stripos($bodyPlain, $phrase) !== false) {
|
||||
return true;
|
||||
}
|
||||
if (stripos($body, $phrase) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function matchString($pattern, $value)
|
||||
{
|
||||
if ($pattern == $value) {
|
||||
return true;
|
||||
}
|
||||
$pattern = preg_quote($pattern, '#');
|
||||
$pattern = str_replace('\*', '.*', $pattern).'\z';
|
||||
if (preg_match('#^'.$pattern.'#', $value)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,207 +1,547 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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\Core\Mail;
|
||||
|
||||
use \Zend\Mime\Mime as Mime;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
use \Espo\ORM\Email;
|
||||
|
||||
class Importer
|
||||
{
|
||||
{
|
||||
private $entityManager;
|
||||
|
||||
private $fileManager;
|
||||
|
||||
public function __construct($entityManager, $fileManager)
|
||||
|
||||
private $config;
|
||||
|
||||
private $filtersMatcher;
|
||||
|
||||
public function __construct($entityManager, $config)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
$this->fileManager = $fileManager;
|
||||
$this->config = $config;
|
||||
$this->filtersMatcher = new FiltersMatcher();
|
||||
}
|
||||
|
||||
|
||||
protected function getEntityManager()
|
||||
{
|
||||
return $this->entityManager;
|
||||
}
|
||||
|
||||
protected function getFileManager()
|
||||
|
||||
protected function getConfig()
|
||||
{
|
||||
return $this->fileManager;
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
public function importMessage($message, $userId, $teamsIds = array())
|
||||
|
||||
protected function getFiltersMatcher()
|
||||
{
|
||||
return $this->filtersMatcher;
|
||||
}
|
||||
|
||||
public function importMessage($message, $assignedUserId = null, $teamsIdList = [], $userIdList = [], $filterList = [], $fetchOnlyHeader = false, $folderData = null)
|
||||
{
|
||||
try {
|
||||
$email = $this->getEntityManager()->getEntity('Email');
|
||||
|
||||
|
||||
$email->set('isBeingImported', true);
|
||||
|
||||
$subject = $message->subject;
|
||||
if ($subject !== '0' && empty($subject)) {
|
||||
$subject = '--empty--';
|
||||
if (!empty($subject) && is_string($subject)) {
|
||||
$subject = trim($subject);
|
||||
}
|
||||
|
||||
$email->set('isHtml', false);
|
||||
if ($subject !== '0' && empty($subject)) {
|
||||
$subject = '(No Subject)';
|
||||
}
|
||||
|
||||
$email->set('isHtml', false);
|
||||
$email->set('name', $subject);
|
||||
$email->set('status', 'Archived');
|
||||
$email->set('attachmentsIds', array());
|
||||
$email->set('assignedUserId', $userId);
|
||||
$email->set('teamsIds', $teamsIds);
|
||||
|
||||
$fromArr = $this->getAddressListFromMessage($message, 'from');
|
||||
$email->set('attachmentsIds', []);
|
||||
if ($assignedUserId) {
|
||||
$email->set('assignedUserId', $assignedUserId);
|
||||
$email->addLinkMultipleId('assignedUsers', $assignedUserId);
|
||||
}
|
||||
$email->set('teamsIds', $teamsIdList);
|
||||
|
||||
if (!empty($userIdList)) {
|
||||
foreach ($userIdList as $uId) {
|
||||
$email->addLinkMultipleId('users', $uId);
|
||||
}
|
||||
}
|
||||
|
||||
$fromArr = $this->getAddressListFromMessage($message, 'from');
|
||||
if (isset($message->from)) {
|
||||
$email->set('fromName', $message->from);
|
||||
}
|
||||
$email->set('fromString', $message->from);
|
||||
}
|
||||
if (isset($message->replyTo)) {
|
||||
$email->set('replyToString', $message->replyTo);
|
||||
}
|
||||
|
||||
$toArr = $this->getAddressListFromMessage($message, 'to');
|
||||
$ccArr = $this->getAddressListFromMessage($message, 'cc');
|
||||
$replyToArr = $this->getAddressListFromMessage($message, 'replyTo');
|
||||
|
||||
$email->set('from', $fromArr[0]);
|
||||
$email->set('to', implode(';', $this->getAddressListFromMessage($message, 'to')));
|
||||
$email->set('cc', implode(';', $this->getAddressListFromMessage($message, 'cc')));
|
||||
|
||||
if (isset($message->messageId) && !empty($message->messageId)) {
|
||||
$email->set('to', implode(';', $toArr));
|
||||
$email->set('cc', implode(';', $ccArr));
|
||||
$email->set('replyTo', implode(';', $replyToArr));
|
||||
|
||||
if ($folderData) {
|
||||
foreach ($folderData as $uId => $folderId) {
|
||||
$email->setLinkMultipleColumn('users', 'folderId', $uId, $folderId);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->getFiltersMatcher()->match($email, $filterList, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($message->messageId) && !empty($message->messageId)) {
|
||||
$email->set('messageId', $message->messageId);
|
||||
if (isset($message->deliveredTo)) {
|
||||
$email->set('messageIdInternal', $message->messageId . '-' . $message->deliveredTo);
|
||||
}
|
||||
if (stripos($message->messageId, '@espo-system') !== false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($duplicate = $this->findDuplicate($email)) {
|
||||
if ($assignedUserId) {
|
||||
$duplicate->addLinkMultipleId('users', $assignedUserId);
|
||||
$duplicate->addLinkMultipleId('assignedUsers', $assignedUserId);
|
||||
}
|
||||
if (!empty($userIdList)) {
|
||||
foreach ($userIdList as $uId) {
|
||||
$duplicate->addLinkMultipleId('users', $uId);
|
||||
}
|
||||
}
|
||||
|
||||
if ($folderData) {
|
||||
foreach ($folderData as $uId => $folderId) {
|
||||
$email->setLinkMultipleColumn('users', 'folderId', $uId, $folderId);
|
||||
}
|
||||
}
|
||||
|
||||
$duplicate->set('isBeingImported', true);
|
||||
|
||||
$this->getEntityManager()->saveEntity($duplicate);
|
||||
|
||||
if (!empty($teamsIdList)) {
|
||||
foreach ($teamsIdList as $teamId) {
|
||||
$this->getEntityManager()->getRepository('Email')->relate($duplicate, 'teams', $teamId);
|
||||
}
|
||||
}
|
||||
return $duplicate;
|
||||
}
|
||||
|
||||
if ($this->checkIsDuplicate($email)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($message->date)) {
|
||||
$dt = new \DateTime($message->date);
|
||||
if ($dt) {
|
||||
$dateSent = $dt->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d H:i:s');
|
||||
$dateSent = $dt->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d H:i:s');
|
||||
$email->set('dateSent', $dateSent);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$email->set('dateSent', date('Y-m-d H:i:s'));
|
||||
}
|
||||
if (isset($message->deliveryDate)) {
|
||||
$dt = new \DateTime($message->deliveryDate);
|
||||
if ($dt) {
|
||||
$deliveryDate = $dt->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d H:i:s');
|
||||
$deliveryDate = $dt->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d H:i:s');
|
||||
$email->set('deliveryDate', $deliveryDate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$inlineIds = array();
|
||||
|
||||
if ($message->isMultipart()) {
|
||||
foreach (new \RecursiveIteratorIterator($message) as $part) {
|
||||
$this->importPartDataToEmail($email, $part, $inlineIds);
|
||||
}
|
||||
} else {
|
||||
$this->importPartDataToEmail($email, $message, $inlineIds);
|
||||
}
|
||||
|
||||
$body = $email->get('body');
|
||||
if (!empty($body)) {
|
||||
foreach ($inlineIds as $cid => $attachmentId) {
|
||||
$body = str_replace('cid:' . $cid, '?entryPoint=attachment&id=' . $attachmentId, $body);
|
||||
|
||||
if (!$fetchOnlyHeader) {
|
||||
if ($message->isMultipart()) {
|
||||
foreach (new \RecursiveIteratorIterator($message) as $part) {
|
||||
$this->importPartDataToEmail($email, $part, $inlineIds);
|
||||
}
|
||||
} else {
|
||||
$this->importPartDataToEmail($email, $message, $inlineIds, 'text/plain');
|
||||
}
|
||||
|
||||
if (!$email->get('body') && $email->get('bodyPlain')) {
|
||||
$email->set('body', $email->get('bodyPlain'));
|
||||
}
|
||||
|
||||
$body = $email->get('body');
|
||||
if (!empty($body)) {
|
||||
foreach ($inlineIds as $cid => $attachmentId) {
|
||||
if (strpos($body, 'cid:' . $cid) !== false) {
|
||||
$body = str_replace('cid:' . $cid, '?entryPoint=attachment&id=' . $attachmentId, $body);
|
||||
} else {
|
||||
$email->addLinkMultipleId('attachments', $attachmentId);
|
||||
}
|
||||
}
|
||||
$email->set('body', $body);
|
||||
}
|
||||
|
||||
if ($this->getFiltersMatcher()->matchBody($email, $filterList)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$email->set('body', '(Not fetched)');
|
||||
$email->set('isHtml', false);
|
||||
}
|
||||
|
||||
$parentFound = false;
|
||||
|
||||
$replied = null;
|
||||
if (isset($message->inReplyTo) && !empty($message->inReplyTo)) {
|
||||
$arr = explode(' ', $message->inReplyTo);
|
||||
$inReplyTo = $arr[0];
|
||||
$replied = $this->getEntityManager()->getRepository('Email')->where(array(
|
||||
'messageId' => $inReplyTo
|
||||
))->findOne();
|
||||
if ($replied) {
|
||||
$email->set('repliedId', $replied->id);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($message->references) && !empty($message->references)) {
|
||||
$arr = explode(' ', $message->references);
|
||||
$reference = $arr[0];
|
||||
$reference = str_replace(array('/', '@'), " ", trim($reference, '<>'));
|
||||
$parentType = $parentId = null;
|
||||
$emailSent = PHP_INT_MAX;
|
||||
$n = sscanf($reference, '%s %s %d %d espo', $parentType, $parentId, $emailSent, $number);
|
||||
if ($n == 4 && $emailSent < time()) {
|
||||
if (!empty($parentType) && !empty($parentId)) {
|
||||
if ($parentType == 'Lead') {
|
||||
$parent = $this->getEntityManager()->getEntity('Lead', $parentId);
|
||||
if ($parent && $parent->get('status') == 'Converted') {
|
||||
if ($parent->get('createdAccountId')) {
|
||||
$account = $this->getEntityManager()->getEntity('Account', $parent->get('createdAccountId'));
|
||||
if ($account) {
|
||||
$parentType = 'Account';
|
||||
$parentId = $account->id;
|
||||
}
|
||||
} else {
|
||||
if ($this->getConfig()->get('b2cMode')) {
|
||||
if ($parent->get('createdContactId')) {
|
||||
$contact = $this->getEntityManager()->getEntity('Contact', $parent->get('createdContactId'));
|
||||
if ($contact) {
|
||||
$parentType = 'Contact';
|
||||
$parentId = $contact->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$email->set('parentType', $parentType);
|
||||
$email->set('parentId', $parentId);
|
||||
$parentFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$parentFound) {
|
||||
if ($replied && $replied->get('parentId') && $replied->get('parentType')) {
|
||||
$parentFound = $this->getEntityManager()->getEntity($replied->get('parentType'), $replied->get('parentId'));
|
||||
if ($parentFound) {
|
||||
$email->set('parentType', $replied->get('parentType'));
|
||||
$email->set('parentId', $replied->get('parentId'));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$parentFound) {
|
||||
$from = $email->get('from');
|
||||
if ($from) {
|
||||
$parentFound = $this->findParent($email, $from);
|
||||
}
|
||||
}
|
||||
if (!$parentFound) {
|
||||
if (!empty($replyToArr)) {
|
||||
$parentFound = $this->findParent($email, $replyToArr[0]);
|
||||
}
|
||||
}
|
||||
if (!$parentFound) {
|
||||
if (!empty($toArr)) {
|
||||
$parentFound = $this->findParent($email, $toArr[0]);
|
||||
}
|
||||
$email->set('body', $body);
|
||||
}
|
||||
|
||||
$this->getEntityManager()->saveEntity($email);
|
||||
|
||||
|
||||
return $email;
|
||||
|
||||
|
||||
} catch (\Exception $e) {}
|
||||
}
|
||||
|
||||
protected function checkIsDuplicate($email)
|
||||
|
||||
protected function findParent(Entity $email, $emailAddress)
|
||||
{
|
||||
if ($email->get('messageIdInternal')) {
|
||||
$contact = $this->getEntityManager()->getRepository('Contact')->where(array(
|
||||
'emailAddress' => $emailAddress
|
||||
))->findOne();
|
||||
if ($contact) {
|
||||
if (!$this->getConfig()->get('b2cMode')) {
|
||||
if ($contact->get('accountId')) {
|
||||
$email->set('parentType', 'Account');
|
||||
$email->set('parentId', $contact->get('accountId'));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
$email->set('parentType', 'Contact');
|
||||
$email->set('parentId', $contact->id);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
$account = $this->getEntityManager()->getRepository('Account')->where(array(
|
||||
'emailAddress' => $emailAddress
|
||||
))->findOne();
|
||||
if ($account) {
|
||||
$email->set('parentType', 'Account');
|
||||
$email->set('parentId', $account->id);
|
||||
return true;
|
||||
} else {
|
||||
$lead = $this->getEntityManager()->getRepository('Lead')->where(array(
|
||||
'emailAddress' => $emailAddress
|
||||
))->findOne();
|
||||
if ($lead) {
|
||||
$email->set('parentType', 'Lead');
|
||||
$email->set('parentId', $lead->id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function findDuplicate(Entity $email)
|
||||
{
|
||||
if ($email->get('messageId')) {
|
||||
$duplicate = $this->getEntityManager()->getRepository('Email')->where(array(
|
||||
'messageIdInternal' => $email->get('messageIdInternal')
|
||||
'messageId' => $email->get('messageId')
|
||||
))->findOne();
|
||||
if ($duplicate) {
|
||||
return true;
|
||||
return $duplicate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function normilizeHeader($header)
|
||||
{
|
||||
if (is_a($header, 'ArrayIterator')) {
|
||||
return $header->current();
|
||||
} else {
|
||||
return $header;
|
||||
}
|
||||
}
|
||||
|
||||
protected function getAddressListFromMessage($message, $type)
|
||||
{
|
||||
$addressList = array();
|
||||
if (isset($message->$type)) {
|
||||
|
||||
$list = $message->getHeader($type)->getAddressList();
|
||||
$list = $this->normilizeHeader($message->getHeader($type))->getAddressList();
|
||||
foreach ($list as $address) {
|
||||
$addressList[] = $address->getEmail();
|
||||
}
|
||||
}
|
||||
return $addressList;
|
||||
}
|
||||
|
||||
protected function importPartDataToEmail(\Espo\Entities\Email $email, $part, &$inlineIds = array())
|
||||
{
|
||||
|
||||
protected function importPartDataToEmail(\Espo\Entities\Email $email, $part, &$inlineIds = array(), $defaultContentType = null)
|
||||
{
|
||||
try {
|
||||
$type = strtok($part->contentType, ';');
|
||||
$type = null;
|
||||
|
||||
if ($part->getHeaders() && isset($part->contentType)) {
|
||||
$type = strtok($part->contentType, ';');
|
||||
}
|
||||
|
||||
$contentDisposition = false;
|
||||
if (isset($part->ContentDisposition)) {
|
||||
if (strpos(strtolower($part->ContentDisposition), 'attachment') === 0) {
|
||||
$contentDisposition = 'attachment';
|
||||
} else if (strpos(strtolower($part->ContentDisposition), 'inline') === 0) {
|
||||
$contentDisposition = 'inline';
|
||||
}
|
||||
} else if (isset($part->contentID)) {
|
||||
$contentDisposition = 'inline';
|
||||
}
|
||||
|
||||
if (empty($type)) {
|
||||
if (!empty($defaultContentType)) {
|
||||
$type = $defaultContentType;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$encoding = null;
|
||||
|
||||
switch ($type) {
|
||||
case 'text/plain':
|
||||
$content = $this->getContentFromPart($part);
|
||||
if (!$email->get('body')) {
|
||||
$email->set('body', $content);
|
||||
}
|
||||
$email->set('bodyPlain', $content);
|
||||
break;
|
||||
case 'text/html':
|
||||
$isAttachment = true;
|
||||
if ($type == 'text/plain' || $type == 'text/html') {
|
||||
if ($contentDisposition !== 'attachment') {
|
||||
$isAttachment = false;
|
||||
$content = $this->getContentFromPart($part);
|
||||
$email->set('body', $content);
|
||||
$email->set('isHtml', true);
|
||||
break;
|
||||
default:
|
||||
$content = $part->getContent();
|
||||
$disposition = null;
|
||||
|
||||
$fileName = null;
|
||||
$contentId = null;
|
||||
|
||||
if (isset($part->ContentDisposition)) {
|
||||
if (strpos($part->ContentDisposition, 'attachment') === 0) {
|
||||
if (preg_match('/filename="?([^"]+)"?/i', $part->ContentDisposition, $m)) {
|
||||
$fileName = $m[1];
|
||||
$disposition = 'attachment';
|
||||
}
|
||||
} else if (strpos($part->ContentDisposition, 'inline') === 0) {
|
||||
if ($type == 'text/plain') {
|
||||
$bodyPlain = '';
|
||||
if ($email->get('bodyPlain')) {
|
||||
$bodyPlain .= $email->get('bodyPlain') . "\n";
|
||||
}
|
||||
$bodyPlain .= $content;
|
||||
$email->set('bodyPlain', $bodyPlain);
|
||||
} else if ($type == 'text/html') {
|
||||
$body = '';
|
||||
if ($email->get('body')) {
|
||||
$body .= $email->get('body') . "<br>";
|
||||
}
|
||||
$body .= $content;
|
||||
$email->set('isHtml', true);
|
||||
$email->set('body', $body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($isAttachment) {
|
||||
$content = $part->getContent();
|
||||
$disposition = null;
|
||||
|
||||
$fileName = null;
|
||||
$contentId = null;
|
||||
|
||||
if ($contentDisposition) {
|
||||
if ($contentDisposition === 'attachment') {
|
||||
$fileName = $this->fetchFileNameFromContentDisposition($part->ContentDisposition);
|
||||
if ($fileName) {
|
||||
$disposition = 'attachment';
|
||||
}
|
||||
} else if ($contentDisposition === 'inline') {
|
||||
if (isset($part->contentID)) {
|
||||
$contentId = trim($part->contentID, '<>');
|
||||
$fileName = $contentId;
|
||||
$disposition = 'inline';
|
||||
}
|
||||
} else {
|
||||
// for iOS attachments
|
||||
if (empty($fileName)) {
|
||||
$fileName = $this->fetchFileNameFromContentDisposition($part->ContentDisposition);
|
||||
if ($fileName) {
|
||||
$disposition = 'attachment';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($part->contentTransferEncoding)) {
|
||||
$encoding = strtolower($part->getHeader('Content-Transfer-Encoding')->getTransferEncoding());
|
||||
}
|
||||
|
||||
$attachment = $this->getEntityManager()->getEntity('Attachment');
|
||||
$attachment->set('name', $fileName);
|
||||
$attachment->set('type', $type);
|
||||
|
||||
if ($disposition == 'inline') {
|
||||
$attachment->set('role', 'Inline Attachment');
|
||||
} else {
|
||||
$attachment->set('role', 'Attachment');
|
||||
}
|
||||
|
||||
if ($encoding == 'base64') {
|
||||
$content = base64_decode($content);
|
||||
}
|
||||
|
||||
$attachment->set('size', strlen($content));
|
||||
|
||||
$this->getEntityManager()->saveEntity($attachment);
|
||||
|
||||
$path = 'data/upload/' . $attachment->id;
|
||||
$this->getFileManager()->putContents($path, $content);
|
||||
|
||||
if ($disposition == 'attachment') {
|
||||
$attachmentsIds = $email->get('attachmentsIds');
|
||||
$attachmentsIds[] = $attachment->id;
|
||||
$email->set('attachmentsIds', $attachmentsIds);
|
||||
} else if ($disposition == 'inline') {
|
||||
$inlineIds[$contentId] = $attachment->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($part->contentTransferEncoding)) {
|
||||
$encoding = strtolower($this->normilizeHeader($part->getHeader('Content-Transfer-Encoding'))->getTransferEncoding());
|
||||
}
|
||||
|
||||
$attachment = $this->getEntityManager()->getEntity('Attachment');
|
||||
$attachment->set('name', $fileName);
|
||||
$attachment->set('type', $type);
|
||||
|
||||
if ($disposition == 'inline') {
|
||||
$attachment->set('role', 'Inline Attachment');
|
||||
} else {
|
||||
$attachment->set('role', 'Attachment');
|
||||
}
|
||||
|
||||
if ($encoding == 'base64') {
|
||||
$content = base64_decode($content);
|
||||
}
|
||||
|
||||
$attachment->set('contents', $content);
|
||||
|
||||
$this->getEntityManager()->saveEntity($attachment);
|
||||
|
||||
if ($disposition == 'attachment') {
|
||||
$attachmentsIds = $email->get('attachmentsIds');
|
||||
$attachmentsIds[] = $attachment->id;
|
||||
$email->set('attachmentsIds', $attachmentsIds);
|
||||
} else if ($disposition == 'inline') {
|
||||
$inlineIds[$contentId] = $attachment->id;
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {}
|
||||
} catch (\Exception $e) {}
|
||||
}
|
||||
|
||||
|
||||
protected function decodeAttachmentFileName($fileName)
|
||||
{
|
||||
if ($fileName && stripos($fileName, "''") !== false) {
|
||||
list($encoding, $fileName) = explode("''", $fileName);
|
||||
$fileName = rawurldecode($fileName);
|
||||
if (strtoupper($encoding) !== 'UTF-8') {
|
||||
if ($encoding) {
|
||||
$fileName = mb_convert_encoding($fileName, 'UTF-8', $encoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $fileName;
|
||||
}
|
||||
|
||||
protected function fetchFileNameFromContentDisposition($contentDisposition)
|
||||
{
|
||||
$contentDisposition = preg_replace('/\\\\"/', "{{_!Q!U!O!T!E!_}}", $contentDisposition);
|
||||
|
||||
$fileName = false;
|
||||
$m = array();
|
||||
|
||||
if (preg_match('/filename="([^"]+)";?/i', $contentDisposition, $m)) {
|
||||
$fileName = $m[1];
|
||||
} else if (preg_match('/filename=([^";]+);?/i', $contentDisposition, $m)) {
|
||||
$fileName = $m[1];
|
||||
} else if (preg_match('/filename\*="([^"]+)";?/i', $contentDisposition, $m)) {
|
||||
$fileName = $m[1];
|
||||
$fileName = $this->decodeAttachmentFileName($fileName);
|
||||
} else if (preg_match('/filename\*=([^";]+);?/i', $contentDisposition, $m)) {
|
||||
$fileName = $m[1];
|
||||
$fileName = $this->decodeAttachmentFileName($fileName);
|
||||
} else {
|
||||
$fileName = '';
|
||||
foreach (['0', '1'] as $i) {
|
||||
if (preg_match('/filename\*'.$i.'[\*]?="([^"]+)";?/i', $contentDisposition, $m)) {
|
||||
$part = $m[1];
|
||||
$fileName .= $part;
|
||||
} else if (preg_match('/filename\*'.$i.'[\*]?=([^";]+);?/i', $contentDisposition, $m)) {
|
||||
$part = $m[1];
|
||||
$fileName .= $part;
|
||||
}
|
||||
}
|
||||
|
||||
if ($fileName === '') {
|
||||
$fileName = null;
|
||||
} else {
|
||||
$fileName = $this->decodeAttachmentFileName($fileName);
|
||||
}
|
||||
}
|
||||
|
||||
if ($fileName) {
|
||||
$fileName = str_replace('{{_!Q!U!O!T!E!_}}', '"', $fileName);
|
||||
}
|
||||
|
||||
return $fileName;
|
||||
}
|
||||
|
||||
protected function getContentFromPart($part)
|
||||
{
|
||||
if ($part instanceof \Zend\Mime\Part) {
|
||||
@@ -211,38 +551,38 @@ class Importer
|
||||
}
|
||||
} else {
|
||||
$content = $part->getContent();
|
||||
|
||||
|
||||
$encoding = null;
|
||||
|
||||
|
||||
if (isset($part->contentTransferEncoding)) {
|
||||
$cteHeader = $part->getHeader('Content-Transfer-Encoding');
|
||||
$cteHeader = $this->normilizeHeader($part->getHeader('Content-Transfer-Encoding'));
|
||||
$encoding = strtolower($cteHeader->getTransferEncoding());
|
||||
}
|
||||
|
||||
|
||||
if ($encoding == 'base64') {
|
||||
$content = base64_decode($content);
|
||||
}
|
||||
|
||||
$charset = 'UTF-8';
|
||||
|
||||
|
||||
$charset = 'UTF-8';
|
||||
|
||||
if (isset($part->contentType)) {
|
||||
$ctHeader = $part->getHeader('Content-Type');
|
||||
$ctHeader = $this->normilizeHeader($part->getHeader('Content-Type'));
|
||||
$charsetParamValue = $ctHeader->getParameter('charset');
|
||||
if (!empty($charsetParamValue)) {
|
||||
$charset = strtoupper($charsetParamValue);
|
||||
}
|
||||
}
|
||||
|
||||
if ($charset !== 'UTF-8') {
|
||||
$content = mb_convert_encoding($content, 'UTF-8', $charset);
|
||||
}
|
||||
|
||||
|
||||
if (isset($part->contentTransferEncoding)) {
|
||||
$cteHeader = $part->getHeader('Content-Transfer-Encoding');
|
||||
if ($cteHeader->getTransferEncoding() == 'quoted-printable') {
|
||||
$cteHeader = $this->normilizeHeader($part->getHeader('Content-Transfer-Encoding'));
|
||||
if ($cteHeader->getTransferEncoding() == 'quoted-printable') {
|
||||
$content = quoted_printable_decode($content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($charset !== 'UTF-8') {
|
||||
$content = mb_convert_encoding($content, 'UTF-8', $charset);
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
102
application/Espo/Core/Mail/Mail/Header/XQueueItemId.php
Normal file
102
application/Espo/Core/Mail/Mail/Header/XQueueItemId.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
*
|
||||
* 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.
|
||||
************************************************************************/
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Espo\Core\Mail\Mail\Header;
|
||||
|
||||
use \Zend\Mail\Header;
|
||||
use Zend\Mime\Mime;
|
||||
|
||||
class XQueueItemId implements Header\HeaderInterface
|
||||
{
|
||||
protected $fieldName = 'X-QueueItemId';
|
||||
|
||||
protected $id = null;
|
||||
|
||||
public static function fromString($headerLine)
|
||||
{
|
||||
list($name, $value) = Header\GenericHeader::splitHeaderLine($headerLine);
|
||||
$value = Header\HeaderWrap::mimeDecodeValue($value);
|
||||
|
||||
if (strtolower($name) !== 'x-queue-item-id') {
|
||||
throw new Header\Exception\InvalidArgumentException('Invalid header line for Message-ID string');
|
||||
}
|
||||
|
||||
$header = new static();
|
||||
$header->setId($value);
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
public function getFieldName()
|
||||
{
|
||||
return $this->fieldName;
|
||||
}
|
||||
|
||||
public function setFieldName($value)
|
||||
{
|
||||
}
|
||||
|
||||
public function setEncoding($encoding)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getEncoding()
|
||||
{
|
||||
return 'ASCII';
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return $this->fieldName . ': ' . $this->getFieldValue();
|
||||
}
|
||||
|
||||
public function getFieldValue($format = Header\HeaderInterface::FORMAT_RAW)
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
48
application/Espo/Core/Mail/Mail/Headers.php
Normal file
48
application/Espo/Core/Mail/Mail/Headers.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://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.
|
||||
*
|
||||
* 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\Core\Mail\Mail;
|
||||
|
||||
use ArrayIterator;
|
||||
use Countable;
|
||||
use Iterator;
|
||||
use Traversable;
|
||||
use Zend\Loader\PluginClassLocator;
|
||||
|
||||
class Headers extends \Zend\Mail\Headers
|
||||
{
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user