Documentation ¶
Index ¶
- Constants
- Variables
- func Authorize(r Roler, perm string) bool
- func ProposalFilterByUser(parentid int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func ReviewFilterByProposal(parentid int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func ReviewFilterByUser(parentid int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- type Login
- type Proposal
- type ProposalDB
- func (m *ProposalDB) Add(ctx context.Context, model Proposal) (Proposal, error)
- func (m *ProposalDB) Delete(ctx context.Context, id int) error
- func (m *ProposalDB) List(ctx context.Context) []Proposal
- func (m *ProposalDB) ListByUser(ctx context.Context, parentid int) []Proposal
- func (m *ProposalDB) One(ctx context.Context, id int) (Proposal, error)
- func (m *ProposalDB) OneByUser(ctx context.Context, parentid, id int) (Proposal, error)
- func (m *ProposalDB) Update(ctx context.Context, model Proposal) error
- type ProposalStorage
- type Review
- type ReviewDB
- func (m *ReviewDB) Add(ctx context.Context, model Review) (Review, error)
- func (m *ReviewDB) Delete(ctx context.Context, id int) error
- func (m *ReviewDB) List(ctx context.Context) []Review
- func (m *ReviewDB) ListByProposal(ctx context.Context, parentid int) []Review
- func (m *ReviewDB) ListByUser(ctx context.Context, parentid int) []Review
- func (m *ReviewDB) One(ctx context.Context, id int) (Review, error)
- func (m *ReviewDB) OneByProposal(ctx context.Context, parentid, id int) (Review, error)
- func (m *ReviewDB) OneByUser(ctx context.Context, parentid, id int) (Review, error)
- func (m *ReviewDB) Update(ctx context.Context, model Review) error
- type ReviewStorage
- type Roler
- type User
- type UserDB
- func (m *UserDB) Add(ctx context.Context, model User) (User, error)
- func (m *UserDB) ConfirmUser(confirmToken string) (interface{}, error)
- func (m *UserDB) Create(email string, attr authboss.Attributes) error
- func (m *UserDB) Delete(ctx context.Context, id int) error
- func (m *UserDB) Get(email string) (interface{}, error)
- func (m *UserDB) GetByLogin(ctx context.Context, l Login) (User, error)
- func (m *UserDB) List(ctx context.Context) []User
- func (m *UserDB) One(ctx context.Context, id int) (User, error)
- func (m *UserDB) Put(email string, attr authboss.Attributes) error
- func (m *UserDB) RecoverUser(recoverToken string) (interface{}, error)
- func (m *UserDB) Update(ctx context.Context, model User) error
- func (m *UserDB) UserByOauth(id, provider string) (User, error)
- type UserStorage
Constants ¶
View Source
const ( ADMIN = "Admin" USER = "User" AUTHCALLBACK = "auth.callback" AUTHOAUTH = "auth.oauth" AUTHREFRESH = "auth.refresh" AUTHTOKEN = "auth.token" PROPOSALCREATE = "proposal.create" PROPOSALDELETE = "proposal.delete" PROPOSALLIST = "proposal.list" PROPOSALSHOW = "proposal.show" PROPOSALUPDATE = "proposal.update" REVIEWCREATE = "review.create" REVIEWDELETE = "review.delete" REVIEWLIST = "review.list" REVIEWSHOW = "review.show" REVIEWUPDATE = "review.update" USERCREATE = "user.create" USERDELETE = "user.delete" USERLIST = "user.list" USERSHOW = "user.show" USERUPDATE = "user.update" )
Variables ¶
View Source
var RBAC *gorbac.RBAC
Functions ¶
func ProposalFilterByUser ¶
would prefer to just pass a context in here, but they're all different, so can't
func ReviewFilterByProposal ¶
would prefer to just pass a context in here, but they're all different, so can't
Types ¶
type Proposal ¶
type Proposal struct { ID int `json:"ID,omitempty" gorm:"primary_key"` Abstract string `json:"abstract,omitempty"` Detail string `json:"detail,omitempty"` Firstname string `json:"firstname,omitempty"` Title string `json:"title,omitempty"` Withdrawn bool `json:"withdrawn,omitempty"` // Timestamps CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time // Foreign Keys UserID int // Children Reviews []Review }
app.ProposalModel storage type Identifier:
func FilterProposalByUser ¶
func ProposalFromCreatePayload ¶
func ProposalFromCreatePayload(ctx *app.CreateProposalContext) Proposal
func ProposalFromUpdatePayload ¶
func ProposalFromUpdatePayload(ctx *app.UpdateProposalContext) Proposal
type ProposalDB ¶
func NewProposalDB ¶
func NewProposalDB(db gorm.DB) *ProposalDB
func (*ProposalDB) ListByUser ¶
func (m *ProposalDB) ListByUser(ctx context.Context, parentid int) []Proposal
type ProposalStorage ¶
type ProposalStorage interface { List(ctx context.Context) []Proposal One(ctx context.Context, id int) (Proposal, error) Add(ctx context.Context, o Proposal) (Proposal, error) Update(ctx context.Context, o Proposal) error Delete(ctx context.Context, id int) error ListByUser(ctx context.Context, parentid int) []Proposal OneByUser(ctx context.Context, parentid, id int) (Proposal, error) }
type Review ¶
type Review struct { ID int `json:"ID,omitempty" gorm:"primary_key"` Comment string `json:"comment,omitempty"` Rating int `json:"rating,omitempty"` // Timestamps CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time // Foreign Keys ProposalID int UserID int }
app.ReviewModel storage type Identifier:
func FilterReviewByProposal ¶
func FilterReviewByUser ¶
func ReviewFromCreatePayload ¶
func ReviewFromCreatePayload(ctx *app.CreateReviewContext) Review
func ReviewFromUpdatePayload ¶
func ReviewFromUpdatePayload(ctx *app.UpdateReviewContext) Review
type ReviewDB ¶
func NewReviewDB ¶
func (*ReviewDB) ListByProposal ¶
func (*ReviewDB) ListByUser ¶
func (*ReviewDB) OneByProposal ¶
type ReviewStorage ¶
type ReviewStorage interface { List(ctx context.Context) []Review One(ctx context.Context, id int) (Review, error) Add(ctx context.Context, o Review) (Review, error) Update(ctx context.Context, o Review) error Delete(ctx context.Context, id int) error ListByProposal(ctx context.Context, parentid int) []Review OneByProposal(ctx context.Context, parentid, id int) (Review, error) ListByUser(ctx context.Context, parentid int) []Review OneByUser(ctx context.Context, parentid, id int) (Review, error) }
type Roler ¶
type Roler interface {
GetRole() string
}
Roler is an interface that provides a Role function which returns a string value representing the role to which a user belongs.
type User ¶
type User struct { ID int `json:"ID,omitempty" gorm:"primary_key"` Bio string `json:"bio,omitempty"` City string `json:"city,omitempty"` Country string `json:"country,omitempty"` Email string `json:"email,omitempty"` Firstname string `json:"firstname,omitempty"` Lastname string `json:"lastname,omitempty"` Role string `json:"role,omitempty"` State string `json:"state,omitempty"` // Timestamps CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time // Children Proposals []Proposal Reviews []Review // Auth Password string // OAuth2 Oauth2Uid string Oauth2Provider string Oauth2Token string Oauth2Refresh string Oauth2Expiry time.Time // Confirm ConfirmToken string Confirmed bool // Lock AttemptNumber int64 AttemptTime time.Time Locked time.Time // Recover RecoverToken string RecoverTokenExpiry time.Time }
app.UserModel storage type Identifier:
func UserFromCreatePayload ¶
func UserFromCreatePayload(ctx *app.CreateUserContext) User
func UserFromUpdatePayload ¶
func UserFromUpdatePayload(ctx *app.UpdateUserContext) User
func (*User) BeforeCreate ¶
Click to show internal directories.
Click to hide internal directories.