  def remove_role(what, role)
    check_write_access!
    if what.kind_of? Group
      rel = self.package_group_role_relationships.where(bs_group_id: what.id)
    else
      rel = self.package_user_role_relationships.where(bs_user_id: what.id)
    end
    rel = rel.where(role_id: role.id) if role
    self.transaction do
      rel.delete_all
      write_to_backend
    end
  end
Weaknesses in this category are related to improper assignment or handling of permissions.