Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-20677

eZRest v2 : Removing users do not clean up ezuser table and urlaliases

    XMLWordPrintable

Details

    Description

      Hi

      Creating a user and then delete it again using REST causes url alias tables and ezuser not to be cleaned up..

      After creating and deleting it, you have to manually remove the row from ezuser. Then, when creating the user again you'll notice that the urlAlias for the user will have a "2" prefix added to it. This indicates that the old urlalias was not removed.

      Creating the user

      #################### - Client request BEGIN - #########################
      POST /api/ezp/v2/user/groups/1/5/13/users HTTP/1.1
      Host: ezpublish5.rhel61.qa.ez.local:8080
      User-Agent: eZ REST QA Tester
      Content-Length: 563
      Authorization: Basic YWRtaW46cHVibGlzaA==
      Accept: application/vnd.ez.api.User+json
      Content-type: application/vnd.ez.api.UserCreate+json
      
      {
        "UserCreate": {
          "mainLanguageCode": "eng-GB",
          "Section": {
            "_href": "/content/sections/2"
          },
          "login": "testuser",
          "email": "vl3(a)ez.no",
          "password": "testpass42",
          "enabled": "true",
          "fields": {
            "field": [
            {
                "fieldDefinitionIdentifier": "first_name",
                "languageCode": "eng-GB",
                "fieldValue": "test First Name1"
              },{
                "fieldDefinitionIdentifier": "last_name",
                "languageCode": "eng-GB",
                "fieldValue": "test Last Name1"
              }
            ]
          }
        }
      }
      
      
      ##################### - Client request END - ##########################
      sending to target...done.
      Received from Target:
      ##################### - Target reply BEGIN - ##########################
      HTTP/1.1 201 Created
      Date: Thu, 11 Apr 2013 08:17:23 GMT
      Server: Apache/2.2.15 (Red Hat)
      X-Powered-By: PHP/5.3.3
      Accept-Patch: application/vnd.ez.api.UserUpdate+json
      Location: /api/ezp/v2/user/users/59
      Status: 201 Created
      Cache-Control: no-cache
      Connection: close
      Transfer-Encoding: chunked
      Content-Type: application/vnd.ez.api.User+json
      
      a77
      {"User":{"_media-type":"application\/vnd.ez.api.User+json","_href":"\/api\/ezp\/v2\/user\/users\/59","_id":59,"_remoteId":"90410de824ef2ae4ac491f25c1924360","ContentType":{"_media-type":"application\/vnd.ez.api.ContentType+json","_href":"\/api\/ezp\/v2\/content\/types\/4"},"name":"test First Name1 test Last Name1","Versions":{"_media-type":"application\/vnd.ez.api.VersionList+json","_href":"\/api\/ezp\/v2\/content\/objects\/59\/versions"},"Section":{"_media-type":"application\/vnd.ez.api.Section+json","_href":"\/api\/ezp\/v2\/content\/sections\/2"},"MainLocation":{"_media-type":"application\/vnd.ez.api.Location+json","_href":"\/api\/ezp\/v2\/content\/locations\/1\/5\/13\/61"},"Locations":{"_media-type":"application\/vnd.ez.api.LocationList+json","_href":"\/api\/ezp\/v2\/content\/objects\/59\/locations"},"Owner":{"_media-type":"application\/vnd.ez.api.User+json","_href":"\/api\/ezp\/v2\/user\/users\/14"},"publishDate":"2013-04-11T10:17:23+02:00","lastModificationDate":"2013-04-11T10:17:23+02:00","mainLanguageCode":"eng-GB","alwaysAvailable":"false","Version":{"_media-type":"application\/vnd.ez.api.Version+json","_href":"\/api\/ezp\/v2\/content\/objects\/59\/versions\/1","VersionInfo":{"id":508,"versionNo":1,"status":"PUBLISHED","modificationDate":"2013-04-11T10:17:23+02:00","Creator":{"_media-type":"application\/vnd.ez.api.User+json","_href":"\/api\/ezp\/v2\/user\/users\/14"},"creationDate":"2013-04-11T10:17:23+02:00","initialLanguageCode":"eng-GB","languageCodes":"eng-GB","names":{"value":[{"_languageCode":"eng-GB","#text":"test First Name1 test Last Name1"}]},"Content":{"_media-type":"application\/vnd.ez.api.ContentInfo+json","_href":"\/api\/ezp\/v2\/content\/objects\/59"}},"Fields":{"field":[{"id":217,"fieldDefinitionIdentifier":"first_name","languageCode":"eng-GB","fieldValue":"test First Name1"},{"id":218,"fieldDefinitionIdentifier":"last_name","languageCode":"eng-GB","fieldValue":"test Last Name1"},{"id":219,"fieldDefinitionIdentifier":"user_account","languageCode":"eng-GB","fieldValue":null},{"id":220,"fieldDefinitionIdentifier":"signature","languageCode":"eng-GB","fieldValue":null},{"id":221,"fieldDefinitionIdentifier":"image","languageCode":"eng-GB","fieldValue":null}]},"Relations":{"_media-type":"application\/vnd.ez.api.RelationList+json","_href":"\/api\/ezp\/v2\/content\/objects\/59\/versions\/1\/relations","Relation":[]}},"login":"testuser","email":"vl3(a)ez.no","enabled":"true","UserGroups":{"_media-type":"application\/vnd.ez.api.UserGroupList+json","_href":"\/api\/ezp\/v2\/user\/users\/59\/groups"},"Roles":{"_media-type":"application\/vnd.ez.api.RoleAssignmentList+json","_href":"\/api\/ezp\/v2\/user\/users\/59\/roles"}}}
      0
      
      
      ###################### - Target reply END - ###########################
      

      The URL alias will then be:
      test-First-Name1-test-Last-Name1

      Removing the user again:

      #################### - Client request BEGIN - #########################
      DELETE /api/ezp/v2/user/users/59 HTTP/1.1
      Host: ezpublish5.rhel61.qa.ez.local:8080
      User-Agent: eZ REST QA Tester
      Authorization: Basic YWRtaW46cHVibGlzaA==
      
      
      ##################### - Client request END - ##########################
      sending to target...done.
      Received from Target:
      ##################### - Target reply BEGIN - ##########################
      HTTP/1.1 204 No Content
      Date: Thu, 11 Apr 2013 08:30:25 GMT
      Server: Apache/2.2.15 (Red Hat)
      X-Powered-By: PHP/5.3.3
      Status: 204 No Content
      Cache-Control: no-cache
      Connection: close
      Content-Type: text/html; charset=UTF-8
      
      
      ###################### - Target reply END - ###########################
      

      the testuser is now still in ezuser table.. Remove it manually and resend the create user request and you'll notice that the url alias is wrong.
      It becomes "test-First-Name1-test-Last-Name12", but should have been "test-First-Name1-test-Last-Name1"

      Attachments

        Activity

          People

            Unassigned Unassigned
            vidar.langseid@ibexa.co Vidar Langseid
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 30 minutes
                5h 30m