Improve restriction handling.

This commit is contained in:
Schimon Jehudah 2024-05-13 15:32:41 +00:00
parent 095980de47
commit 2bab3e2deb
2 changed files with 11 additions and 5 deletions

View file

@ -1,2 +1,2 @@
__version__ = '0.1.63' __version__ = '0.1.64'
__version_info__ = (0, 1, 63) __version_info__ = (0, 1, 64)

View file

@ -821,7 +821,8 @@ class Slixfeed(slixmpp.ClientXMPP):
access = None access = None
print('PERMISSION JID : ' + jid_full) print('PERMISSION JID : ' + jid_full)
print('PERMISSION CHAT : ' + chat_type) print('PERMISSION CHAT : ' + chat_type)
if is_operator(self, jid_bare): operator = is_operator(self, jid_bare)
if operator:
if chat_type == 'groupchat': if chat_type == 'groupchat':
if is_moderator(self, jid_bare, jid_full): if is_moderator(self, jid_bare, jid_full):
access = True access = True
@ -850,11 +851,13 @@ class Slixfeed(slixmpp.ClientXMPP):
session['prev'] = None session['prev'] = None
session['payload'] = form session['payload'] = form
else: else:
if chat_type == 'groupchat': if not operator:
text_warn = 'This resource is restricted to operators.'
elif chat_type == 'groupchat':
text_warn = ('This resource is restricted to moderators of {}.' text_warn = ('This resource is restricted to moderators of {}.'
.format(jid_bare)) .format(jid_bare))
else: else:
text_warn = 'This resource is restricted to operators.' text_warn = 'This resource is forbidden.'
session['notes'] = [['warn', text_warn]] session['notes'] = [['warn', text_warn]]
return session return session
@ -1026,7 +1029,10 @@ class Slixfeed(slixmpp.ClientXMPP):
async def _handle_publish_db_complete(self, payload, session): async def _handle_publish_db_complete(self, payload, session):
values = payload['values'] values = payload['values']
jid_file = values['jid_file'][0] jid_file = values['jid_file'][0]
print('jid_file')
print(jid_file) print(jid_file)
print("values['node']")
print(values['node'])
node_id = values['node'][0] node_id = values['node'][0]
jid = values['jid'][0] jid = values['jid'][0]
ixs = values['entries'] ixs = values['entries']