Commit Graph

380 Commits

Author SHA1 Message Date
Steve Howell 7d23bffa42 Replace "ios" with "ZulipiOS" in process_client().
(imported from commit 72b4f5ded6dbb86fe67884d6fe8da1ee2146c4c5)
2014-01-10 21:38:58 -05:00
Steve Howell 17adab9a5d DRY up process_client() by extracting get_client_name().
Avoid repeating request.client = get_client(foo) 5 times, and
decouple the logic for determining the client name from how
we represent the client as an ORM object and piggyback it on the
Django request.

(imported from commit efdf81cbaf9599a5606da18e06d7ffe9b88aaf6f)
2014-01-10 21:38:58 -05:00
Steve Howell d043c373b4 Refactor process_client() to avoid double negative.
The "else" branch used to execute when it was not the case
case that HTTP_USER_AGENT was not in request.META.  Now
it's more readable.

(imported from commit ea0664e89d8b3d94cd1c0f8667047461b149ba41)
2014-01-10 21:38:58 -05:00
Leo Franchi c7836626ea Accept a pass-through local_id option in send_message
(imported from commit 3f7b8e862a92d8a11b68da9ff23f711b6b25b5e2)
2014-01-07 17:33:34 -05:00
Tim Abbott e77b34ed82 api: Extract client strings from UserAgent.
(imported from commit 22468dd0eb06bb52ed7273f3067ae3e2461ee0a5)
2013-12-19 17:20:43 -05:00
Steve Howell bfb54b5a4d Add validator support to REQ and has_request_variables.
Validators are similar to converters, but they don't have
to parse JSON, and they are told the name of the request
variable to help format error messages.

(imported from commit 3c33e301892519c67e70675006d5686d9f013353)
2013-12-13 18:19:10 -05:00
Tim Abbott c89c3443a8 Support api_key as well as api-key in authenticated_api_view.
All of our other API arguments use "_" as the delimiter, so we're
migrating this to do that as well (except for the legacy send_message
usage, which we're just hoping will eventually shrink to nothing).

(imported from commit 40964cc08e0f94ba439a61e4f68ed500f74a554f)
2013-12-13 15:09:36 -05:00
Tim Abbott 08ac439d0f Improve comments for remaining legacy API endpoints.
(imported from commit 923b30b4c2a8e724ce8262e9eaeb69887572fd4b)
2013-12-12 10:31:05 -05:00
Tim Abbott cd45cdd451 Add a decorator for checking whether a user is a realm administrator.
(imported from commit 8ba2c54ccd0a92e8c7ab8f1a8873e581f6cadd51)
2013-12-10 13:21:31 -05:00
Tim Abbott f7ac58bab5 Revert "Add user_activity_test worker that does nothing."
Now that we've debugged the memory leak, I don't think we need this
anymore.

This reverts commit 1bdc7ee2f72bdebb1cdc94601247834a434614d6.

Conflicts:

	puppet/zulip/files/cron.d/rabbitmq-numconsumers
	puppet/zulip/files/supervisor/conf.d/zulip.conf

(imported from commit ff87f2aebcbc71013fa7a05aedb24e2dcad82ae6)
2013-12-04 10:27:45 -05:00
Tim Abbott c0e951f843 Add user_activity_test worker that does nothing.
This should help us debug the source of our memory leak problems.

(imported from commit 1bdc7ee2f72bdebb1cdc94601247834a434614d6)
2013-11-22 11:24:48 -05:00
Luke Faraone fafa14db9a Patch out references to zilencer so the app runs without it on ENTERPRISE
(imported from commit bd4fe1ff47e1b4dc9038f800ee8aa2980bd00fdf)
2013-11-12 18:43:06 -05:00
Zev Benjamin 24ee4a5d57 socket: Build a real Request object to send through our full stack, including middleware
One quirk here is that the Request object is built in the
message_sender worker, not Tornado.  This means that the request time
only counts time taken for the actual sending and does not account
for socket overhead.  For this reason, I've left the fake logging in
for now so we can compare the two times.

(imported from commit b0c60a3017527a328cadf11ba68166e59cf23ddf)
2013-11-12 15:24:29 -05:00
Tim Abbott 2a77cecc7a Remove several unnecessary TODO notes.
(imported from commit 1292d048d63c056af69f62352cf8cab283ef5792)
2013-11-04 11:51:18 -05:00
Steve Howell 6382c417cf Improve zulip_internal decorator.
I added the @wraps decorator, and I point request._query at the
function name to override the URL, since some of the internal
URLs have realm names and domain names in them.  I basically
prefer the function names in most cases, so I just made this
automatic for zulip_internal functions, rather than having to
remember to address URL-vs.-function-name for every new endpoint.

(imported from commit 5583607f395be4dfae0bac31e1cdbffdf51fb3e8)
2013-11-01 13:43:38 -04:00
Luke Faraone 81d7dd1fda [schema] Support for authenticating Deployments via the API.
Here we introduce a new Django app, zilencer. The intent is to not have
this app enabled on LOCALSERVER instances, and for it to grow to include
all the functionality we want to have in our central server that isn't
relevant for local deployments.

Currently we have to modify functions in zerver/* to match; in the
future, it would be cool to have the relevant shared code broken out
into a separate library.

This commit inclues both the migration to create the models as well as a
data migration that (for non-LOCALSERVER) creates a single default
Deployment for zulip.com.

To apply this migration to your system, run:
   ./manage.py migrate zilencer

(imported from commit 86d5497ac120e03fa7f298a9cc08b192d5939b43)
2013-10-25 14:13:30 -04:00
Steve Howell cf0331018a Log client/email in zulip_internal decorator.
(imported from commit 43b7ae75bd5cd3e8a086f82b31507079d999a42b)
2013-10-22 15:03:34 -04:00
Steve Howell 5562f09d99 Add zulip_internal decorator for internal Zulip reports.
(This also ensures that /queries is viewable only from inside
Zulip.)

(imported from commit 697da768889943ab6cea62b3e922cc43afa04759)
2013-10-22 10:15:08 -04:00
acrefoot f8662c16f7 Add Mandrill decorators, credentials, actions
You can queue email for future delivery or send immediately via mandrill now

(imported from commit e6b6d11a2d94fcdeaffab80793e7ba31955b9031)
2013-10-10 19:32:21 -04:00
Steve Howell 35fce47088 Do not embed the API key in webhook error messages
(imported from commit 12d782b1bde2c9f928e509bd6dd0ae9106616ed6)
2013-10-03 14:38:37 -04:00
Steve Howell 97adbedfca Support request._query in update_user_activity().
If request._query is set in the call to update_user_activity(),
we will use that instead of request.META['PATH_INFO'] for
the query field of the UserActivity row we write.

(imported from commit fcee30098e1c7c5cb4195a1e5905fc7b88af804f)
2013-10-03 14:23:02 -04:00
Steve Howell 8a4a069703 Add api_key_only_webhook_view decorator.
This is for webhook API endpoints that only get passed in an api_key,
not an email.  An example would be api_jira_webhook, and some of
the code is borrowed from there.  The rest of the code is from
authenticated_api_view().

(imported from commit b5b2a4ea52f9b317f00357ef3142c76534fabf20)
2013-10-03 14:22:49 -04:00
Zev Benjamin 90ee96d456 Split out presence and activity interval events from user_activity queue
(imported from commit 3c22448491867a9e72659629d5d0faaf12b85b2c)
2013-09-24 20:44:15 -04:00
Zev Benjamin 7d0fd364b2 Remove duplicate call to update_user_activity
(imported from commit e9d2dce02cb6863a3ba66045a7b88bd351fd0c5d)
2013-09-23 11:25:58 -04:00
Scott Feeney a213fb5df2 Comment that authenticated_rest_api_view does Basic auth
(imported from commit 145ea6b0a17ab904c32e23e809410f56448baa72)
2013-09-04 13:19:22 -04:00
Scott Feeney f225c467b0 Strip whitespace from email/key during API auth
Trac #1681

(imported from commit 4c97bfea052d2da7673ba5a9520f7ddc7515d975)
2013-08-27 14:27:28 -04:00
Scott Feeney 141877a06c Give a helpful error if API key is wrong length
Trac #1680

(imported from commit 0a50e7a93b37a5a3e74fb99c97a8917d8fbcc8f9)
2013-08-27 14:27:28 -04:00
Zev Benjamin 2f262b1558 Make @authenticated_rest_api_view imply @csrf_exempt
(imported from commit a90402effe48b184c05bf19f1136e3d63a6f460b)
2013-08-16 14:38:54 -04:00
Tim Abbott d59ba39518 Rename humbug_finish to zulip_finish.
(imported from commit a73ef9302d16a4068c7d050d4882d2eba699488d)
2013-08-07 10:00:08 -04:00
Tim Abbott e111a2f9a5 [manual] Rename Django app from zephyr to zerver.
This needs to be deployed to both staging and prod at the same
off-peak time (and the schema migration run).

At the time it is deployed, we need to make a few changes directly in
the database:

(1) UPDATE django_content_type set app_label='zerver' where app_label='zephyr';
(2) UPDATE south_migrationhistory set app_name='zerver' where app_name='zephyr';

(imported from commit eb3fd719571740189514ef0b884738cb30df1320)
2013-08-06 07:39:36 -04:00