def _is_removing_self_admin_role(self, request, project_id, user_id,
                                     available_roles, current_role_ids):
        is_current_user = user_id == request.user.id
        is_current_project = project_id == request.user.tenant_id
        _admin_roles = self.get_admin_roles()
        available_admin_role_ids = [role.id for role in available_roles
                                    if role.name.lower() in _admin_roles]
        admin_roles = [role for role in current_role_ids
                       if role in available_admin_role_ids]
        if len(admin_roles):
            removing_admin = any([role in current_role_ids
                                  for role in admin_roles])
        else:
            removing_admin = False

        if is_current_user and is_current_project and removing_admin:
            # Cannot remove "admin" role on current(admin) project
            msg = _('You cannot revoke your administrative privileges '
                    'from the project you are currently logged into. '
                    'Please switch to another project with '
                    'administrative privileges or remove the '
                    'administrative role manually via the CLI.')
            messages.warning(request, msg)
            return True
        else:
            return False
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/identity/projects/workflows.py/UpdateProject._is_removing_self_admin_role/original