Hi Martin,

I agree that the feedback could be a bit better when a user is already a
member of a specific group, but I'm not sure an error would be the best
approach. Since we already return a 204 No Content response when a user
is added to a group (or added when they are already a member). If we
returned a 4XX response code for the same situation in the v3 API, we be
breaking backwards compatibility.

The good thing is the operation to add users to groups is idempotent
even if they are already a member of the group. There is a
openstackclient command to check membership based on the user and the
group:

> openstack group add user accounting bob
bob added to group accounting                                                   
                                                                                
                                                                                
                              > openstack group add user accounting bob
bob added to group accounting
> openstack group contains user accounting bob
bob in group accounting


Do you have tooling around the client that is expecting an error when a user 
already belongs to a group?

I'm going to mark this as invalid for now since we won't be able to
change the response code unless we introduce a microversion of the API
(which keystone doesn't have support for yet) or we introduce a new API
entirely (i.e. v4).

** Changed in: keystone
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1655013

Title:
  double assignment of user to group does not give error

Status in OpenStack Identity (keystone):
  Invalid

Bug description:
  Double group assignment.
  [student@ctrl ~(teacher)]$ openstack --os-project-name headoffice group add 
user newGroup student62
  student62 added to group newGroup
  [lab3]:teacher@
  [student@ctrl ~(teacher)]$ openstack --os-project-name headoffice group add 
user newGroup student62
  student62 added to group newGroup
  [lab3]:teacher@

  The second line should give an error that the user is already assigned
  to a group.

  I checked the database keystone.user_group_membership and there is
  only assignment there (happy that the problem was not that bad).

  [student@ctrl ~(teacher)]$ openstack --version
  openstack 2.3.0
  [lab3]:teacher@
  [student@ctrl ~(teacher)]$ uname -a
  Linux ctrl.lab3.stack 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec 6 23:06:41 UTC 
2016 x86_64 x86_64 x86_64 GNU/Linux
  [lab3]:teacher@
  [student@ctrl ~(teacher)]$ cat /etc/*-release
  CentOS Linux release 7.3.1611 (Core)
  NAME="CentOS Linux"
  VERSION="7 (Core)"
  ID="centos"
  ID_LIKE="rhel fedora"
  VERSION_ID="7"
  PRETTY_NAME="CentOS Linux 7 (Core)"
  ANSI_COLOR="0;31"
  CPE_NAME="cpe:/o:centos:centos:7"
  HOME_URL="https://www.centos.org/";
  BUG_REPORT_URL="https://bugs.centos.org/";

  CENTOS_MANTISBT_PROJECT="CentOS-7"
  CENTOS_MANTISBT_PROJECT_VERSION="7"
  REDHAT_SUPPORT_PRODUCT="centos"
  REDHAT_SUPPORT_PRODUCT_VERSION="7"

  CentOS Linux release 7.3.1611 (Core)
  CentOS Linux release 7.3.1611 (Core)
  [lab3]:teacher@

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1655013/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to