Documentation ¶
Index ¶
- type Dao
- func (p *Dao) Allow(role uint, user uint, dur time.Duration) error
- func (p *Dao) Can(user uint, name string, rty string, rid uint) bool
- func (p *Dao) Deny(role uint, user uint) error
- func (p *Dao) GetUser(uid string) (*User, error)
- func (p *Dao) Is(user uint, name string) bool
- func (p *Dao) Role(name string, rty string, rid uint) (*Role, error)
- type Engine
- type Google
- type GoogleUser
- type Log
- type Permission
- type Role
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Google ¶
type Google struct { Web struct { ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` RedirectURLS []string `json:"redirect_uris"` } `json:"web"` }
Google google credentials model
type GoogleUser ¶
type GoogleUser struct { ID string `json:"id"` Email string `json:"email"` Name string `json:"name"` Link string `json:"link"` Picture string `json:"picture"` }
GoogleUser google user model
type Log ¶
type Log struct { ID uint `gorm:"primary_key" json:"id"` UserID uint `gorm:"not null" json:"-"` User User `json:"-"` Message string `gorm:"not null;type:VARCHAR(255)" json:"message"` CreatedAt time.Time `gorm:"not null;default:current_timestamp" json:"created_at"` }
Log log model
type Permission ¶
type Permission struct { gails.Model User User UserID uint `gorm:"not null"` Role Role RoleID uint `gorm:"not null"` Begin time.Time `gorm:"not null;default:current_date;type:date"` End time.Time `gorm:"not null;default:'1000-1-1';type:date"` }
Permission permission model
type Role ¶
type Role struct { gails.Model Name string `gorm:"not null;index;type:VARCHAR(255)"` ResourceType string `gorm:"not null;default:'-';index;type:VARCHAR(255)"` ResourceID uint `gorm:"not null;default:0"` }
Role role model
type User ¶
type User struct { gorm.Model Email string `gorm:"not null;index;type:VARCHAR(255)" json:"email"` UID string `gorm:"not null;unique_index;type:char(36)" json:"uid"` Home string `gorm:"not null;type:VARCHAR(255)" json:"home"` Logo string `gorm:"not null;type:VARCHAR(255)" json:"logo"` Name string `gorm:"not null;type:VARCHAR(255)" json:"name"` Password string `gorm:"not null;default:'-';type:VARCHAR(500)" json:"-"` ProviderType string `gorm:"not null;default:'unknown';index;type:VARCHAR(255)"` ProviderID string `gorm:"not null;index;type:VARCHAR(255)"` LastSignIn *time.Time `json:"last_sign_in"` SignInCount uint `gorm:"not null;default:0" json:"sign_in_count"` ConfirmedAt *time.Time `json:"confirmed_at"` LockedAt *time.Time `json:"locked_at"` Permissions []Permission `json:"permissions"` Logs []Log `json:"logs"` }
Click to show internal directories.
Click to hide internal directories.