mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 01:16:35 +03:00
Remove client-side checks when editing permissions
The server should instead fail with proper RPC errors, as the rules could change any time (and the local checks get out of date).
This commit is contained in:
parent
816b0bdf9f
commit
a0cda0c37c
|
@ -926,9 +926,6 @@ class ChatMethods:
|
||||||
"""
|
"""
|
||||||
entity = await self.get_input_entity(entity)
|
entity = await self.get_input_entity(entity)
|
||||||
user = await self.get_input_entity(user)
|
user = await self.get_input_entity(user)
|
||||||
ty = helpers._entity_type(user)
|
|
||||||
if ty != helpers._EntityType.USER:
|
|
||||||
raise ValueError('You must pass a user entity')
|
|
||||||
|
|
||||||
perm_names = (
|
perm_names = (
|
||||||
'change_info', 'post_messages', 'edit_messages', 'delete_messages',
|
'change_info', 'post_messages', 'edit_messages', 'delete_messages',
|
||||||
|
@ -1115,12 +1112,6 @@ class ChatMethods:
|
||||||
))
|
))
|
||||||
|
|
||||||
user = await self.get_input_entity(user)
|
user = await self.get_input_entity(user)
|
||||||
ty = helpers._entity_type(user)
|
|
||||||
if ty not in (helpers._EntityType.USER, helpers._EntityType.CHANNEL):
|
|
||||||
raise ValueError('You must pass a user or channel entity')
|
|
||||||
|
|
||||||
if isinstance(user, types.InputPeerSelf):
|
|
||||||
raise ValueError('You cannot restrict yourself')
|
|
||||||
|
|
||||||
return await self(functions.channels.EditBannedRequest(
|
return await self(functions.channels.EditBannedRequest(
|
||||||
channel=entity,
|
channel=entity,
|
||||||
|
@ -1167,8 +1158,6 @@ class ChatMethods:
|
||||||
"""
|
"""
|
||||||
entity = await self.get_input_entity(entity)
|
entity = await self.get_input_entity(entity)
|
||||||
user = await self.get_input_entity(user)
|
user = await self.get_input_entity(user)
|
||||||
if helpers._entity_type(user) != helpers._EntityType.USER:
|
|
||||||
raise ValueError('You must pass a user entity')
|
|
||||||
|
|
||||||
ty = helpers._entity_type(entity)
|
ty = helpers._entity_type(entity)
|
||||||
if ty == helpers._EntityType.CHAT:
|
if ty == helpers._EntityType.CHAT:
|
||||||
|
@ -1245,8 +1234,6 @@ class ChatMethods:
|
||||||
|
|
||||||
entity = await self.get_input_entity(entity)
|
entity = await self.get_input_entity(entity)
|
||||||
user = await self.get_input_entity(user)
|
user = await self.get_input_entity(user)
|
||||||
if helpers._entity_type(user) != helpers._EntityType.USER:
|
|
||||||
raise ValueError('You must pass a user entity')
|
|
||||||
if helpers._entity_type(entity) == helpers._EntityType.CHANNEL:
|
if helpers._entity_type(entity) == helpers._EntityType.CHANNEL:
|
||||||
participant = await self(functions.channels.GetParticipantRequest(
|
participant = await self(functions.channels.GetParticipantRequest(
|
||||||
entity,
|
entity,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user