| 126 | } |
| 127 | |
| 128 | func UserConverter() *sqltypes.VariableConverter { |
| 129 | matcher := sqltypes.NewVariableConverter().RegisterMatcher( |
| 130 | resourceIDMatcher(), |
| 131 | // Users are never owned by an organization, so always return the empty string |
| 132 | // for the org owner. |
| 133 | sqltypes.StringVarMatcher("''", []string{"input", "object", "org_owner"}), |
| 134 | // Users are always owned by themselves. |
| 135 | sqltypes.StringVarMatcher("id :: text", []string{"input", "object", "owner"}), |
| 136 | ) |
| 137 | matcher.RegisterMatcher( |
| 138 | // No ACLs on the user type |
| 139 | sqltypes.AlwaysFalse(groupACLMatcher(matcher)), |
| 140 | sqltypes.AlwaysFalse(userACLMatcher(matcher)), |
| 141 | ) |
| 142 | return matcher |
| 143 | } |
| 144 | |
| 145 | // NoACLConverter should be used when the target SQL table does not contain |
| 146 | // group or user ACL columns. |