Mercurial > libervia-pubsub
diff sat_pubsub/tap.py @ 321:c7fe09894952
privilege: better handling of main message 'to' attribute (i.e. privileged entity's server)
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 05 Jan 2016 22:16:37 +0100 |
parents | 5d7c3787672e |
children | 8496af26be45 |
line wrap: on
line diff
--- a/sat_pubsub/tap.py Sun Jan 03 18:33:23 2016 +0100 +++ b/sat_pubsub/tap.py Tue Jan 05 22:16:37 2016 +0100 @@ -59,9 +59,11 @@ from wokkel.disco import DiscoHandler from wokkel.generic import FallbackHandler, VersionHandler from wokkel.iwokkel import IPubSubResource -from wokkel import pubsub, rsm, mam as wokkel_mam +from wokkel import pubsub, rsm, mam -from sat_pubsub import __version__, const, mam +from sat_pubsub import __version__ +from sat_pubsub import const +from sat_pubsub import mam as pubsub_mam from sat_pubsub.backend import BackendService from sat_pubsub.privilege import PrivilegesHandler from sat_pubsub.delegation import DelegationsHandler @@ -138,14 +140,10 @@ VersionHandler(u'SàT Pubsub', __version__).setHandlerParent(cs) DiscoHandler().setHandlerParent(cs) - ph = PrivilegesHandler() + ph = PrivilegesHandler(config['jid']) ph.setHandlerParent(cs) bs.privilege = ph - dh = DelegationsHandler() - dh.setHandlerParent(cs) - bs.delegation = dh - resource = IPubSubResource(bs) resource.hideNodes = config["hide-nodes"] resource.serviceJID = config["jid"] @@ -155,8 +153,14 @@ resource.pubsubService = ps if const.FLAG_ENABLE_MAM: - mam_resource = mam.MAMResource(bs) - mam_s = wokkel_mam.MAMService(mam_resource) + mam_resource = pubsub_mam.MAMResource(bs) + mam_s = mam.MAMService(mam_resource) mam_s.setHandlerParent(cs) + # XXX: delegation must be instancied at the end, + # because it does some MonkeyPatching on handlers + dh = DelegationsHandler() + dh.setHandlerParent(cs) + bs.delegation = dh + return s