Versions in this module Expand all Collapse all v1 v1.0.6 Oct 31, 2016 v1.0.5 Sep 28, 2016 Changes in this version + const CodeAccountAccoutGroupsAccountIdNotValidError + const CodeAccountAccoutGroupsNotFoundError + const CodeAccountAuthenticatorModificationNotAllowedError + const CodeAccountCreateAuthenticatorError + const CodeAccountCreateGroupFailedError + const CodeAccountCreateGroupParamError + const CodeAccountCreateParamError + const CodeAccountDeleteGroupFailedError + const CodeAccountDeleteGroupGroupIdNotValidError + const CodeAccountGetAccountError + const CodeAccountGetAccountNotFoundError + const CodeAccountGetGroupGroupIdNotFoundError + const CodeAccountGetGroupGroupIdNotValidError + const CodeAccountGrantServicePermissionFailedError + const CodeAccountGrantServicePermissionParamError + const CodeAccountGroupAccountsGroupIdNotValidError + const CodeAccountGroupAccountsNotFoundError + const CodeAccountJoinGroupAccountIdNotValidError + const CodeAccountJoinGroupFailedError + const CodeAccountJoinGroupGroupIdNotValidError + const CodeAccountLeaveGroupAccountIdNotValidError + const CodeAccountLeaveGroupFailedError + const CodeAccountLeaveGroupGroupIdNotValidError + const CodeAccountListGroupNotFoundError + const CodeAccountLoginFailedEmailNotValidError + const CodeAccountLoginFailedError + const CodeAccountLoginFailedPasswordNotValidError + const CodeAccountLoginParamError + const CodeAccountLogoutError + const CodeAccountRevokeServicePermissionFailedError + const CodeAccountRevokeServicePermissionParamError + const CodeAccountTokenInvalidError + const CodeAccountUpdateGroupFailedError + const CodeAccountUpdateGroupParamError + const CodeInvalidGroupId + const DEFAULT_SALT + const PERMISSION_LABEL_PREFIX + const SESSION_DURATION + const SESSION_KEY_FORMAT + var AccountError error + var AccountsError error + var AuthError error + var CreateAccountError error + var ErrAccountNotFound = errors.New("account not found") + var ErrGroupNotFound = errors.New("group not found") + var ErrLoginFailed = errors.New("account login failed") + func GenToken(a *Account) string + func PermissionGrantLabelsPairFromGroupIdAndPerm(groupId uint64, perm string) map[string]string + func PermissionRevokeLabelKeysFromPermissionId(permissionId string) []string + type Account struct + Email string + ID uint64 + LoginAt time.Time + Password string + Phone string + Title string + Token string + func ReferenceToValue(a *Account) Account + type AccountFilter url.Values + type AccountGroup struct + AccountId uint64 + GroupId uint64 + ID uint64 + type Authenticator interface + Account func(id interface{}) (*Account, error) + AccountGroups func(account model.ListOptions) (*[]Group, error) + AccountPermissions func(account *Account) (*[]string, error) + Accounts func(listOptions model.ListOptions) (*[]Account, error) + CreateAccount func(groupId uint64, a *Account) error + CreateGroup func(role *Group) error + DeleteGroup func(groupId uint64) error + EncryptPassword func(password string) string + GetDefaultAccounts func() []Account + Group func(id uint64) (*Group, error) + GroupAccounts func(account model.ListOptions) (*[]Account, error) + Groups func(listOptions model.ListOptions) (*[]Group, error) + JoinGroup func(accountId, groupId uint64) error + LeaveGroup func(accountId, groupId uint64) error + Login func(account *Account) (token string, err error) + ModificationAllowed func() bool + UpdateAccount func(a *Account) error + UpdateGroup func(role *Group) error + type Group struct + CreaterId uint64 + ID uint64 + Name string + type GroupFilter url.Values + type GroupPermission struct + GroupID uint64 + Permission Permission + type MockAuthenticator struct + func NewMockAuthenticator() *MockAuthenticator + func (d *MockAuthenticator) Account(id interface{}) (*Account, error) + func (d *MockAuthenticator) AccountGroups(account model.ListOptions) (*[]Group, error) + func (d *MockAuthenticator) AccountPermissions(account *Account) (*[]string, error) + func (d *MockAuthenticator) Accounts(listOptions model.ListOptions) (auths *[]Account, err error) + func (d *MockAuthenticator) CreateAccount(groupId uint64, a *Account) error + func (d *MockAuthenticator) CreateGroup(g *Group) error + func (d *MockAuthenticator) DeleteGroup(groupId uint64) error + func (d *MockAuthenticator) EncryptPassword(password string) string + func (d *MockAuthenticator) GetDefaultAccounts() (account []Account) + func (d *MockAuthenticator) Group(id uint64) (*Group, error) + func (d *MockAuthenticator) GroupAccounts(account model.ListOptions) (*[]Account, error) + func (d *MockAuthenticator) Groups(options model.ListOptions) (auths *[]Group, err error) + func (d *MockAuthenticator) JoinGroup(accountId, groupId uint64) error + func (d *MockAuthenticator) LeaveGroup(accountId, groupId uint64) error + func (d *MockAuthenticator) Login(a *Account) (token string, err error) + func (d *MockAuthenticator) ModificationAllowed() bool + func (d *MockAuthenticator) UpdateAccount(a *Account) error + func (d *MockAuthenticator) UpdateGroup(g *Group) error + type Permission struct + Display string + Perm int + var PermAdmin Permission = Permission{ ... } + var PermReadOnly Permission = Permission{ ... } + var PermReadWrite Permission = Permission{ ... } + var Perms []Permission = []Permission{ ... } + func NewPermission(display string) Permission + func PermGreaterOrEqualThan(p Permission) []Permission + func PermLessOrEqualThan(p Permission) []Permission + func (p Permission) Normalize() Permission + type TokenStore interface + Del func(ctx *gin.Context, token string) error + Get func(ctx *gin.Context, token string) (string, error) + Set func(ctx *gin.Context, token, account_id string, expired_at time.Time) error v1.0.0-rc1 Aug 18, 2016