MCPcopy Index your code
hub / github.com/Permify/permify / SubjectToString

Function SubjectToString

pkg/tuple/tuple.go:73–84  ·  view source on GitHub ↗

SubjectToString converts a Subject object to string format.

(subject *base.Subject)

Source from the content-addressed store, hash-verified

71
72// SubjectToString converts a Subject object to string format.
73func SubjectToString(subject *base.Subject) string {
74 // Convert the subject's type and id to a string in the format of an entity
75 entity := fmt.Sprintf(ENTITY, subject.GetType(), subject.GetId())
76
77 // If the subject is a user, return the entity string
78 if IsDirectSubject(subject) {
79 return entity
80 }
81
82 // If the subject is not a user, add the relation to the string
83 return fmt.Sprintf("%s"+RELATION, entity, subject.GetRelation())
84}
85
86// ToString function converts a Tuple object to a string format.
87func ToString(tup *base.Tuple) string {

Callers 8

RunWithShapeMethod · 0.92
validateFunction · 0.92
CheckMethod · 0.92
LookupEntityMethod · 0.92
LookupEntityStreamMethod · 0.92
SubjectPermissionMethod · 0.92
GenerateKeyFunction · 0.92
ToStringFunction · 0.85

Calls 4

IsDirectSubjectFunction · 0.85
GetTypeMethod · 0.65
GetIdMethod · 0.45
GetRelationMethod · 0.45

Tested by

no test coverage detected