Documentation ¶
Index ¶
- func GetRelatedUserGroupIDs(userGroups []*pbUser.RelatedUserGroup, db *pg.Tx) ([]uuid.UUID, error)
- func GetRelatedUserGroups(ids []uuid.UUID, db orm.DB) ([]*pbUser.RelatedUserGroup, error)
- func GetTagIDs(t []*pbUser.Tag, db *pg.Tx) ([]uuid.UUID, error)
- func GetTags(tagIds []uuid.UUID, db *pg.DB) ([]*pbUser.Tag, twirp.Error)
- func SearchUserGroups(query string, db *pg.DB) (*pbUser.SearchResults, twirp.Error)
- type AccessRole
- type AuthUser
- type GroupTaxonomy
- type Link
- type Logger
- type RBACService
- type Role
- type StreetAddress
- type Tag
- type Tenant
- type User
- type UserGroup
- func (u *UserGroup) AddRecommended(db *pg.DB, recommendedID uuid.UUID) (error, string)
- func (u *UserGroup) BeforeInsert(c context.Context, db orm.DB) error
- func (u *UserGroup) Create(db *pg.DB, userGroup *pbUser.UserGroup) (error, string)
- func (u *UserGroup) Delete(tx *pg.Tx) (error, string)
- func (u *UserGroup) RemoveRecommended(db *pg.DB, recommendedID uuid.UUID) (error, string)
- func (u *UserGroup) Update(db *pg.DB, userGroup *pbUser.UserGroup) (error, string)
- type UserGroupMember
- type UserGroupPrivacy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRelatedUserGroupIDs ¶
Select user groups in db with given ids in 'userGroups' Return ids slice Used in CreateUserGroup/UpdateUserGroup to add/update ids slice to recommended Artists
func GetRelatedUserGroups ¶
Select user groups in db with given 'ids' Return slice of UserGroup response
func SearchUserGroups ¶
Types ¶
type AccessRole ¶
type AccessRole int8
AccessRole represents access role type
const ( // SuperAdminRole has all permissions and can assign admins SuperAdminRole AccessRole = iota + 1 // 1 // AdminRole has admin permissions across all tenants, except the ability to assign other Admins AdminRole // 2 // TenantAdminRole has admin permissions over other users in their tenant. TenantAdminRole // 3 // ArtistRole is a like a standard user, but can have multiple personas and the ability to upload ArtistRole // 4 // UserRole is a standard user UserRole // 5 )
type GroupTaxonomy ¶
type Link ¶
type Link struct { ID uuid.UUID `sql:"type:uuid,default:uuid_generate_v4()"` URI string `sql:",notnull"` Type string Platform string `sql:",notnull"` PersonalData bool `sql:",notnull"` }
Link is an internet hyperlink
type Logger ¶
type Logger interface { // source, msg, error, params Log(context.Context, string, string, error, map[string]interface{}) }
Logger represents logging interface
type RBACService ¶
type RBACService interface { EnforceRole(context.Context, AccessRole) bool EnforceUser(context.Context, uuid.UUID) bool EnforceTenant(context.Context, uuid.UUID) bool EnforceTenantAdmin(context.Context, int32) bool EnforceTenantAndRole(context.Context, AccessRole, int32) bool IsLowerRole(context.Context, AccessRole) bool }
RBACService represents role-based access control service interface
type StreetAddress ¶
type StreetAddress struct { ID uuid.UUID `sql:"type:uuid,default:uuid_generate_v4()"` PersonalData bool `sql:",notnull"` Data map[string]string `pg:",hstore"` }
StreetAddress holds geographical data and marks if private
type Tag ¶
type Tag struct { ID uuid.UUID `sql:"type:uuid,default:uuid_generate_v4()"` Type string `sql:",notnull"` Name string `sql:",notnull"` }
Tag provides basic tag structure
type Tenant ¶
type Tenant struct { Id uuid.UUID `sql:"type:uuid,default:uuid_generate_v4()"` Name string `json:"name"` Active bool `json:"active"` }
Tenant table
type User ¶
type User struct { ID uuid.UUID `sql:"type:uuid,default:uuid_generate_v4()"` CreatedAt time.Time `sql:"default:now()"` UpdatedAt time.Time Username string `sql:",notnull,unique"` FullName string `sql:",notnull"` FirstName string LastName string Email string `sql:",unique,notnull"` Member bool `sql:",notnull"` NewsletterNotification bool FollowedGroups []uuid.UUID `sql:",type:uuid[]" pg:",array"` OwnerOfGroups []UserGroup `pg:"fk:owner_id"` TenantID int32 RoleID int32 LastLogin *time.Time LastPasswordChange *time.Time Password string Token string }
User basic definition of a User and its meta
func (*User) FollowGroup ¶
FollowGroup causes a User to follow a UserGroup
func (*User) UnfollowGroup ¶
UnfollowGroup removes the follow state of the supplied User from the supplied userGroup via the supplied userGroupID
func (*User) UpdateLoginDetails ¶
UpdateLoginDetails updates login related fields
type UserGroup ¶
type UserGroup struct { ID uuid.UUID `sql:"type:uuid,default:uuid_generate_v4()"` CreatedAt time.Time `sql:"default:now()"` UpdatedAt time.Time DisplayName string `sql:",unique,notnull"` Description string ShortBio string Avatar []byte `sql:",notnull"` Banner []byte GroupEmailAddress string PrivacyID uuid.UUID `sql:"type:uuid,notnull"` Privacy *UserGroupPrivacy AddressID uuid.UUID `sql:"type:uuid,notnull"` Address *StreetAddress TypeID uuid.UUID `sql:"type:uuid,notnull"` Type *GroupTaxonomy OwnerID uuid.UUID `sql:"type:uuid,notnull"` Owner *User Links []uuid.UUID `sql:",type:uuid[]" pg:",array"` Tags []uuid.UUID `sql:",type:uuid[]" pg:",array"` RecommendedArtists []uuid.UUID `sql:",type:uuid[]" pg:",array"` RecommendedBy []uuid.UUID `sql:",type:uuid[]" pg:",array"` Followers []uuid.UUID `sql:",type:uuid[]" pg:",array"` AdminUsers []uuid.UUID `sql:",type:uuid[]" pg:",array"` Members []UserGroup `pg:"many2many:user_group_members,fk:user_group_id,joinFK:member_id"` MemberOfGroups []UserGroup `pg:"many2many:user_group_members,fk:member_id,joinFK:user_group_id"` Kvstore map[string]string `pg:",hstore"` Publisher map[string]string `pg:",hstore"` Pro map[string]string `pg:",hstore"` }
UserGroup represents a group of Users and maintains a set of metadata