Hi All,

please take a look at the following code:


@Grab(group='org.codehaus.groovy.modules.http-builder',
module='http-builder', version='0.5.2' )

import groovyx.net.http.RESTClient

def restClient = new RESTClient('http://myserver.url/artifactory/')
restClient.auth.basic "admin", "SECRET"
restClient.parser.'application/vnd.org.jfrog.artifactory.search.ArtifactCreationResult+json'
= restClient.parser.'application/json'

def searchQuery = "api/search/creation?from=0&repos=libs-release-local"
def resp = restClient.get(uri: "" + restClient.uri + "" + searchQuery)
println resp.data

restClient.delete(uri:
'http://myserver.url/artifactory/libs-release-local/myGroup/myArtifact/1.2/myArtifact-1.2.jar')

This code dies at the last line with:
Caught: groovyx.net.http.HttpResponseException: Not enough permissions to
overwrite artifact
'libs-release-local:myGroup/myArtifact/1.2/myArtifact-1.2.jar' (user
'anonymous' needs DELETE permission).

When I comment this line
restClient.auth.basic "admin", "SECRET"
than it fails much earlier when trying to execute the search query with:
Caught: groovyx.net.http.HttpResponseException: Unauthorized

So I understand that this line successfully logs use. So why during delete
artifactory assumes that its an "anonymous" user which tries to execute this
action?

BTW. I can download artifact using this url
http://myserver.url/artifactory/libs-release-local/myGroup/myArtifact/1.2/myArtifact-1.2.jar
so the path is ok

--
Regards,
Tomek Kaczanowski




--
View this message in context: 
http://forums.jfrog.org/REST-API-delete-item-issue-anonymous-user-tp7578368.html
Sent from the Artifactory - Users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users

Reply via email to