package entity import ( "gateway/internal/model/permission/domain/enum" "go.mongodb.org/mongo-driver/v2/bson" ) // UserRole assigns a Role to a member within a tenant. A member can hold // multiple roles (any-allow Casbin semantics); Source allows // SyncFromX flows to replace only their own assignments without touching // manual ones. type UserRole struct { ID bson.ObjectID `bson:"_id,omitempty"` TenantID string `bson:"tenant_id"` UID string `bson:"uid"` RoleID string `bson:"role_id"` Source enum.RoleSource `bson:"source"` CreateAt int64 `bson:"create_at"` UpdateAt int64 `bson:"update_at"` } // CollectionName returns the MongoDB collection for user↔role joins. func (UserRole) CollectionName() string { return "user_roles" }