jacquayj / GoRODS

Golang binding for iRODS C API: An iRODS client library written in Golang + C
https://godoc.org/github.com/jjacquay712/GoRODS
BSD 3-Clause "New" or "Revised" License
17 stars 5 forks source link

Access name of iRODS Owner for a Collection or DataObject #23

Closed simont closed 8 years ago

simont commented 8 years ago

It would be very useful to have access to the the owner of a particular file or collection so this could be displayed on a UI, especially for collections that are shared between multiple users. This may ultimately be part of a larger ACL feature but in the short term could this be made available via a .Owner string attribute that would be part of IRodsObj or similar?

Simon.

jjacquay712 commented 8 years ago

Looks like that information is being passed to GoRods: https://github.com/jjacquay712/GoRods/blob/master/collection.go#L412

However it's not being saved to the Collection or DataObj struct upon initialization: https://github.com/jjacquay712/GoRods/blob/master/collection.go#L58 https://github.com/jjacquay712/GoRods/blob/master/dataobj.go#L56

I'll setup some interface methods and implement them for both object types so you can get access to that data. In the meantime, some of that info can be grabbed using the DataObj.Stat() method:

https://godoc.org/github.com/jjacquay712/GoRods#DataObj.Stat

statInfo, _ := myDataObj.Stat()

owner := statInfo["ownerName"].(string)
jjacquay712 commented 8 years ago

New methods available for DataObj and Collection:

GetOwnerName() string
GetCreateTime() int // Unix epoch time
GetModifyTime() int  // Unix epoch time
simont commented 8 years ago

Hi John,

I can confirm this is working nicely, many thanks.