github.com/cyverse/go-irodsclient@v0.13.2/irods/types/access.go (about) 1 package types 2 3 import "fmt" 4 5 // IRODSAccessLevelType is a type for access level 6 type IRODSAccessLevelType string 7 8 const ( 9 // IRODSAccessLevelOwner is for owner access 10 IRODSAccessLevelOwner IRODSAccessLevelType = "own" 11 // IRODSAccessLevelWrite is for write access 12 IRODSAccessLevelWrite IRODSAccessLevelType = "modify object" 13 // IRODSAccessLevelRead is for read access 14 IRODSAccessLevelRead IRODSAccessLevelType = "read object" 15 // IRODSAccessLevelNone is for no access 16 IRODSAccessLevelNone IRODSAccessLevelType = "" 17 ) 18 19 // ChmodString returns the string for update access control messages. 20 func (accessType IRODSAccessLevelType) ChmodString() string { 21 switch accessType { 22 case IRODSAccessLevelRead: 23 return "read" 24 case IRODSAccessLevelWrite: 25 return "write" 26 case IRODSAccessLevelNone: 27 return "null" 28 default: 29 return string(accessType) 30 } 31 } 32 33 // IRODSAccess contains irods access information 34 type IRODSAccess struct { 35 Path string 36 UserName string 37 UserZone string 38 UserType IRODSUserType 39 AccessLevel IRODSAccessLevelType 40 } 41 42 // ToString stringifies the object 43 func (access *IRODSAccess) ToString() string { 44 return fmt.Sprintf("<IRODSAccess %s %s %s %s %s>", access.Path, access.UserName, access.UserZone, string(access.UserType), string(access.AccessLevel)) 45 }