UpdateRelationReferences updates the relationship references for a given key. It replaces the existing relation types with the new ones provided. If the key is empty, it returns an error.
(key string, types []RelationTypeStatement)
| 121 | // It replaces the existing relation types with the new ones provided. |
| 122 | // If the key is empty, it returns an error. |
| 123 | func (refs *References) UpdateRelationReferences(key string, types []RelationTypeStatement) error { |
| 124 | if len(key) == 0 { |
| 125 | return fmt.Errorf("key cannot be empty") |
| 126 | } |
| 127 | refs.relationReferences[key] = types // Update or set the relationship types for the key. |
| 128 | refs.references[key] = RELATION // Mark this key as a relation reference. |
| 129 | return nil |
| 130 | } |
| 131 | |
| 132 | // UpdatePermissionReference updates the permission references for a given key. |
| 133 | // This typically means marking a particular entity or action as permitted. |