Merge branch 'develop' of github.com:MISP/MISP into develop

pull/7273/head
iglocska 2021-03-30 09:40:02 +02:00
commit 7fbb47b7a4
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
13 changed files with 603 additions and 308 deletions

241
Pipfile.lock generated
View File

@ -14,76 +14,122 @@
]
},
"default": {
"antlr4-python3-runtime": {
"hashes": [
"sha256:15793f5d0512a372b4e7d2284058ad32ce7dd27126b105fb0b2245130445db33"
],
"markers": "python_version >= '3'",
"version": "==4.8"
},
"attrs": {
"hashes": [
"sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6",
"sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==20.3.0"
},
"certifi": {
"hashes": [
"sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c",
"sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"
],
"version": "==2020.12.5"
},
"chardet": {
"hashes": [
"sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa",
"sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==4.0.0"
},
"cybox": {
"hashes": [
"sha256:dc41405bd2ae14ddb2ca4ead00ed82b5cc098e079896d0c77c85a14560d00f04"
"sha256:19a588bcdce8f3a088f7d5edd3e8862c11b701bb3d64257b18f3092deb9c3b7a",
"sha256:8b12110180aceed0f85f8d6c1860a32a679c261f097d909384a81b3b73ff9716"
],
"index": "pypi",
"version": "==2.1.0.17"
"version": "==2.1.0.21"
},
"idna": {
"hashes": [
"sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6",
"sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.10"
},
"jsonschema": {
"hashes": [
"sha256:4e5b3cf8216f577bee9ce139cbe72eca3ea4f292ec60928ff24758ce626cd163",
"sha256:c8a85b28d377cc7737e46e2d9f2b4f44ee3c0e1deac6bf46ddefc7187d30797a"
],
"version": "==3.2.0"
},
"lxml": {
"hashes": [
"sha256:0448576c148c129594d890265b1a83b9cd76fd1f0a6a04620753d9a6bcfd0a4d",
"sha256:127f76864468d6630e1b453d3ffbbd04b024c674f55cf0a30dc2595137892d37",
"sha256:1471cee35eba321827d7d53d104e7b8c593ea3ad376aa2df89533ce8e1b24a01",
"sha256:2363c35637d2d9d6f26f60a208819e7eafc4305ce39dc1d5005eccc4593331c2",
"sha256:2e5cc908fe43fe1aa299e58046ad66981131a66aea3129aac7770c37f590a644",
"sha256:2e6fd1b8acd005bd71e6c94f30c055594bbd0aa02ef51a22bbfa961ab63b2d75",
"sha256:366cb750140f221523fa062d641393092813b81e15d0e25d9f7c6025f910ee80",
"sha256:42ebca24ba2a21065fb546f3e6bd0c58c3fe9ac298f3a320147029a4850f51a2",
"sha256:4e751e77006da34643ab782e4a5cc21ea7b755551db202bc4d3a423b307db780",
"sha256:4fb85c447e288df535b17ebdebf0ec1cf3a3f1a8eba7e79169f4f37af43c6b98",
"sha256:50c348995b47b5a4e330362cf39fc503b4a43b14a91c34c83b955e1805c8e308",
"sha256:535332fe9d00c3cd455bd3dd7d4bacab86e2d564bdf7606079160fa6251caacf",
"sha256:535f067002b0fd1a4e5296a8f1bf88193080ff992a195e66964ef2a6cfec5388",
"sha256:5be4a2e212bb6aa045e37f7d48e3e1e4b6fd259882ed5a00786f82e8c37ce77d",
"sha256:60a20bfc3bd234d54d49c388950195d23a5583d4108e1a1d47c9eef8d8c042b3",
"sha256:648914abafe67f11be7d93c1a546068f8eff3c5fa938e1f94509e4a5d682b2d8",
"sha256:681d75e1a38a69f1e64ab82fe4b1ed3fd758717bed735fb9aeaa124143f051af",
"sha256:68a5d77e440df94011214b7db907ec8f19e439507a70c958f750c18d88f995d2",
"sha256:69a63f83e88138ab7642d8f61418cf3180a4d8cd13995df87725cb8b893e950e",
"sha256:6e4183800f16f3679076dfa8abf2db3083919d7e30764a069fb66b2b9eff9939",
"sha256:6fd8d5903c2e53f49e99359b063df27fdf7acb89a52b6a12494208bf61345a03",
"sha256:791394449e98243839fa822a637177dd42a95f4883ad3dec2a0ce6ac99fb0a9d",
"sha256:7a7669ff50f41225ca5d6ee0a1ec8413f3a0d8aa2b109f86d540887b7ec0d72a",
"sha256:7e9eac1e526386df7c70ef253b792a0a12dd86d833b1d329e038c7a235dfceb5",
"sha256:7ee8af0b9f7de635c61cdd5b8534b76c52cd03536f29f51151b377f76e214a1a",
"sha256:8246f30ca34dc712ab07e51dc34fea883c00b7ccb0e614651e49da2c49a30711",
"sha256:8c88b599e226994ad4db29d93bc149aa1aff3dc3a4355dd5757569ba78632bdf",
"sha256:923963e989ffbceaa210ac37afc9b906acebe945d2723e9679b643513837b089",
"sha256:94d55bd03d8671686e3f012577d9caa5421a07286dd351dfef64791cf7c6c505",
"sha256:97db258793d193c7b62d4e2586c6ed98d51086e93f9a3af2b2034af01450a74b",
"sha256:a9d6bc8642e2c67db33f1247a77c53476f3a166e09067c0474facb045756087f",
"sha256:cd11c7e8d21af997ee8079037fff88f16fda188a9776eb4b81c7e4c9c0a7d7fc",
"sha256:d8d3d4713f0c28bdc6c806a278d998546e8efc3498949e3ace6e117462ac0a5e",
"sha256:e0bfe9bb028974a481410432dbe1b182e8191d5d40382e5b8ff39cdd2e5c5931",
"sha256:f4822c0660c3754f1a41a655e37cb4dbbc9be3d35b125a37fab6f82d47674ebc",
"sha256:f83d281bb2a6217cd806f4cf0ddded436790e66f393e124dfe9731f6b3fb9afe",
"sha256:fc37870d6716b137e80d19241d0e2cff7a7643b925dfa49b4c8ebd1295eb506e"
"sha256:079f3ae844f38982d156efce585bc540c16a926d4436712cf4baee0cce487a3d",
"sha256:0fbcf5565ac01dff87cbfc0ff323515c823081c5777a9fc7703ff58388c258c3",
"sha256:122fba10466c7bd4178b07dba427aa516286b846b2cbd6f6169141917283aae2",
"sha256:1b7584d421d254ab86d4f0b13ec662a9014397678a7c4265a02a6d7c2b18a75f",
"sha256:26e761ab5b07adf5f555ee82fb4bfc35bf93750499c6c7614bd64d12aaa67927",
"sha256:289e9ca1a9287f08daaf796d96e06cb2bc2958891d7911ac7cae1c5f9e1e0ee3",
"sha256:2a9d50e69aac3ebee695424f7dbd7b8c6d6eb7de2a2eb6b0f6c7db6aa41e02b7",
"sha256:33bb934a044cf32157c12bfcfbb6649807da20aa92c062ef51903415c704704f",
"sha256:3439c71103ef0e904ea0a1901611863e51f50b5cd5e8654a151740fde5e1cade",
"sha256:39b78571b3b30645ac77b95f7c69d1bffc4cf8c3b157c435a34da72e78c82468",
"sha256:4289728b5e2000a4ad4ab8da6e1db2e093c63c08bdc0414799ee776a3f78da4b",
"sha256:4bff24dfeea62f2e56f5bab929b4428ae6caba2d1eea0c2d6eb618e30a71e6d4",
"sha256:542d454665a3e277f76954418124d67516c5f88e51a900365ed54a9806122b83",
"sha256:5a0a14e264069c03e46f926be0d8919f4105c1623d620e7ec0e612a2e9bf1c04",
"sha256:66e575c62792c3f9ca47cb8b6fab9e35bab91360c783d1606f758761810c9791",
"sha256:74f7d8d439b18fa4c385f3f5dfd11144bb87c1da034a466c5b5577d23a1d9b51",
"sha256:7610b8c31688f0b1be0ef882889817939490a36d0ee880ea562a4e1399c447a1",
"sha256:76fa7b1362d19f8fbd3e75fe2fb7c79359b0af8747e6f7141c338f0bee2f871a",
"sha256:7728e05c35412ba36d3e9795ae8995e3c86958179c9770e65558ec3fdfd3724f",
"sha256:8157dadbb09a34a6bd95a50690595e1fa0af1a99445e2744110e3dca7831c4ee",
"sha256:820628b7b3135403540202e60551e741f9b6d3304371712521be939470b454ec",
"sha256:884ab9b29feaca361f7f88d811b1eea9bfca36cf3da27768d28ad45c3ee6f969",
"sha256:89b8b22a5ff72d89d48d0e62abb14340d9e99fd637d046c27b8b257a01ffbe28",
"sha256:92e821e43ad382332eade6812e298dc9701c75fe289f2a2d39c7960b43d1e92a",
"sha256:b007cbb845b28db4fb8b6a5cdcbf65bacb16a8bd328b53cbc0698688a68e1caa",
"sha256:bc4313cbeb0e7a416a488d72f9680fffffc645f8a838bd2193809881c67dd106",
"sha256:bccbfc27563652de7dc9bdc595cb25e90b59c5f8e23e806ed0fd623755b6565d",
"sha256:c4f05c5a7c49d2fb70223d0d5bcfbe474cf928310ac9fa6a7c6dddc831d0b1d4",
"sha256:ce256aaa50f6cc9a649c51be3cd4ff142d67295bfc4f490c9134d0f9f6d58ef0",
"sha256:d2e35d7bf1c1ac8c538f88d26b396e73dd81440d59c1ef8522e1ea77b345ede4",
"sha256:df7c53783a46febb0e70f6b05df2ba104610f2fb0d27023409734a3ecbb78fb2",
"sha256:efac139c3f0bf4f0939f9375af4b02c5ad83a622de52d6dfa8e438e8e01d0eb0",
"sha256:efd7a09678fd8b53117f6bae4fa3825e0a22b03ef0a932e070c0bdbb3a35e654",
"sha256:f2380a6376dfa090227b663f9678150ef27543483055cc327555fb592c5967e2",
"sha256:f8380c03e45cf09f8557bdaa41e1fa7c81f3ae22828e1db470ab2a6c96d8bc23",
"sha256:f90ba11136bfdd25cae3951af8da2e95121c9b9b93727b1b896e3fa105b2f586"
],
"index": "pypi",
"version": "==4.6.2"
"markers": "python_version == '2.7' and python_version >= '3.5'",
"version": "==4.6.3"
},
"maec": {
"hashes": [
"sha256:03e8f1396ae9357cab2ad43dc3784c4e659dc74222327eac75bc61a045cd4008",
"sha256:9e997ec9457a7a4bb8626a3f1374939ef20f793755f18accab5579f48114eb75"
"sha256:d163626a11f27e046c3013d313e5b53ba97f8a9f2f563ac523be55dda6420235",
"sha256:e6566684e606749ff75ef03f7c3454c6fff8f350fa159b4ef17cdd0e5c632ae6"
],
"index": "pypi",
"version": "==4.1.0.14"
"version": "==4.1.0.17"
},
"mixbox": {
"hashes": [
"sha256:53aca8c1038f09229a07f40553d9cbe33f9c81a89053dcd0853ce910e32cec40",
"sha256:dafff15018ac8906d1ee92fa4d3729e2385c438e8acdbfe67eb535e703ef3c4b"
"sha256:13c618a36967a6906d09e9e5be952656c78279b0e9cb5527e9360416e4d1c057",
"sha256:170551ec415a0705b3c26c92e3f75fe1cdc95cc7f71f2b6ada4248fb1e96d035"
],
"index": "pypi",
"version": "==1.0.3"
"version": "==1.0.5"
},
"ordered-set": {
"hashes": [
"sha256:ba93b2df055bca202116ec44b9bead3df33ea63a7d5827ff8e16738b97f33a95"
],
"markers": "python_version >= '3.5'",
"version": "==4.0.2"
},
"pydeep": {
@ -97,30 +143,127 @@
"git": "https://github.com/MISP/PyMISP.git",
"ref": "a68bd80ab9dceaee9674bd9a2b0bffc4f387fcdc"
},
"pyrsistent": {
"hashes": [
"sha256:2e636185d9eb976a18a8a8e96efce62f2905fea90041958d8cc2a189756ebf3e"
],
"markers": "python_version >= '3.5'",
"version": "==0.17.3"
},
"python-dateutil": {
"hashes": [
"sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c",
"sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.8.1"
},
"pytz": {
"hashes": [
"sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da",
"sha256:eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798"
],
"version": "==2021.1"
},
"requests": {
"hashes": [
"sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804",
"sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==2.25.1"
},
"simplejson": {
"hashes": [
"sha256:034550078a11664d77bc1a8364c90bb7eef0e44c2dbb1fd0a4d92e3997088667",
"sha256:05b43d568300c1cd43f95ff4bfcff984bc658aa001be91efb3bb21df9d6288d3",
"sha256:0dd9d9c738cb008bfc0862c9b8fa6743495c03a0ed543884bf92fb7d30f8d043",
"sha256:10fc250c3edea4abc15d930d77274ddb8df4803453dde7ad50c2f5565a18a4bb",
"sha256:2862beabfb9097a745a961426fe7daf66e1714151da8bb9a0c430dde3d59c7c0",
"sha256:292c2e3f53be314cc59853bd20a35bf1f965f3bc121e007ab6fd526ed412a85d",
"sha256:2d3eab2c3fe52007d703a26f71cf649a8c771fcdd949a3ae73041ba6797cfcf8",
"sha256:2e7b57c2c146f8e4dadf84977a83f7ee50da17c8861fd7faf694d55e3274784f",
"sha256:311f5dc2af07361725033b13cc3d0351de3da8bede3397d45650784c3f21fbcf",
"sha256:344e2d920a7f27b4023c087ab539877a1e39ce8e3e90b867e0bfa97829824748",
"sha256:3fabde09af43e0cbdee407555383063f8b45bfb52c361bc5da83fcffdb4fd278",
"sha256:42b8b8dd0799f78e067e2aaae97e60d58a8f63582939af60abce4c48631a0aa4",
"sha256:4b3442249d5e3893b90cb9f72c7d6ce4d2ea144d2c0d9f75b9ae1e5460f3121a",
"sha256:55d65f9cc1b733d85ef95ab11f559cce55c7649a2160da2ac7a078534da676c8",
"sha256:5c659a0efc80aaaba57fcd878855c8534ecb655a28ac8508885c50648e6e659d",
"sha256:72d8a3ffca19a901002d6b068cf746be85747571c6a7ba12cbcf427bfb4ed971",
"sha256:75ecc79f26d99222a084fbdd1ce5aad3ac3a8bd535cd9059528452da38b68841",
"sha256:76ac9605bf2f6d9b56abf6f9da9047a8782574ad3531c82eae774947ae99cc3f",
"sha256:7d276f69bfc8c7ba6c717ba8deaf28f9d3c8450ff0aa8713f5a3280e232be16b",
"sha256:7f10f8ba9c1b1430addc7dd385fc322e221559d3ae49b812aebf57470ce8de45",
"sha256:8042040af86a494a23c189b5aa0ea9433769cc029707833f261a79c98e3375f9",
"sha256:813846738277729d7db71b82176204abc7fdae2f566e2d9fcf874f9b6472e3e6",
"sha256:845a14f6deb124a3bcb98a62def067a67462a000e0508f256f9c18eff5847efc",
"sha256:869a183c8e44bc03be1b2bbcc9ec4338e37fa8557fc506bf6115887c1d3bb956",
"sha256:8acf76443cfb5c949b6e781c154278c059b09ac717d2757a830c869ba000cf8d",
"sha256:8f713ea65958ef40049b6c45c40c206ab363db9591ff5a49d89b448933fa5746",
"sha256:934115642c8ba9659b402c8bdbdedb48651fb94b576e3b3efd1ccb079609b04a",
"sha256:9551f23e09300a9a528f7af20e35c9f79686d46d646152a0c8fc41d2d074d9b0",
"sha256:9a2b7543559f8a1c9ed72724b549d8cc3515da7daf3e79813a15bdc4a769de25",
"sha256:a55c76254d7cf8d4494bc508e7abb993a82a192d0db4552421e5139235604625",
"sha256:ad8f41c2357b73bc9e8606d2fa226233bf4d55d85a8982ecdfd55823a6959995",
"sha256:af4868da7dd53296cd7630687161d53a7ebe2e63814234631445697bd7c29f46",
"sha256:afebfc3dd3520d37056f641969ce320b071bc7a0800639c71877b90d053e087f",
"sha256:b59aa298137ca74a744c1e6e22cfc0bf9dca3a2f41f51bc92eb05695155d905a",
"sha256:bc00d1210567a4cdd215ac6e17dc00cb9893ee521cee701adfd0fa43f7c73139",
"sha256:c1cb29b1fced01f97e6d5631c3edc2dadb424d1f4421dad079cb13fc97acb42f",
"sha256:c94dc64b1a389a416fc4218cd4799aa3756f25940cae33530a4f7f2f54f166da",
"sha256:ceaa28a5bce8a46a130cd223e895080e258a88d51bf6e8de2fc54a6ef7e38c34",
"sha256:cff6453e25204d3369c47b97dd34783ca820611bd334779d22192da23784194b",
"sha256:d0b64409df09edb4c365d95004775c988259efe9be39697d7315c42b7a5e7e94",
"sha256:d4813b30cb62d3b63ccc60dd12f2121780c7a3068db692daeb90f989877aaf04",
"sha256:da3c55cdc66cfc3fffb607db49a42448785ea2732f055ac1549b69dcb392663b",
"sha256:e058c7656c44fb494a11443191e381355388443d543f6fc1a245d5d238544396",
"sha256:fed0f22bf1313ff79c7fc318f7199d6c2f96d4de3234b2f12a1eab350e597c06",
"sha256:ffd4e4877a78c84d693e491b223385e0271278f5f4e1476a4962dca6824ecfeb"
],
"markers": "python_version >= '2.5' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==3.17.2"
},
"six": {
"hashes": [
"sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
"sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.15.0"
},
"stix": {
"hashes": [
"sha256:fc662e9378a6c2c802cf2ffd2857ba3dac66e1c7bd455d2a373a0af010d001b7"
"sha256:a3825e34781d491ac3526111f053db85a2be4549e0c8ce56e05e5eeb5f495e53",
"sha256:b23a1ca70227e17f42cd0a9f109737f321175f6fe97be5cb24fd4d189dbb1601"
],
"index": "pypi",
"version": "==1.2.0.6"
"version": "==1.2.0.11"
},
"stix2": {
"git": "https://github.com/MISP/cti-python-stix2",
"ref": "61e9fc0748691f6b768acf47c18ef01b5dc0a854"
},
"stix2-patterns": {
"hashes": [
"sha256:174fe5302d2c3223205033af987754132a9ea45a9f8e08aefafbe0549c889ea4",
"sha256:bc46cc4eba44b76a17eab7a3ff67f35203543cdb918ab24c1ebd58403fa27992"
],
"version": "==1.3.2"
},
"urllib3": {
"hashes": [
"sha256:2f4da4594db7e1e110a944bb1b551fdf4e6c136ad42e4234131391e21eb5b0df",
"sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"version": "==1.26.4"
},
"weakrefmethod": {
"hashes": [
"sha256:37bc1fbb5575acf82172d4eb7b6fc4412d77d5a1d70dff2c1f8a4574301cda66"
],
"version": "==1.0.3"
}
},
"develop": {}

View File

@ -706,7 +706,8 @@ class ACLComponent extends Component
'setSetting' => array('*'),
'getSetting' => array('*'),
'delete' => array('*'),
'setHomePage' => array('*')
'setHomePage' => array('*'),
'eventIndexColumnToggle' => ['*'],
),
'warninglists' => array(
'checkValue' => array('perm_auth'),

View File

@ -255,7 +255,7 @@ class EventsController extends AppController
return $result;
}
private function __setIndexFilterConditions($passedArgs, $urlparams)
private function __setIndexFilterConditions($passedArgs, &$urlparams)
{
$passedArgsArray = array();
foreach ($passedArgs as $k => $v) {
@ -806,34 +806,20 @@ class EventsController extends AppController
$this->redirect(array('controller' => 'events', 'action' => 'view', $events[0]['Event']['id']));
}
foreach ($events as $k => $event) {
if (empty($event['SharingGroup']['name'])) {
unset($events[$k]['SharingGroup']);
}
}
$events = $this->Event->attachTagsToEvents($events);
if (Configure::read('MISP.showCorrelationsOnIndex')) {
$events = $this->Event->attachCorrelationCountToEvents($this->Auth->user(), $events);
}
if (Configure::read('MISP.showSightingsCountOnIndex')) {
$events = $this->Event->attachSightingsCountToEvents($this->Auth->user(), $events);
}
if (Configure::read('MISP.showProposalsCountOnIndex')) {
$events = $this->Event->attachProposalsCountToEvents($this->Auth->user(), $events);
}
if (Configure::read('MISP.showDiscussionsCountOnIndex')) {
$events = $this->Event->attachDiscussionsCountToEvents($this->Auth->user(), $events);
}
$events = $this->GalaxyCluster->attachClustersToEventIndex($this->Auth->user(), $events, true);
if ($this->params['ext'] === 'csv') {
$events = $this->__attachInfoToEvents(['tags'], $events);
App::uses('CsvExport', 'Export');
$export = new CsvExport();
return $this->RestResponse->viewData($export->eventIndex($events), 'csv');
}
list($possibleColumns, $enabledColumns) = $this->__indexColumns();
$events = $this->__attachInfoToEvents($enabledColumns, $events);
$this->__noKeyNotification();
$this->set('events', $events);
$this->set('possibleColumns', $possibleColumns);
$this->set('columns', $enabledColumns);
$this->set('eventDescriptions', $this->Event->fieldDescriptions);
$this->set('analysisLevels', $this->Event->analysisLevels);
$this->set('distributionLevels', $this->Event->distributionLevels);
@ -850,6 +836,79 @@ class EventsController extends AppController
}
}
private function __indexColumns()
{
$possibleColumns = [];
if ($this->_isSiteAdmin() && !Configure::read('MISP.showorgalternate')) {
$possibleColumns[] = 'owner_org';
}
if (Configure::read('MISP.tagging')) {
$possibleColumns[] = 'clusters';
$possibleColumns[] = 'tags';
}
$possibleColumns[] = 'attribute_count';
if (Configure::read('MISP.showCorrelationsOnIndex')) {
$possibleColumns[] = 'correlations';
}
if (Configure::read('MISP.showSightingsCountOnIndex')) {
$possibleColumns[] = 'sightings';
}
if (Configure::read('MISP.showProposalsCountOnIndex')) {
$possibleColumns[] = 'proposals';
}
if (Configure::read('MISP.showDiscussionsCountOnIndex')) {
$possibleColumns[] = 'discussion';
}
if ($this->_isSiteAdmin()) {
$possibleColumns[] = 'creator_user';
}
$userEnabledColumns = $this->User->UserSetting->getValueForUser($this->Auth->user()['id'], 'event_index_hide_columns');
if ($userEnabledColumns === null) {
$userEnabledColumns = [];
}
$enabledColumns = array_diff($possibleColumns, $userEnabledColumns);
return [$possibleColumns, $enabledColumns];
}
private function __attachInfoToEvents(array $columns, array $events)
{
$user = $this->Auth->user();
if (in_array('tags', $columns, true) || in_array('clusters', $columns, true)) {
$events = $this->Event->attachTagsToEvents($events);
$events = $this->GalaxyCluster->attachClustersToEventIndex($user, $events, true);
}
if (in_array('correlations', $columns, true)) {
$events = $this->Event->attachCorrelationCountToEvents($user, $events);
}
if (in_array('sightings', $columns, true)) {
$events = $this->Event->attachSightingsCountToEvents($user, $events);
}
if (in_array('proposals', $columns, true)) {
$events = $this->Event->attachProposalsCountToEvents($user, $events);
}
if (in_array('discussion', $columns, true)) {
$events = $this->Event->attachDiscussionsCountToEvents($user, $events);
}
return $events;
}
private function __noKeyNotification()
{
$onlyEncrypted = Configure::read('GnuPG.onlyencrypted');
@ -941,31 +1000,45 @@ class EventsController extends AppController
}
}
$this->set('filtering', json_encode($filtering));
$tagNames = $this->Event->EventTag->Tag->find('list', array('recursive' => -1, 'fields' => ['Tag.id', 'Tag.name']));
$tagJSON = array();
$tagNames = $this->Event->EventTag->Tag->find('list', [
'fields' => ['Tag.id', 'Tag.name'],
]);
$tagJSON = [];
foreach ($tagNames as $tagId => $tagName) {
$tagJSON[] = array('id' => $tagId, 'value' => h($tagName));
$tagJSON[] = array('id' => $tagId, 'value' => $tagName);
}
$rules = array('published', 'eventid', 'tag', 'date', 'eventinfo', 'threatlevel', 'distribution', 'sharinggroup', 'analysis', 'attribute', 'hasproposal');
$rules = [
'published' => __('Published'),
'eventid' => __('Event ID'),
'tag' => __('Tag'),
'date' => __('Date'),
'eventinfo' => __('Event info'),
'threatlevel' => __('Threat level'),
'distribution' => __('Distribution'),
'sharinggroup' => __('Sharing group'),
'analysis' => __('Analysis'),
'attribute' => __('Attribute'),
'hasproposal' => __('Has proposal'),
];
if ($this->_isSiteAdmin()) {
$rules[] = 'email';
$rules['email'] = __('Email');
}
if (Configure::read('MISP.showorg')) {
$orgs = $this->Event->Orgc->find('list', array(
'conditions' => array(),
'recursive' => -1,
'fields' => array('Orgc.id', 'Orgc.name'),
'sort' => array('lower(Orgc.name) asc')
));
$this->set('showorg', true);
$this->set('orgs', $orgs);
$rules[] = 'org';
$rules['org'] = __('Organisation');
} else {
$this->set('showorg', false);
}
$sharingGroups = $this->Event->SharingGroup->fetchAllAuthorised($this->Auth->user(), 'name', true);
$this->set('sharingGroups', $sharingGroups);
$rules = $this->_arrayToValuesIndexArray($rules);
$this->set('tags', $tagNames);
$this->set('tagJSON', json_encode($tagJSON));
$this->set('rules', $rules);

View File

@ -9,6 +9,9 @@
App::uses('AppController', 'Controller');
/**
* @property UserSetting $UserSetting
*/
class UserSettingsController extends AppController
{
public $components = array('Session', 'RequestHandler');
@ -28,6 +31,7 @@ class UserSettingsController extends AppController
public function beforeFilter()
{
parent::beforeFilter();
$this->Security->unlockedActions[] = 'eventIndexColumnToggle';
}
public function index()
@ -347,4 +351,33 @@ class UserSettingsController extends AppController
$this->layout = false;
}
}
public function eventIndexColumnToggle($columnName)
{
if (!$this->request->is('post')) {
throw new MethodNotAllowedException(__('Expecting POST request.'));
}
$hideColumns = $this->UserSetting->getValueForUser($this->Auth->user()['id'], 'event_index_hide_columns');
if ($hideColumns === null) {
$hideColumns = [];
}
if (($key = array_search($columnName, $hideColumns, true)) !== false) {
unset($hideColumns[$key]);
$hideColumns = array_values($hideColumns);
} else {
$hideColumns[] = $columnName;
}
$setting = array(
'UserSetting' => array(
'user_id' => $this->Auth->user()['id'],
'setting' => 'event_index_hide_columns',
'value' => json_encode($hideColumns)
)
);
$this->UserSetting->setSetting($this->Auth->user(), $setting);
return $this->RestResponse->saveSuccessResponse('UserSettings', 'eventIndexColumnToggle', false, 'json', 'Column visibility switched');
}
}

View File

@ -0,0 +1,80 @@
<?php
class UsageDataWidget
{
public $title = 'Usage data';
public $render = 'SimpleList';
public $width = 2;
public $height = 5;
public $params = array();
public $description = 'Shows usage data / statistics.';
public $cacheLifetime = false;
public $autoRefreshDelay = 3;
public function handler($user, $options = array()){
$this->User = ClassRegistry::init('User');
$orgsCount = $this->User->Organisation->find('count');
$localOrgsParams['conditions']['Organisation.local'] = 1;
$localOrgsCount = $this->User->Organisation->find('count', $localOrgsParams);
$thisMonth = strtotime('first day of this month');
$this->Event = ClassRegistry::init('Event');
$eventsCount = $this->Event->find('count', array('recursive' => -1));
$eventsCountMonth = $this->Event->find('count', array('conditions' => array('Event.timestamp >' => $thisMonth), 'recursive' => -1));
$this->Attribute = ClassRegistry::init('Attribute');
$attributesCount = $this->Attribute->find('count', array('conditions' => array('Attribute.deleted' => 0), 'recursive' => -1));
$attributesCountMonth = $this->Attribute->find('count', array('conditions' => array('Attribute.timestamp >' => $thisMonth, 'Attribute.deleted' => 0), 'recursive' => -1));
$attributesPerEvent = round($attributesCount / $eventsCount);
$this->Correlation = ClassRegistry::init('Correlation');
$correlationsCount = $this->Correlation->find('count', array('recursive' => -1)) / 2;
$proposalsCount = $this->Event->ShadowAttribute->find('count', array('recursive' => -1));
$usersCount = $this->User->find('count', array('recursive' => -1));
$usersCountPgp = $this->User->find('count', array('recursive' => -1, 'conditions' => array('User.gpgkey !=' => '')));
$usersCountPgpPercentage = round(100* ($usersCountPgp / $usersCount), 1);
$contributingOrgsCount = $this->Event->find('count', array('recursive' => -1, 'group' => array('Event.orgc_id')));
$averageUsersPerOrg = round($usersCount / $localOrgsCount, 1);
$this->Thread = ClassRegistry::init('Thread');
$threadCount = $this->Thread->find('count', array('conditions' => array('Thread.post_count >' => 0), 'recursive' => -1));
$threadCountMonth = $this->Thread->find('count', array('conditions' => array('Thread.date_created >' => date("Y-m-d H:i:s", $thisMonth), 'Thread.post_count >' => 0), 'recursive' => -1));
$postCount = $this->Thread->Post->find('count', array('recursive' => -1));
$postCountMonth = $this->Thread->Post->find('count', array('conditions' => array('Post.date_created >' => date("Y-m-d H:i:s", $thisMonth)), 'recursive' => -1));
//Monhtly data is not added to the widget at the moment, could optionally add these later and give user choice?
$statistics = array(
array('title' => 'Events', 'value' => $eventsCount),
array('title' => 'Attributes', 'value' => $attributesCount),
array('title' => 'Attributes / event', 'value' => $attributesPerEvent),
array('title' => 'Correlations', 'value' => $correlationsCount),
array('title' => 'Active proposals', 'value' => $proposalsCount),
array('title' => 'Users', 'value' => $usersCount),
array('title' => 'Users with PGP keys', 'value' => $usersCountPgp . ' (' . $usersCountPgpPercentage . '%)'),
array('title' => 'Organisations', 'value' => $orgsCount),
array('title' => 'Local organisations', 'value' => $localOrgsCount),
array('title' => 'Event creator orgs', 'value' => $contributingOrgsCount),
array('title' => 'Average users / org', 'value' => $averageUsersPerOrg),
array('title' => 'Discussions threads', 'value' => $threadCount),
array('title' => 'Discussion posts', 'value' => $postCount)
);
if(!empty(Configure::read('Security.advanced_authkeys'))){
$this->AuthKey = ClassRegistry::init('AuthKey');
$authkeysCount = $this->AuthKey->find('count', array('recursive' => -1));
$statistics[] = array('title' => 'Advanced authkeys', 'value' => $authkeysCount);
}
return $statistics;
}
public function checkPermissions($user)
{
if (empty($user['Role']['perm_site_admin'])) {
return false;
}
return true;
}
}

View File

@ -561,8 +561,13 @@ class Event extends AppModel
return $events;
}
// gets the logged in user + an array of events, attaches the correlation count to each
public function attachCorrelationCountToEvents($user, $events)
/**
* Gets the logged in user + an array of events, attaches the correlation count to each
* @param array $user
* @param array $events
* @return array
*/
public function attachCorrelationCountToEvents(array $user, array $events)
{
$sgids = $this->SharingGroup->fetchAllAuthorised($user);
if (!isset($sgids) || empty($sgids)) {
@ -571,30 +576,28 @@ class Event extends AppModel
$this->Correlation = ClassRegistry::init('Correlation');
$eventIds = array_column(array_column($events, 'Event'), 'id');
$conditionsCorrelation = $this->__buildEventConditionsCorrelation($user, $eventIds, $sgids);
$correlations = $this->Correlation->find('all', array(
'fields' => array('Correlation.1_event_id', 'count(distinct(Correlation.event_id)) as count'),
$this->Correlation->virtualFields['count'] = 'count(distinct(Correlation.event_id))';
$correlations = $this->Correlation->find('list', array(
'fields' => array('Correlation.1_event_id', 'Correlation.count'),
'conditions' => $conditionsCorrelation,
'recursive' => -1,
'group' => array('Correlation.1_event_id'),
));
$correlations = Hash::combine($correlations, '{n}.Correlation.1_event_id', '{n}.0.count');
foreach ($events as &$event) {
$event['Event']['correlation_count'] = isset($correlations[$event['Event']['id']]) ? $correlations[$event['Event']['id']] : 0;
}
return $events;
}
public function attachSightingsCountToEvents($user, $events)
public function attachSightingsCountToEvents(array $user, array $events)
{
$eventIds = array_column(array_column($events, 'Event'), 'id');
$this->Sighting = ClassRegistry::init('Sighting');
$sightings = $this->Sighting->find('all', array(
'fields' => array('Sighting.event_id', 'count(distinct(Sighting.id)) as count'),
$this->Sighting->virtualFields['count'] = 'count(Sighting.id)';
$sightings = $this->Sighting->find('list', array(
'fields' => array('Sighting.event_id', 'Sighting.count'),
'conditions' => array('event_id' => $eventIds),
'recursive' => -1,
'group' => array('event_id')
));
$sightings = Hash::combine($sightings, '{n}.Sighting.event_id', '{n}.0.count');
foreach ($events as $key => $event) {
$events[$key]['Event']['sightings_count'] = isset($sightings[$event['Event']['id']]) ? $sightings[$event['Event']['id']] : 0;
}

View File

@ -9,6 +9,7 @@ App::uses('SendEmail', 'Tools');
* @property Log $Log
* @property Organisation $Organisation
* @property Role $Role
* @property UserSetting $UserSetting
*/
class User extends AppModel
{

View File

@ -92,6 +92,9 @@ class UserSetting extends AppModel
'false-positive:risk="medium"' => 99
)
),
'event_index_hide_columns' => [
'placeholder' => ['clusters'],
],
);
// massage the data before we send it off for validation before saving anything

View File

@ -16,93 +16,69 @@
<th class="filter"><?php echo $this->Paginator->sort('Org', 'Source org'); ?></th>
<th class="filter"><?php echo $this->Paginator->sort('Org', 'Member org'); ?></th>
<?php
else:
if (Configure::read('MISP.showorg') || $isAdmin):
elseif (Configure::read('MISP.showorg') || $isAdmin):
?>
<th class="filter"><?php echo $this->Paginator->sort('Org', __('Creator org')); ?></th>
<th class="filter"><?php echo $this->Paginator->sort('Org', __('Creator org')); ?></th>
<?php
endif;
if ($isSiteAdmin):
?>
<th class="filter"><?php echo $this->Paginator->sort('owner org', __('Owner org'));?></th>
<?php
endif;
endif;
$date = time();
$day = 86400;
?>
<th><?php echo $this->Paginator->sort('id', __('ID'), array('direction' => 'desc'));?></th>
<th><?php echo __('Clusters');?></th>
<?php if (Configure::read('MISP.tagging')): ?>
<th class="filter"><?php echo __('Tags');?></th>
<?php endif; ?>
<th title="<?php echo __('Attribute Count');?>"><?php echo $this->Paginator->sort('attribute_count', __('#Attr.'));?></th>
<?php if (Configure::read('MISP.showCorrelationsOnIndex')):?>
<th title="<?php echo __('Correlation Count');?>"><?php echo __('#Corr.');?></th>
<?php endif; ?>
<?php if (Configure::read('MISP.showSightingsCountOnIndex')):?>
<th title="<?php echo __('Sigthing Count');?>"><?php echo __('#Sightings');?></th>
<?php endif; ?>
<?php if (Configure::read('MISP.showProposalsOnIndex')):?>
<th title="<?php echo __('Proposal Count');?>"><?php echo __('#Prop');?></th>
<?php endif; ?>
<?php if (Configure::read('MISP.showDiscussionsCountOnIndex')):?>
<th title="<?php echo __('Post Count');?>"><?php echo __('#Posts');?></th>
<?php endif; ?>
<?php if ($isSiteAdmin): ?>
<th><?php echo $this->Paginator->sort('user_id', __('Creator user'));?></th>
<?php endif; ?>
<th class="filter"><?php echo $this->Paginator->sort('date', null, array('direction' => 'desc'));?></th>
<th class="filter"><?php echo $this->Paginator->sort('info');?></th>
<th title="<?php echo $eventDescriptions['distribution']['desc'];?>">
<?php echo $this->Paginator->sort('distribution');?>
<?php if (in_array('owner_org', $columns, true)): ?><th class="filter"><?= $this->Paginator->sort('owner org', __('Owner org')) ?></th><?php endif; ?>
<th><?= $this->Paginator->sort('id', __('ID'), ['direction' => 'desc']) ?></th>
<?php if (in_array('clusters', $columns, true)): ?><th><?= __('Clusters') ?></th><?php endif; ?>
<?php if (in_array('tags', $columns, true)): ?><th><?= __('Tags') ?></th><?php endif; ?>
<?php if (in_array('attribute_count', $columns, true)): ?><th title="<?= __('Attribute Count') ?>"><?= $this->Paginator->sort('attribute_count', __('#Attr.')) ?></th><?php endif; ?>
<?php if (in_array('correlations', $columns, true)): ?><th title="<?= __('Correlation Count') ?>"><?= __('#Corr.') ?></th><?php endif; ?>
<?php if (in_array('sightings', $columns, true)): ?><th title="<?= __('Sighting Count')?>"><?= __('#Sightings') ?></th><?php endif; ?>
<?php if (in_array('proposals', $columns, true)): ?><th title="<?= __('Proposal Count') ?>"><?= __('#Prop') ?></th><?php endif; ?>
<?php if (in_array('discussion', $columns, true)): ?><th title="<?= __('Post Count') ?>"><?= __('#Posts') ?></th><?php endif; ?>
<?php if (in_array('creator_user', $columns, true)): ?><th><?= $this->Paginator->sort('user_id', __('Creator user')) ?></th><?php endif; ?>
<th class="filter"><?= $this->Paginator->sort('date', null, array('direction' => 'desc'));?></th>
<th class="filter"><?= $this->Paginator->sort('info');?></th>
<th title="<?= $eventDescriptions['distribution']['desc'];?>">
<?= $this->Paginator->sort('distribution');?>
</th>
<th class="actions"><?php echo __('Actions');?></th>
</tr>
<?php foreach ($events as $event): ?>
<tr <?php if ($event['Event']['distribution'] == 0) echo 'class="privateRed"'?> id="event_<?php echo h($event['Event']['id']);?>">
<?php
if ($isSiteAdmin || ($event['Event']['orgc_id'] == $me['org_id'])):
?>
<td style="width:10px;" data-id="<?php echo h($event['Event']['id']); ?>">
<input id="<?php echo h($event['Event']['id']); ?>" class="select" type="checkbox" data-id="<?php echo h($event['Event']['id']);?>" />
</td>
<?php
else:
?>
<td style="padding-left:0px;padding-right:0px;"></td>
<?php
endif;
?>
<td class="short" ondblclick="document.location.href ='<?php echo $baseurl."/events/view/".$event['Event']['id'];?>'">
<a href="<?= "$baseurl/events/view/{$event['Event']['id']}" ?>" title="<?= __('View') ?>" aria-label="<?= __('View') ?>">
<?php foreach ($events as $event): $eventId = (int)$event['Event']['id']; ?>
<tr id="event_<?= $eventId ?>">
<?php if ($isSiteAdmin || ($event['Event']['orgc_id'] == $me['org_id'])):?>
<td style="width:10px;">
<input class="select" type="checkbox" data-id="<?= $eventId ?>" />
</td>
<?php else: ?>
<td style="padding-left:0;padding-right:0;"></td>
<?php endif; ?>
<td class="short dblclickElement">
<a href="<?= "$baseurl/events/view/$eventId" ?>" title="<?= __('View') ?>" aria-label="<?= __('View') ?>">
<i class="black fa <?= $event['Event']['published'] == 1 ? 'fa-check' : 'fa-times' ?>"></i>
</a>
</td>
<?php if (Configure::read('MISP.showorg') || $isAdmin): ?>
<td class="short" ondblclick="document.location.href ='<?php echo $baseurl . "/events/index/searchorg:" . $event['Orgc']['id'];?>'">
<?= $this->OrgImg->getOrgLogo($event['Orgc'], 24) ?>
</td>
<td class="short" ondblclick="document.location.href ='<?php echo $baseurl . "/events/index/searchorg:" . $event['Orgc']['id'];?>'">
<?= $this->OrgImg->getOrgLogo($event['Orgc'], 24) ?>
</td>
<?php endif;?>
<?php if ($isSiteAdmin || (Configure::read('MISP.showorgalternate') && Configure::read('MISP.showorg'))): ?>
<td class="short" ondblclick="document.location.href ='<?php echo $baseurl . "/events/index/searchorg:" . $event['Org']['id'];?>'">
<?= $this->OrgImg->getOrgLogo($event['Org'], 24) ?>
</td>
<?php if (in_array('owner_org', $columns, true) || (Configure::read('MISP.showorgalternate') && Configure::read('MISP.showorg'))): ?>
<td class="short" ondblclick="document.location.href ='<?php echo $baseurl . "/events/index/searchorg:" . $event['Org']['id'];?>'">
<?= $this->OrgImg->getOrgLogo($event['Org'], 24) ?>
</td>
<?php endif; ?>
<td style="width:30px;">
<a href="<?= $baseurl."/events/view/".$event['Event']['id'] ?>" class="threat-level-<?= strtolower($event['ThreatLevel']['name']) ?>"><?= $event['Event']['id'] ?></a>
<a href="<?= $baseurl."/events/view/".$eventId ?>" class="dblclickActionElement threat-level-<?= strtolower(h($event['ThreatLevel']['name'])) ?>" title="<?= __('Threat level: %s', h($event['ThreatLevel']['name'])) ?>"><?= $eventId ?></a>
</td>
<?php if (in_array('clusters', $columns, true)): ?>
<td class="short">
<?php
$galaxies = array();
if (!empty($event['GalaxyCluster'])) {
foreach ($event['GalaxyCluster'] as $gk => $galaxy_cluster) {
foreach ($event['GalaxyCluster'] as $galaxy_cluster) {
$galaxy_id = $galaxy_cluster['Galaxy']['id'];
if (!isset($galaxies[$galaxy_id])) {
$galaxies[$galaxy_id] = $galaxy_cluster['Galaxy'];
}
$galaxy_id = $galaxy_cluster['Galaxy']['id'];
unset($galaxy_cluster['Galaxy']);
$galaxies[$galaxy_id]['GalaxyCluster'][] = $galaxy_cluster;
}
@ -111,86 +87,84 @@
'isAclTagger' => false,
'data' => $galaxies,
'event' => $event,
'target_id' => $event['Event']['id'],
'target_id' => $eventId,
'target_type' => 'event',
'static_tags_only' => 1
));
}
?>
</td>
<?php
if (Configure::read('MISP.tagging')) {
echo sprintf(
'<td class="shortish">%s</td>',
$this->element(
'ajaxTags',
array(
'event' => $event,
'tags' => $event['EventTag'],
'tagAccess' => false,
'localTagAccess' => false,
'missingTaxonomies' => false,
'columnised' => true,
'static_tags_only' => 1,
'tag_display_style' => Configure::check('MISP.full_tags_on_event_index') ? Configure::read('MISP.full_tags_on_event_index') : 1
)
)
);
}
?>
<td style="width:30px;" ondblclick="location.href ='<?php echo $baseurl."/events/view/".$event['Event']['id'];?>'">
<?php echo $event['Event']['attribute_count']; ?>&nbsp;
<?php endif; ?>
<?php if (in_array('tags', $columns, true)): ?>
<td class="shortish">
<?= $this->element('ajaxTags', [
'event' => $event,
'tags' => $event['EventTag'],
'tagAccess' => false,
'localTagAccess' => false,
'missingTaxonomies' => false,
'columnised' => true,
'static_tags_only' => 1,
'tag_display_style' => Configure::check('MISP.full_tags_on_event_index') ? Configure::read('MISP.full_tags_on_event_index') : 1
]);
?>
</td>
<?php if (Configure::read('MISP.showCorrelationsOnIndex')):?>
<td class="bold" style="width:30px;">
<?php if (!empty($event['Event']['correlation_count'])): ?>
<a href="<?php echo $baseurl."/events/view/" . h($event['Event']['id']) . '/correlation:1';?>" title="<?php echo h($event['Event']['correlation_count']) . __(' correlation(s). Show filtered event with correlation only.');?>">
<?php echo h($event['Event']['correlation_count']); ?>&nbsp;
</a>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if (Configure::read('MISP.showSightingsCountOnIndex')):?>
<td class="bold" style="width:30px;">
<?php if (!empty($event['Event']['sightings_count'])): ?>
<a href="<?php echo $baseurl."/events/view/" . h($event['Event']['id']) . '/sighting:1';?>" title="<?php echo (!empty($event['Event']['sightings_count']) ? h($event['Event']['sightings_count']) : '0') . ' sighting(s). Show filtered event with sighting(s) only.';?>">
<?php echo h($event['Event']['sightings_count']); ?>&nbsp;
</a>
<?php endif; ?>
</td>
<?php if (in_array('attribute_count', $columns, true)): ?>
<td class="dblclickElement" style="width:30px;">
<?= $event['Event']['attribute_count']; ?>
</td>
<?php endif; ?>
<?php if (Configure::read('MISP.showProposalsOnIndex')): ?>
<td class="bold" style="width:30px;" ondblclick="location.href ='<?php echo $baseurl."/events/view/".$event['Event']['id'];?>'" title="<?php echo (!empty($event['Event']['proposals_count']) ? h($event['Event']['proposals_count']) : '0') . __(' proposal(s)');?>">
<?php echo !empty($event['Event']['proposals_count']) ? h($event['Event']['proposals_count']) : ''; ?>&nbsp;
</td>
<?php if (in_array('correlations', $columns, true)): ?>
<td class="bold" style="width:30px;">
<?php if (!empty($event['Event']['correlation_count'])): ?>
<a href="<?php echo $baseurl."/events/view/" . $eventId . '/correlation:1';?>" title="<?= __n('%s correlation', '%s correlations', $event['Event']['correlation_count'], $event['Event']['correlation_count']), '. ' . __('Show filtered event with correlation only.');?>">
<?php echo h($event['Event']['correlation_count']); ?>
</a>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if (in_array('sightings', $columns, true)): ?>
<td class="bold" style="width:30px;">
<?php if (!empty($event['Event']['sightings_count'])): ?>
<a href="<?php echo $baseurl."/events/view/" . $eventId . '/sighting:1';?>" title="<?php echo (!empty($event['Event']['sightings_count']) ? h($event['Event']['sightings_count']) : '0') . ' sighting(s). Show filtered event with sighting(s) only.';?>">
<?php echo h($event['Event']['sightings_count']); ?>
</a>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if (in_array('proposals', $columns, true)): ?>
<td class="bold dblclickElement" style="width:30px;" title="<?= __n('%s proposal', '%s proposals', $event['Event']['proposals_count'], $event['Event']['proposals_count']) ?>">
<?php echo !empty($event['Event']['proposals_count']) ? h($event['Event']['proposals_count']) : ''; ?>
</td>
<?php endif;?>
<?php if (Configure::read('MISP.showDiscussionsCountOnIndex')): ?>
<td class="bold" style="width:30px;" ondblclick="location.href ='<?php echo $baseurl."/events/view/".$event['Event']['id'];?>'" title="<?php echo (!empty($event['Event']['proposals_count']) ? h($event['Event']['proposals_count']) : '0') . __(' proposal(s)');?>">
<?php
if (!empty($event['Event']['post_count'])) {
$post_count = h($event['Event']['post_count']);
if (($date - $event['Event']['last_post']) < $day) {
$post_count .= ' (<span class="red bold">' . __('NEW') . '</span>)';
}
} else {
$post_count = '';
<?php if (in_array('discussion', $columns, true)): ?>
<td class="bold dblclickElement" style="width:30px;">
<?php
if (!empty($event['Event']['post_count'])) {
$post_count = h($event['Event']['post_count']);
if (($date - $event['Event']['last_post']) < $day) {
$post_count .= ' (<span class="red bold">' . __('NEW') . '</span>)';
}
?>
<span style=" white-space: nowrap;"><?php echo $post_count?></span>&nbsp;
</td>
} else {
$post_count = '';
}
?>
<span style=" white-space: nowrap;"><?php echo $post_count?></span>
</td>
<?php endif;?>
<?php if ($isSiteAdmin): ?>
<td class="short" ondblclick="location.href ='<?php echo $baseurl."/events/view/".$event['Event']['id'];?>'">
<?php echo h($event['User']['email']); ?>&nbsp;
</td>
<?php if (in_array('creator_user', $columns, true)): ?>
<td class="short dblclickElement">
<?php echo h($event['User']['email']); ?>
</td>
<?php endif; ?>
<td class="short" ondblclick="location.href ='<?php echo $baseurl."/events/view/".$event['Event']['id'];?>'">
<?php echo $event['Event']['date']; ?>&nbsp;
<td class="short dblclickElement">
<?= $event['Event']['date'] ?>
</td>
<td ondblclick="location.href ='<?php echo $baseurl."/events/view/".$event['Event']['id'];?>'">
<?php echo nl2br(h($event['Event']['info'])); ?>&nbsp;
<td class="dblclickElement">
<?= nl2br(h($event['Event']['info']), false) ?>
</td>
<td class="short <?php if ($event['Event']['distribution'] == 0) echo 'privateRedText';?>" ondblclick="location.href ='<?php echo $baseurl; ?>/events/view/<?php echo $event['Event']['id'];?>'" title="<?php echo $event['Event']['distribution'] != 3 ? $distributionLevels[$event['Event']['distribution']] : __('All');?>">
<td class="short dblclickElement <?php if ($event['Event']['distribution'] == 0) echo 'privateRedText';?>" title="<?php echo $event['Event']['distribution'] != 3 ? $distributionLevels[$event['Event']['distribution']] : __('All');?>">
<?php if ($event['Event']['distribution'] == 4):?>
<a href="<?php echo $baseurl;?>/sharingGroups/view/<?php echo h($event['SharingGroup']['id']); ?>"><?php echo h($event['SharingGroup']['name']);?></a>
<?php else:
@ -200,29 +174,28 @@
<?php
echo sprintf(
'<it type="button" title="%s" class="%s" aria-hidden="true" style="font-size: x-small;" data-event-distribution="%s" data-event-distribution-name="%s" data-scope-id="%s"></it>',
'Toggle advanced sharing network viewer',
__('Toggle advanced sharing network viewer'),
'fa fa-share-alt useCursorPointer distributionNetworkToggle',
h($event['Event']['distribution']),
$event['Event']['distribution'] == 4 ? h($event['SharingGroup']['name']) : h($shortDist[$event['Event']['distribution']]),
h($event['Event']['id'])
$eventId
)
?>
</td>
<td class="short action-links">
<?php
if (0 == $event['Event']['published'] && ($isSiteAdmin || ($isAclPublish && $event['Event']['orgc_id'] == $me['org_id'])))
echo $this->Form->postLink('', array('action' => 'alert', $event['Event']['id']), array('class' => 'black fa fa-upload', 'title' => __('Publish Event'), 'aria-label' => __('Publish Event')), __('Are you sure this event is complete and everyone should be informed?'));
else if (0 == $event['Event']['published']) echo __('Not published');
if (0 == $event['Event']['published'] && ($isSiteAdmin || ($isAclPublish && $event['Event']['orgc_id'] == $me['org_id']))) {
echo $this->Form->postLink('', array('action' => 'alert', $eventId), array('class' => 'black fa fa-upload', 'title' => __('Publish Event'), 'aria-label' => __('Publish Event')), __('Are you sure this event is complete and everyone should be informed?'));
}
if ($isSiteAdmin || ($isAclModify && $event['Event']['user_id'] == $me['id']) || ($isAclModifyOrg && $event['Event']['orgc_id'] == $me['org_id'])):
?>
<a href="<?php echo $baseurl."/events/edit/".$event['Event']['id'];?>" title="<?php echo __('Edit');?>" aria-label="<?php echo __('Edit');?>"><i class="black fa fa-edit"></i></a>
<a href="<?php echo $baseurl."/events/edit/".$eventId ?>" title="<?php echo __('Edit');?>" aria-label="<?php echo __('Edit');?>"><i class="black fa fa-edit"></i></a>
<?php
echo sprintf('<a class="useCursorPointer fa fa-trash" title="%s" aria-label="%s" onclick="deleteEvent(%s)"></a>', __('Delete'), __('Delete'), h($event['Event']['id']));
echo sprintf('<a class="useCursorPointer fa fa-trash" title="%s" aria-label="%s" onclick="deleteEvent(%s)"></a>', __('Delete'), __('Delete'), $eventId);
endif;
?>
<a href="<?php echo $baseurl."/events/view/".$event['Event']['id'];?>" title="<?php echo __('View');?>" aria-label="<?php echo __('View');?>"><i class="fa black fa-eye"></i></a>
<a href="<?php echo $baseurl."/events/view/".$eventId ?>" title="<?php echo __('View');?>" aria-label="<?php echo __('View');?>"><i class="fa black fa-eye"></i></a>
</td>
</tr>
<?php endforeach; ?>

View File

@ -62,19 +62,15 @@
$options = isset($data['options']) ? $data['options'] : array();
$actions = isset($data['actions']) ? $data['actions'] : array();
$dblclickActionArray = isset($data['actions']) ? Hash::extract($data['actions'], '{n}[dbclickAction]') : array();
$dbclickAction = '';
foreach ($data['data'] as $k => $data_row) {
$primary = null;
if (!empty($data['primary_id_path'])) {
$primary = Hash::extract($data_row, $data['primary_id_path'])[0];
}
if (!empty($dblclickActionArray)) {
$dbclickAction = sprintf("changeLocationFromIndexDblclick(%s)", $k);
}
$rows .= sprintf(
'<tr data-row-id="%s" %s %s>%s</tr>',
h($k),
empty($dbclickAction) ? '' : 'ondblclick="' . $dbclickAction . '"',
empty($dblclickActionArray) ? '' : 'class="dblclickElement"',
empty($primary) ? '' : 'data-primary-id="' . $primary . '"',
$this->element(
'/genericElements/IndexTable/' . $row_element,

View File

@ -53,7 +53,7 @@
'options' => $sharingGroups,
'class' => 'input',
'label' => false,
'style' => 'display:none;width:438px;',
'style' => 'width:438px;',
'div' => false
));
if ($showorg) {
@ -61,19 +61,18 @@
'options' => $orgs,
'class' => 'input',
'label' => false,
'style' => 'display:none;width:438px;',
'style' => 'width:438px;',
'div' => false
));
}
echo $this->Form->input('searchtag', array(
'options' => array($tags),
'options' => $tags,
'class' => 'input',
'label' => false,
'style' => 'display:none;width:438px;',
'style' => 'width:438px',
'div' => false
));
echo $this->Form->input('searchdatefrom', array(
'div' => 'input clear',
'class' => 'datepicker',
'data-date-format' => 'yyyy-mm-dd',
'label' => false,
@ -230,10 +229,12 @@ if (isSiteAdmin == 1) {
var baseurl = "<?php echo $baseurl; ?>";
$(document).ready(function() {
$(function() {
$('.datepicker').datepicker().on('changeDate', function(ev) {
$('.dropdown-menu').hide();
});
$('#EventSearchtag, #EventSearchorg, #EventSearchsharinggroup').chosen();
$('#EventSearchtag_chosen, #EventSearchorg_chosen, #EventSearchsharinggroup_chosen').css('top', '-5px');
indexEvaluateFiltering();
});

View File

@ -19,6 +19,30 @@
h($v)
);
}
$columnsDescription = [
'owner_org' => __('Owner org'),
'attribute_count' => __('Attribute count'),
'creator_user' => __('Creator user'),
'tags' => __('Tags'),
'clusters' => __('Clusters'),
'correlations' => __('Correlations'),
'sightings' => __('Sightings'),
'proposals' => __('Proposals'),
'discussion' => __('Posts'),
];
$columnsMenu = [];
foreach ($possibleColumns as $possibleColumn) {
$html = in_array($possibleColumn, $columns, true) ? '<i class="fa fa-check"></i> ' : '<i class="fa fa-check" style="visibility: hidden"></i> ';
$html .= $columnsDescription[$possibleColumn];
$columnsMenu[] = [
'html' => $html,
'onClick' => 'eventIndexColumnsToggle',
'onClickParams' => [$possibleColumn],
];
}
$filterParamsString = implode(' & ', $filterParamsString);
$data = array(
'children' => array(
@ -37,7 +61,7 @@
'children' => array(
array(
'id' => 'multi-delete-button',
'title' => __('Delete selected Events'),
'title' => __('Delete selected events'),
'fa-icon' => 'trash',
'class' => 'hidden mass-select',
'onClick' => 'multiSelectDeleteEvents'
@ -84,6 +108,18 @@
)
)
),
array(
'children' => array(
array(
'id' => 'simple_filter',
'type' => 'group',
'class' => 'last',
'title' => __('Choose columns to show'),
'fa-icon' => 'columns',
'children' => $columnsMenu,
),
),
),
array(
'type' => 'search',
'button' => __('Filter'),

View File

@ -2326,7 +2326,7 @@ function indexSetRowVisibility() {
}
function indexEvaluateSimpleFiltering(field) {
text = "";
var text = "";
if (filtering[field].OR.length == 0 && filtering[field].NOT.length == 0) {
$('#value_' + field).html(text);
return false;
@ -2411,19 +2411,21 @@ function indexRuleChange() {
$('[id^=' + context + 'Search]').hide();
var rule = $('#' + context + 'Rule').val();
var fieldName = '#' + context + 'Search' + rule;
if (fieldName == '#' + context + 'Searchdate') {
if (fieldName === '#' + context + 'Searchdate') {
$(fieldName + 'from').show();
$(fieldName + 'until').show();
} else {
$(fieldName).show();
if ($(fieldName + '_chosen').length) {
$(fieldName + '_chosen').show();
} else {
$(fieldName).show();
}
}
if (simpleFilters.indexOf(rule) != -1) {
$('#' + context + 'Searchbool').show();
} else $('#' + context + 'Searchbool').hide();
$('#addRuleButton').show();
$('#addRuleButton').unbind("click");
$('#addRuleButton').click({param1: rule}, indexAddRule);
$('#addRuleButton').show().unbind("click").click({param1: rule}, indexAddRule);
}
function indexFilterClearRow(field) {
@ -2446,66 +2448,6 @@ function indexFilterClearRow(field) {
indexEvaluateFiltering();
}
function restrictEventViewPagination() {
var showPages = new Array();
var start;
var end;
var i;
if (page < 6) {
start = 1;
if (count - page < 6) {
end = count;
} else {
end = page + (9 - (page - start));
}
} else if (count - page < 6) {
end = count;
start = count - 10;
} else {
start = page-5;
end = page+5;
}
if (start > 2) {
$("#apage" + start).parent().before("<li><a href id='aExpandLeft'>...</a></li>");
$("#aExpandLeft").click(function() {expandPagination(0, 0); return false;});
$("#bpage" + start).parent().before("<li><a href id='bExpandLeft'>...</a></li>");
$("#bExpandLeft").click(function() {expandPagination(1, 0); return false;})
}
if (end < (count - 1)) {
$("#apage" + end).parent().after("<li><a href id='aExpandRight'>...</a></li>");
$("#aExpandRight").click(function() {expandPagination(0, 1); return false;});
$("#bpage" + end).parent().after("<li><a href id='bExpandRight'>...</a></li>");
$("#bExpandRight").click(function() {expandPagination(1, 1); return false;})
}
for (i = 1; i < (count+1); i++) {
if (i != 1 && i != count && (i < start || i > end)) {
$("#apage" + i).hide();
$("#bpage" + i).hide();
}
}
}
function expandPagination(bottom, right) {
var i;
var prefix = "a";
if (bottom == 1) prefix = "b";
var start = 1;
var end = page;
if (right == 1) {
start = page;
end = count;
$("#" + prefix + "ExpandRight").remove();
} else $("#" + prefix + "ExpandLeft").remove();
for (i = start; i < end; i++) {
$("#" + prefix + "page" + i).show();
}
}
function getSubGroupFromSetting(setting) {
var temp = setting.split('.');
if (temp[0] == "Plugin") {
@ -3722,6 +3664,16 @@ function filterAttributes(filter, event_id) {
});
}
function eventIndexColumnsToggle(columnName) {
xhr({
url: "/userSettings/eventIndexColumnToggle/" + columnName,
method: "post",
success: function () {
window.location.reload(); // update page
}
});
}
// Find object or attribute by UUID on current page
function findObjectByUuid(uuid) {
var $tr = null;
@ -5267,10 +5219,10 @@ function setHomePage() {
});
}
function changeLocationFromIndexDblclick(row_index) {
var href = $('table tr[data-row-id=\"' + row_index + '\"] .dblclickActionElement').attr('href')
$(document.body).on('dblclick', '.dblclickElement', function() {
var href = $(this).closest('tr').find('.dblclickActionElement').attr('href');
window.location = href;
}
});
function loadClusterRelations(clusterId) {
if (clusterId !== undefined) {