Commit Graph

221 Commits

Author SHA1 Message Date
Isaac Connor 39061038fb Don't include related models in Storage index 2018-10-29 14:40:05 -04:00
Isaac Connor 9a2d58adce We don't store all the permissions in the session anymore. We just use the global user object 2018-10-29 11:03:03 -04:00
Isaac Connor 8878397622 fix spacing 2018-10-20 11:36:25 -04:00
Andrew Bauer 409fd6aa6f
Merge pull request #2232 from connortechnology/fix_2229_getDiskPercent
Fix 2229 get disk percent
2018-10-03 18:11:28 -05:00
Isaac Connor 66221e39ab rough in a StorageController for api 2018-10-03 11:22:51 -04:00
Isaac Connor 12bed9b6ac Use alternate, working test for relative ZM_DIR_EVENTS. Don't use human output from du when specifying mid to be consistent. 2018-10-03 11:11:33 -04:00
Isaac Connor 03f09bdc48 Use defined CONFIG constants instead of looking up config from db 2018-10-03 10:56:02 -04:00
Isaac Connor 23ddc83ad4
fix_2167 (#2168)
* Populate a global  from the session on every request. Use the  object instead of using allowedMonitors in session.

* fix when  gets loaded.

* use  for auth, and add Monitor Edit checks to Zone add/delete/edit

* add back the ZM_OPT_USE_AUTH test for being logged in in AppController

* Update permissions code to use

* change quotes

* Update permission code to use

* Use  instal of session for systemPermission

* deprecate montiorPermision in session

* use  instead of session streamPermission

* move login code back into AppController. Has to be done for every request

* deprecate eventPermission, controlPermission and systemPermission in session.

* handle auth params in query string as well as post

* exit on HUP to free up memory.

* add missing global user

* system should be System
2018-08-08 09:59:46 -04:00
Isaac Connor dc57a3c91c fix spacing/quotes/google code style 2018-07-24 16:41:09 -04:00
Pliable Pixels 997aa6aa55 fixed getCredentials not working if called directly 2018-07-17 13:57:20 -04:00
Pliable Pixels 0ff9002adf 2156 api login (#2157)
* error can be due to bad user or password

* added login/logout and related private functions

* handle case when userLogin fails, current code returns PHP error for  and API throw is not called

* formatting

* converted login params to POST, removed user=&pass= for other APIs

* formatting

* add auth check back but leave out login/out

* fixes to make it work across zmN, postman and curl

* added back enabled check
2018-07-15 21:17:35 -04:00
Isaac Connor fe5ebe094d More work just using auth.php instead of cake code. Don't reload the User object 2018-07-11 11:45:49 -04:00
Isaac Connor 4f80ca6871 Use userLogin function from auth.php instead of cake code. 2018-07-11 10:33:49 -04:00
Isaac Connor 983e3c45be Fix spacing and quotes 2018-07-11 09:54:25 -04:00
Isaac Connor f10509690b add username and passwordHash to Session so that generateAuthHash works 2018-07-11 09:54:15 -04:00
Isaac Connor 21438d17ac Fix authenticating User 2018-07-10 13:19:51 -04:00
Isaac Connor 930d929427 Merge branch 'storageareas' into api_auth 2018-07-10 12:46:30 -04:00
Isaac Connor e04eac57ae Include values in /etc/zm files in viewByName 2018-06-25 15:43:01 -04:00
Isaac Connor 24ceb75936 Merge branch 'master' into include_fs_config_in_api_config 2018-06-21 21:41:54 -04:00
Isaac Connor cd64619743 Fix controlling daemon when the monitor is Local 2018-06-06 12:56:33 -04:00
Isaac Connor 2a5f05499e Munge the config in the global configvals into the configs array before returning it. 2018-05-10 13:44:46 -04:00
Isaac Connor 62edca6dcb add fileSize to the api, and use it to add remote fileSize reporting in includes/Event 2018-05-08 13:33:56 -07:00
Isaac Connor 1a012c62ff Add fileExists to event view 2018-05-07 14:07:03 -07:00
Pliable Pixels e953a04f61 naming consistency of attribute (#2096) 2018-05-03 14:03:49 -04:00
Pliable Pixels a3158fcc97 auth_key api for different situations (#2090)
* auth_key api for different situations

* added new flag to indicate if password needs to be appended

* pure json view
2018-05-02 12:26:28 -04:00
Isaac Connor c3b6cd4bab include auth.php if auth is on, and return '' for auth_hash is auth is disabled 2018-04-30 11:24:53 -04:00
Isaac Connor 513708b11c don't need to define the config, it will have already been done. Include auth.php instead of functions.php as the code has been moved 2018-04-06 14:42:10 -04:00
Isaac Connor a789fc88aa implement getAuthHash 2018-04-06 14:41:39 -04:00
Isaac Connor 632ab143fe error when can't set session in cake 2018-04-05 14:21:56 -04:00
Isaac Connor a4fee5c91c further merges from cakephp 2.10.8 2018-03-21 13:09:55 -04:00
Isaac Connor b4c13d56d6 Merge ../ZoneMinder.master into storageareas 2018-03-06 12:29:59 -05:00
tim 0654c7e3b2 Adding group handling in API 2018-03-04 23:01:52 -08:00
Isaac Connor 475c465b0d define 2018-01-26 10:39:12 -05:00
Isaac Connor 1503c586d2 When there is an error saving, add the invalidFields() info to the error message. Only restart the daemon on success. 2018-01-26 10:30:29 -05:00
Isaac Connor 933259f9a5 fix bracket 2018-01-23 13:16:21 -08:00
Isaac Connor bd2da456f4 handle non-multi-server case when restarting monitors via API 2018-01-19 21:09:33 -05:00
Isaac Connor d586faf7fb Fix restarting Monitor 2018-01-19 08:16:28 -08:00
Isaac Connor 1b1b93f811 use CakePHP-Enum-Behavior to add support for ENUMs to the Monitor model. This should fix #48 2018-01-01 14:43:02 -05:00
Isaac Connor bb8e326392 Fix not restarting a monitor if it has moved to a different server 2017-12-22 09:16:56 -08:00
Isaac Connor 85b7baa131 Fix event Groups associations 2017-12-19 18:09:41 -05:00
Isaac Connor d312482a2b add StorageScheme to Storage and Events. Deprecate ZM_USE_DEEP_STORAGE 2017-12-18 12:52:26 -05:00
Isaac Connor dd69bc3d7b Merge branch 'master' into storageareas 2017-12-11 11:39:42 -05:00
Isaac Connor ef1af9cc15 disable FilterComponent as it doesn't actually do anything. Add Groups join when needed 2017-12-09 14:03:42 -05:00
Pliable Pixels 08b5c26a15 2019 maxscoreframeid (#2020)
* added MaxScoreFrameId to address #2019

* consistent quotes
2017-12-07 14:11:06 -05:00
Isaac Connor f7a2db4e49 remove MaxScore from the sorting because it really doesn't make sense to sort by time then maxscore... time is going to be pretty much unique 2017-12-04 21:50:29 -05:00
Isaac Connor 97c9ae02c2 cleanup 2017-12-04 17:02:38 -05:00
Isaac Connor 6270408c8f rework group MonitorIds and add GroupId filters to api 2017-12-04 15:52:16 -05:00
Isaac Connor 489d3ba6ed Merge ../ZoneMinder.master into storageareas 2017-11-21 12:23:17 -05:00
APHW2 MFGENG f093cfbcef add Filtering to monitors index 2017-11-13 10:27:24 -08:00
Pliable Pixels a8fc832481 fix for monitor API edit perm (#1995) 2017-10-07 09:55:13 -04:00
Isaac Connor 150aa5be51 Merge branch 'master' into api_auth 2017-06-09 12:33:17 -04:00
Isaac Connor 75dc774a08 Continue to support non-USE_DEEP_STORAGE option 2017-05-22 21:21:49 -04:00
Matt N 33092e4022 Allow API authentication using the `auth` query parameter containing an auth. hash. (#1845)
* Allow API authentication using the `auth` query parameter containing an auth. hash.

Fixes #1827

The same auth. hash for zms is used here. This allows consumers to use the API without sending the password in the query string and not require forging logins via the login form.

* Move logger.php's global Debug function to Logger::Debug to avoid polluting globals

This avoids a conflict with CakePHP when logger.php gets included indrectly from API code.

* Protect action=login when ZM_ENABLE_CSRF_MAGIC is enabled
2017-05-15 21:51:48 -04:00
Matthew Noorenberghe ea558c79a0 Fix check that API user is enabled 2017-03-20 17:16:24 -07:00
Andy Bauer 2dda2d9e1e remove unneeded, empty files 2016-12-26 09:49:14 -06:00
Pliable Pixels 192d0dbb45 added TimeZone get API 2016-10-18 14:07:31 -04:00
Pliable Pixels 1440dd9265 retab 2016-09-03 15:02:32 -04:00
Pliable Pixels 7bf0b3c423 readded forMonitor - removed by mistake 2016-09-03 14:51:24 -04:00
Pliable Pixels 9a4330eb59 #1537 Zones Controller not returning all zones 2016-09-03 14:46:47 -04:00
Isaac Connor 55f5db55dd implement suggested code to stop the monitor when Function is set to None 2016-09-01 11:43:20 -04:00
Isaac Connor b4aec41d3d fix warnings and move User import up higher to where it needs to be 2016-06-21 09:09:58 -04:00
Isaac Connor dbdd1ae51e remove debug logging 2016-06-07 16:26:58 -04:00
Isaac Connor f26c9168c4 if user=&pass= are in request, use them for auth 2016-06-07 16:25:35 -04:00
Isaac Connor 6cb163c37f Merge branch 'master' into api_auth 2016-06-07 16:23:50 -04:00
arjunrc 4018cab743 don't pass partial data to daemoncontrol 2016-05-19 14:53:16 -04:00
arjunrc b513bcef82 icon's gonna kill me 2016-05-10 20:09:41 -04:00
arjunrc af3cae578e fixed verbose handling bug for status command on zmu 2016-05-10 20:07:28 -04:00
arjunrc 8d5f2a8e5d added iconnor's change back 2016-05-10 19:17:09 -04:00
arjunrc df830a5190 resolved merge conflicts 2016-05-10 19:15:00 -04:00
arjunrc 2888142e68 added status command to retrieve alarmed status of monitor in addition to on/of 2016-05-10 16:55:43 -04:00
Steve Gilvarry b03d2660cb Merge pull request #1455 from ZoneMinder/api_servers
rough in Server object support
2016-05-10 08:00:58 +10:00
Isaac Connor 966a9dcd8d Merge pull request #1467 from ZoneMinder/api_fixes
Don't pass request data as a monitor array to daemonControl
2016-05-07 18:25:35 -04:00
Isaac Connor e35b0a1eb2 Merge pull request #1469 from pliablepixels/1468-api-consoleEvents-alarmedFrames
added alarmed frames filter
2016-05-07 17:06:37 -04:00
arjunrc be329e1e0d switched to named param format, more flexible, in line with other APIs 2016-05-07 16:28:25 -04:00
arjunrc 8347b69b09 added alarmed frames filter 2016-05-07 14:26:09 -04:00
Isaac Connor 6d991a1c6c Merge pull request #1466 from pliablepixels/1465-api-alarm-on-off
added alarm enable/disable
2016-05-07 11:26:49 -04:00
arjunrc 6f9cc0f19f to be safe, lets add system edit permissions, so rogue users can't turn alarms OFF 2016-05-07 11:01:03 -04:00
Isaac Connor 15977f1a3c Don't pass request data as a monitor array to daemonControl 2016-05-07 10:56:38 -04:00
arjunrc 0280ae4dd5 added alarm enable/disable 2016-05-07 10:37:42 -04:00
Isaac Connor 01aa2c9319 change permissions to stream permissions for view 2016-05-02 19:48:24 -04:00
Isaac Connor 75f9fde920 rough in Server object support 2016-05-02 10:41:25 -04:00
arjunrc 8a47241e18 address issue #1335 2016-03-12 08:07:25 -05:00
arjunrc 6e606aa74b removed issue # 2015-12-19 19:04:27 -05:00
arjunrc 38b4785557 PP - Gone,flitted away, Taken the starts from the night and sun, From the day! Gone, and a cloud in my heart. - Tennyson 2015-12-19 18:36:38 -05:00
arjunrc b4fdaa9b4d initial user role support 2015-12-19 17:44:46 -05:00
arjunrc e812398fb9 initial user role support 2015-12-19 17:44:39 -05:00
arjunrc f56688e7c2 initial user role support 2015-12-19 17:44:16 -05:00
arjunrc 028c9b956c check for opt_use_api, also pull in user roles support 2015-12-19 17:44:02 -05:00
Kyle Johnson 5add10289b Merge pull request #1136 from pliablepixels/1135-events-API-prev-next
added prev/next event ids
2015-11-16 09:23:36 -07:00
Pliable Pixels 7cbad44ae4 also return the prev and next events for the same monitor as the current event 2015-11-04 14:23:28 -05:00
Pliable Pixels e3d06ca103 added prev/next event ids 2015-11-02 16:54:52 -05:00
Isaac Connor d39f57c4ff Merge pull request #1073 from pliablepixels/1072-events-API-delete-fix
Delete fixes for Events
2015-09-28 14:46:01 -04:00
Pliable Pixels a00fed480d Delete fixes for Events 2015-09-28 14:41:36 -04:00
Pliable Pixels ee78ae5c49 restart monitor when edited via APIs 2015-09-28 09:31:57 -04:00
Andrew Bauer 66ec84fdea Merge pull request #1008 from pliablepixels/993-API-Auth
Included logic to not enforce authentication in API layer if ZM auth is off
2015-08-11 14:51:02 -05:00
Pliable Pixels a64f7c0036 Included logic to not enforce authentication in API layer if ZM_OPT_USE_AUTH is disabled
If ZM auth is off, API won't work. Changed this to make sure API disables auth if ZM disables auth
2015-08-11 14:47:49 -04:00
Isaac Connor 3e5170678e Merge pull request #1006 from pliablepixels/993-API-Auth
I was using the wrong field to check for portal authentication
2015-08-10 15:58:50 -04:00
Pliable Pixels f7025aaa26 I was using the wrong field to check for portal authentication
Should be user.Username instead of username
2015-08-10 15:55:44 -04:00
Pliable Pixels 2b0a975fef Bumped up # of events per API to 100 instead of 25 2015-08-07 16:25:48 -04:00
Pliable Pixels 38799050ef APIs will be served only if user is logged into the ZM portal 2015-08-07 16:14:02 -04:00
Pliable Pixels e332fc36a9 Fixed Configs API to return all values 2015-07-21 13:28:37 -04:00
Isaac Connor fadfc01d81 TUrn on sessions and auth 2015-06-30 11:27:33 -04:00
Isaac Connor e0d2a14f3c add in User Model/Controller and rough in auth. 2015-06-30 11:27:17 -04:00
Isaac Connor 4be341986f Merge pull request #897 from pliablepixels/881-api-branch
Fixed events API to remove thumbnail code
2015-06-22 13:01:15 -04:00
Pliable Pixels 719a903d43 Fixed events API to remove thumbnail code 2015-06-20 20:08:10 -04:00
Pliable Pixels 138e931e24 Fixed events API to remove thumbnail code 2015-06-20 19:57:55 -04:00
pliablepixels 7112001b64 getVersion.json now returns both ZM version and API version 2015-06-13 16:33:15 +00:00
Ubuntu dd9603f70f Merged Angular UI branch API to master 2015-06-11 02:58:58 +00:00
Kyle Johnson 35530c627a Initial commit of Logs MVC 2014-11-15 19:03:40 +00:00
Kyle Johnson 0129ca5f74 Rework the ConfigParser component. 2014-11-15 19:03:10 +00:00
Kyle Johnson e7d726bf75 Don't print out the Config string to the file system. 2014-11-15 19:02:54 +00:00
Kyle Johnson fcaa67e3c3 Slight refactor of ConfigParser Component. Needs more work. 2014-11-15 19:02:18 +00:00
Kyle Johnson 9f80a7d5f5 Show a list of Config Key:Value pairs 2014-11-15 19:01:32 +00:00
Kyle Johnson 9268c503af Do not display the "hidden" config category 2014-11-15 19:01:19 +00:00
Kyle Johnson b9f54056da Add component for dumping Config table as HTML 2014-11-15 18:59:58 +00:00
Kyle Johnson de631075d3 Return possible source types ni DB via API 2014-11-15 18:59:24 +00:00
Kyle Johnson 0d57306790 Find category configs only when $category is not null. API 2014-11-15 18:58:58 +00:00
Kyle Johnson 9f150c4e46 Revert "Find category configs only when $category is not null. API"
This reverts commit efbbcadc7dad9aa52a7aab0483546eab48840ae6.
2014-11-15 18:58:51 +00:00
Kyle Johnson b88febeaee Find category configs only when $category is not null. API 2014-11-15 18:58:43 +00:00
Kyle Johnson 0a7ba112ab API support for querying config categories.
Either return a list of distinct categories, or all configs under a
certain category
2014-11-15 18:55:20 +00:00
Kyle Johnson f1f3de6d7d Moved the api to underneath the web directory 2014-04-29 20:41:04 +00:00