Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CBFB8200CAE for ; Tue, 6 Jun 2017 13:57:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CAB2C160BC3; Tue, 6 Jun 2017 11:57:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1C4DC160BC6 for ; Tue, 6 Jun 2017 13:57:22 +0200 (CEST) Received: (qmail 71913 invoked by uid 500); 6 Jun 2017 11:57:22 -0000 Mailing-List: contact dev-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list dev@syncope.apache.org Received: (qmail 71835 invoked by uid 99); 6 Jun 2017 11:57:22 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jun 2017 11:57:22 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id C1054188A8D for ; Tue, 6 Jun 2017 11:57:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id cPwA2meo6RpJ for ; Tue, 6 Jun 2017 11:57:19 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 3E4F95FDEE for ; Tue, 6 Jun 2017 11:57:19 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 86EC4E070F for ; Tue, 6 Jun 2017 11:57:18 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3ECB821E0C for ; Tue, 6 Jun 2017 11:57:18 +0000 (UTC) Date: Tue, 6 Jun 2017 11:57:18 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: dev@syncope.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SYNCOPE-1102) Unique attribute update inserts additional value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 06 Jun 2017 11:57:24 -0000 [ https://issues.apache.org/jira/browse/SYNCOPE-1102?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 038722#comment-16038722 ]=20 ASF subversion and git services commented on SYNCOPE-1102: ---------------------------------------------------------- Commit 53dfa40883653a4bc621f5586a98c23efe9ea761 in syncope's branch refs/he= ads/1_1_X from [~ilgrosso] [ https://git-wip-us.apache.org/repos/asf?p=3Dsyncope.git;h=3D53dfa40 ] [SYNCOPE-1102] Minimum Viable Fix > Unique attribute update inserts additional value > ------------------------------------------------ > > Key: SYNCOPE-1102 > URL: https://issues.apache.org/jira/browse/SYNCOPE-1102 > Project: Syncope > Issue Type: Bug > Components: core > Affects Versions: 1.1.5, 1.1.6, 1.1.7, 1.1.8, 1.2.10 > Environment: MySQL > Reporter: Laszlo Miklosik > Assignee: Francesco Chicchiricc=C3=B2 > Fix For: 1.1.9, 1.2.11 > > Attachments: SYNCOPE-1102.diff > > > To reproduce: > - make sure you have a unique attribute in the Syncope schema (e.g. calle= d privateEmailAddress) > - create a user via POST and use value 'a@gmail.com' for this unique attr= ibute > - then try to update this via the Syncope REST API and to change it into = 'b@gmail.com' (by using the below POST payload): > {code} > { > "attributesToBeUpdated": [ > { > "schema": "privateEmailAddress", > "valuesToBeAdded": [ > "b@gmail.com" > ], > "valuesToBeRemoved": [ > "a@gmail.com" > ] > } > ] > } > {code} > - after this the Syncope MySQL data gets incorrect (the unique attribute = will have 2 values in table UAttrUniqueValue) and you cannot e.g. delete an= ymore the user. > - You then can find the old unique attribute value using query: > {code} > select min(id) from UAttrUniqueValue group by ATTRIBUTE_ID having count(s= tringValue) > 1 > {code} > and you can fix the Syncope data inconsistency by deleting the related ro= w from UAttrUniqueValue. > - Root cause comes from line 467: > {code} > for (Long attributeValueId : valuesToBeRemoved) { > attributeValueDAO.delete(attributeValueId, attrUtil.a= ttrValueClass()); > } > {code} > where the delete call uses the same argument values in case of both the n= on-unique and unique attributes, this in fact a non-unique attributes is tr= ied to be deleted. > Note: as UserMod payloads are not used anymore in Syncope 2 REST API, it'= s likely that this issue is not happening on Syncope 2, but might reproduce= on Syncope 1.1.6-1.2.10. > Note: I have a patch I applied in our overlay and can provide it if neces= sary. -- This message was sent by Atlassian JIRA (v6.3.15#6346)