Skip to content

[provisioning_api] POSTing a request to make a user a subadmin of the same group fails #13709

Closed

Description

@DeepDiver1975

Steps to reproduce

  1. Enable Provising API application
  2. Add some users, groups, and subadmins to some of the groups.
  3. Using POSTMAN chrome plugin, invoke a request to POST a request to make a user a subadmin of a group
  4. Invoke the request a second time

Expected behaviour

The user gets a message indicating that the user is already a subadmin

Actual behaviour

The user sees a white screen and there's an error in the server log

p85

p86

Server configuration

Operating system:

Ubuntu 12.04

Web server:

Apache/2.2.22

Database:

MySql

PHP version:

PHP 5.3

ownCloud version: (see ownCloud admin page)

ownCloud Enterprise Edition 7.0.2 Beta 1 (testing)

Updated from an older ownCloud or fresh install:

fresh install

Logs

ownCloud log (data/owncloud.log)

{"app":"PHP","message":"An exception occurred while exe cuting 'INSERT INTO `oc_group_admin` (`gid`,`uid`) VALU ES(?,?)':\n\nSQLSTATE[23000]: Integrity constraint viol ation: 1062 Duplicate entry 'sales-qa_admin' for key 'P RIMARY' at \/var\/www\/owncloud\/3rdparty\/doctrine\/db al\/lib\/Doctrine\/DBAL\/DBALException.php#47","level": 3,"time":"2014-09-18T17:43:58+00:00"}

Activity

  1. added this to the milestone on Jan 27, 2015
  2. LukasReschke commented on Apr 12, 2015

    @LukasReschke
    Contributor

    Moved the details to the public repo as well for @rullzer:


    "There is a missing check if a user is already a subadmin of a group in https://github.com/owncloud/enterprise/blob/master/provisioning_api/lib/users.php#L266. This is how it works in core: https://github.com/owncloud/core/blob/master/settings/ajax/togglesubadmins.php#L10.

    Not sure if we should fix this in the SubAdmin class itself or only add the check to the provisioning api."


    To me it makes sense to fix this in the subadmin class and throw an exception, but that's gonna break stuff. Guess we add the check to the provis api?


    i think we have to add it to the provisioning api for now.

  3. rullzer commented on Apr 13, 2015

    @rullzer
    Contributor

    Fix in #15564 .
    However, I would suggest to also address the other raised points (but in a PR for 8.2). The subadmin class should throw an exception. Since that is the actual place it needs to be fixed.

  4. rullzer commented on Apr 13, 2015

    @rullzer
    Contributor

    Technical dept issue created at #15573 to really fix the subadmin class.
    However this issue here is fixed, so closing.

  5. SergioBertolinSG commented on May 28, 2015

    @SergioBertolinSG
    Contributor

    Tested on stable8, it returns 100 the two times (Used curl). Good.

  6. locked as resolved and limited conversation to collaborators on Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions