Documentation
¶
Overview ¶
Package users represents a logged in user
Index ¶
- Constants
- func Admins() *query.Query
- func AllowedParams() []string
- func AllowedParamsAdmin() []string
- func Create(params map[string]string) (int64, error)
- func Editors() *query.Query
- func Exists(e string) bool
- func Query() *query.Query
- func Readers() *query.Query
- func Where(format string, args ...interface{}) *query.Query
- type User
- func (m *User) Admin() bool
- func (m *User) Anon() bool
- func (u *User) CanComment() bool
- func (u *User) CanDownvote() bool
- func (u *User) CanFlag() bool
- func (u *User) CanSubmit() bool
- func (u *User) CanUpvote() bool
- func (m *User) Destroy() error
- func (m *User) Editor() bool
- func (m *User) Keywords() string
- func (m *User) Reader() bool
- func (m *User) RoleDisplay() string
- func (m *User) RoleOptions() []helpers.Option
- func (m *User) SelectName() string
- func (m *User) URLShow() string
- func (m *User) Update(params map[string]string) error
Constants ¶
const ( RoleAnon = 0 RoleReader = 20 RoleEditor = 50 RoleAdmin = 100 )
Role constants for this package
Variables ¶
This section is empty.
Functions ¶
func AllowedParams ¶
func AllowedParams() []string
AllowedParams returns an array of acceptable params in update
func AllowedParamsAdmin ¶
func AllowedParamsAdmin() []string
AllowedParamsAdmin returns an array of acceptable params in update for admins
Types ¶
type User ¶
type User struct {
model.Model
status.ModelStatus
Role int64
EncryptedPassword string
Email string
Name string
Title string
Summary string
Text string
Points int64
}
User represents a user of the service
func NewWithColumns ¶
NewWithColumns creates a user from database columns - used by query in creating objects
func (*User) CanComment ¶
CanComment returns true if this user can comment
func (*User) CanDownvote ¶
CanDownvote returns true if this user can downvote
func (*User) CanUpvote ¶
CanUpvote returns true if this user can upvote TODO: change later - just let all users upvote for now
func (*User) RoleDisplay ¶
RoleDisplay returns the string representation of the Role status
func (*User) RoleOptions ¶
RoleOptions returns an array of Role values for this model (embedders may override this and roledisplay to extend)
func (*User) SelectName ¶
SelectName returns the name which should be used for select options