]>
git.ipfire.org Git - ipfire.org.git/blob - src/web/talk.py
5 from . import handlers_base
as base
6 from . import ui_modules
8 class IndexHandler(base
.BaseHandler
):
9 @tornado.web
.authenticated
11 self
.render("talk/index.html")
14 class RegistrationsHandler(base
.BaseHandler
):
15 @tornado.web
.authenticated
18 if self
.current_user
.uid
== uid
:
19 account
= self
.current_user
21 # Admins can access all other users, too
22 elif self
.current_user
.is_admin():
23 account
= self
.backend
.accounts
.get_by_uid(uid
)
25 raise tornado
.web
.HTTPError(404, "Could not find account %s" % uid
)
27 # Otherwise, no access is permitted
29 raise tornado
.web
.HTTPError(403)
31 self
.render("talk/registrations.html", account
=account
)
34 class UsersHandler(base
.BaseHandler
):
35 @tornado.web
.authenticated
37 self
.render("talk/users.html")
40 class UserHandler(base
.BaseHandler
):
41 @tornado.web
.authenticated
43 account
= self
.backend
.accounts
.get_by_uid(uid
)
45 raise tornado
.web
.HTTPError(404, "Could not find account %s" % uid
)
47 self
.render("talk/user.html", account
=account
)
50 class AccountsListModule(ui_modules
.UIModule
):
51 def render(self
, accounts
=None):
53 accounts
= self
.backend
.talk
.accounts
55 return self
.render_string("talk/modules/accounts-list.html", accounts
=accounts
)
58 class ChannelsModule(ui_modules
.UIModule
):
59 def render(self
, account
):
60 channels
= self
.backend
.talk
.freeswitch
.get_sip_channels(account
)
62 return self
.render_string("talk/modules/channels.html", account
=account
, channels
=channels
)
65 class RegistrationsModule(ui_modules
.UIModule
):
66 def render(self
, account
):
67 return self
.render_string("talk/modules/registrations.html", account
=account
)