'Update the users roles on entity based on the selected roles
in before and after
@param user_id: id (pk) of the user account to modify
@param entity_id: id of the pentity to modify roles for
@param before: list of role_uids (current values for the user)
@param after: list of role_uids (new values from the admin)'

def update_roles(self, user_id, entity_id, before, after):

    auth = current.auth
    assign_role = auth.s3_assign_role
    withdraw_role = auth.s3_withdraw_role
    for role_uid in before:
        if (role_uid not in after):
            withdraw_role(user_id, role_uid, entity_id)
    for role_uid in after:
        if ((role_uid != 'None') and (role_uid not in before)):
            assign_role(user_id, role_uid, entity_id)
