String is not perfect, but decent enough for human display
()
| 44 | |
| 45 | // String is not perfect, but decent enough for human display |
| 46 | func (z Object) String() string { |
| 47 | var parts []string |
| 48 | if z.OrgID != "" { |
| 49 | parts = append(parts, fmt.Sprintf("org:%s", cstrings.Truncate(z.OrgID, 4))) |
| 50 | } |
| 51 | if z.Owner != "" { |
| 52 | parts = append(parts, fmt.Sprintf("owner:%s", cstrings.Truncate(z.Owner, 4))) |
| 53 | } |
| 54 | parts = append(parts, z.Type) |
| 55 | if z.ID != "" { |
| 56 | parts = append(parts, fmt.Sprintf("id:%s", cstrings.Truncate(z.ID, 4))) |
| 57 | } |
| 58 | if len(z.ACLGroupList) > 0 || len(z.ACLUserList) > 0 { |
| 59 | parts = append(parts, fmt.Sprintf("acl:%d", len(z.ACLUserList)+len(z.ACLGroupList))) |
| 60 | } |
| 61 | return strings.Join(parts, ".") |
| 62 | } |
| 63 | |
| 64 | // ValidAction checks if the action is valid for the given object type. |
| 65 | func (z Object) ValidAction(action policy.Action) error { |
no outgoing calls