def users_role_for_group_or_org(group_id, user_name):
 if (not group_id):
  return None
 group_id = model.Group.get(group_id).id
 user_id = get_user_id_for_username(user_name, allow_none=True)
 if (not user_id):
  return None
 q = model.Session.query(model.Member).filter((model.Member.group_id == group_id)).filter((model.Member.table_name == 'user')).filter((model.Member.state == 'active')).filter((model.Member.table_id == user_id))
 for row in q.all():
  return row.capacity
 return None

def users_role_for_group_or_org ( group_id , user_name ) : if ( not group_id ) : return None group_id = model . Group . get ( group_id ) . id user_id = get_user_id_for_username ( user_name , allow_none = True ) if ( not user_id ) : return None q = model . Session . query ( model . Member ) . filter ( ( model . Member . group_id == group_id ) ) . filter ( ( model . Member . table_name == 'user' ) ) . filter ( ( model . Member . state == 'active' ) ) . filter ( ( model . Member . table_id == user_id ) ) for row in q . all ( ) : return row . capacity return None
returns the users role for the group .