325ba2c0857d2fff5d1915260bd58af571941609,dino/db/postgres/postgres.py,DatabasePostgres,room_owners_contain,#DatabasePostgres#Any#Any#,142
Before Change
@with_session
def room_owners_contain(self, room_id, user_id) -> bool:
// TODO: need to revise roles first
raise NotImplementedError()
@with_session
def is_admin(self, user_id: str) -> bool:
// TODO: need to revise roles first
After Change
@with_session
def room_owners_contain(self, room_id, user_id) -> bool:
room = self.session.query(Rooms).join(Rooms.roles).filter(Rooms.uuid == room_id).first()
if room is None:
return False
found_role = None
for role in room.roles:
if role.user_id == user_id:
found_role = role
break
if found_role is None:
return None
if found_role.roles is None or found_role.roles == "":
return False
return RoleKeys.OWNER in set(found_role.roles.split(","))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 13
Instances Project Name: thenetcircle/dino
Commit Name: 325ba2c0857d2fff5d1915260bd58af571941609
Time: 2016-10-18
Author: oscar.eriks@gmail.com
File Name: dino/db/postgres/postgres.py
Class Name: DatabasePostgres
Method Name: room_owners_contain
Project Name: thenetcircle/dino
Commit Name: 557aef062fd907e6dec11acfa5525d2d859d29a7
Time: 2016-10-19
Author: oscar.eriks@gmail.com
File Name: dino/db/rdbms/handler.py
Class Name: DatabaseRdbms
Method Name: leave_room
Project Name: thenetcircle/dino
Commit Name: 325ba2c0857d2fff5d1915260bd58af571941609
Time: 2016-10-18
Author: oscar.eriks@gmail.com
File Name: dino/db/postgres/postgres.py
Class Name: DatabasePostgres
Method Name: room_owners_contain
Project Name: thenetcircle/dino
Commit Name: 6279a1e15c55b651bb5669546483a6c551552c6b
Time: 2016-10-19
Author: oscar.eriks@gmail.com
File Name: dino/db/rdbms/handler.py
Class Name: DatabaseRdbms
Method Name: delete_acl