user

package
v5.2.5+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2018 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddContact

func AddContact(user *tat.User, contactUsername string, contactFullname string) error

AddContact add a contact to user

func AddDefaultGroup

func AddDefaultGroup(user *tat.User) error

AddDefaultGroup add default group to user

func AddFavoriteTag

func AddFavoriteTag(user *tat.User, tag string) error

AddFavoriteTag Add a favorite tag to user

func AddFavoriteTopic

func AddFavoriteTopic(user *tat.User, topic string) error

AddFavoriteTopic add a favorite topic to user

func Archive

func Archive(user *tat.User, userAdmin string) error

Archive changes username of one user and set attribute email, username to random string

func AskReset

func AskReset(user *tat.User) (string, error)

AskReset generate a new saltTokenVerify / hashedTokenVerify return tokenVerify (to be sent to user by mail)

func CheckDefaultGroup

func CheckDefaultGroup(user *tat.User, fixDefaultGroup bool) string

CheckDefaultGroup check default group and creates it if fixDefaultGroup is true

func CheckTopics

func CheckTopics(user *tat.User, fixTopics bool) string

CheckTopics check default topics for user and creates them if fixTopics is true

func ConvertToAdmin

func ConvertToAdmin(user *tat.User, userAdmin string) error

ConvertToAdmin set attribute IsAdmin to true

func ConvertToSystem

func ConvertToSystem(user *tat.User, userAdmin string, canListUsersAsAdmin bool) (string, error)

ConvertToSystem set attribute IsSysetm to true and suffix mail with a random string. If canListUsersAsAdmin is true, this system user can view all user's fields as an admin (email, etc...) returns password, err

func CountUsers

func CountUsers() (int, error)

CountUsers returns the total number of users in db

func CreatePrivateTopic

func CreatePrivateTopic(user *tat.User, subTopic string) error

CreatePrivateTopic creates a Private Topic. Name of topic will be : /Private/username and if subTopic != "", it will be : /Private/username/subTopic CanUpdateMsg, CanDeleteMsg set to true

func DisableNotificationsAllTopics

func DisableNotificationsAllTopics(user *tat.User) error

DisableNotificationsAllTopics add all topics to user list offNotificationsTopics, except /Private/*

func DisableNotificationsTopic

func DisableNotificationsTopic(user *tat.User, topic string) error

DisableNotificationsTopic add topic to user list offNotificationsTopics

func EnableNotificationsAllTopics

func EnableNotificationsAllTopics(user *tat.User) error

EnableNotificationsAllTopics removes all topics from user list offNotificationsTopics

func EnableNotificationsTopic

func EnableNotificationsTopic(user *tat.User, topic string) error

EnableNotificationsTopic remove topic from user list offNotificationsTopics

func FindByEmail

func FindByEmail(user *tat.User, email string) (bool, error)

FindByEmail retrieve information from user with email

func FindByFullname

func FindByFullname(user *tat.User, fullname string) (bool, error)

FindByFullname retrieve information from user with fullname

func FindByUsername

func FindByUsername(user *tat.User, username string) (bool, error)

FindByUsername retrieve information from user with username

func FindByUsernameAndEmail

func FindByUsernameAndEmail(user *tat.User, username, email string) error

FindByUsernameAndEmail retrieve information from user with username

func FindByUsernameAndPassword

func FindByUsernameAndPassword(user *tat.User, username, password string) (bool, error)

FindByUsernameAndPassword search username, use user's salt to generates hashedPassword and check username + hashedPassword in DB

func GenerateSalt

func GenerateSalt() (string, error)

GenerateSalt generates salt, 32 length, with rand.Reader

func HashPassword

func HashPassword(password, salt string) string

HashPassword hashes password, with given salt It uses sha512.Sum

func Insert

func Insert(user *tat.User) (string, error)

Insert a new user, return tokenVerify to user, in order to validate account after check email

func ListUsers

func ListUsers(criteria *tat.UserCriteria, isAdmin bool) (int, []tat.User, error)

ListUsers returns users list selected by criteria

func RemoveContact

func RemoveContact(user *tat.User, contactUsername string) error

RemoveContact removes a contact from user

func RemoveFavoriteTag

func RemoveFavoriteTag(user *tat.User, tag string) error

RemoveFavoriteTag remove a favorite tag from user

func RemoveFavoriteTopic

func RemoveFavoriteTopic(user *tat.User, topic string) error

RemoveFavoriteTopic removes a favorite topic from user

func Rename

func Rename(user *tat.User, newUsername string) error

Rename changes username of one user

func ResetSystemUserPassword

func ResetSystemUserPassword(user *tat.User) (string, error)

ResetSystemUserPassword reset a password for a system user returns newPassword

func SendAskResetEmail

func SendAskResetEmail(username, to, tokenVerify, device string) error

SendAskResetEmail send a mail to user, ask him to confirm reset password

func SendVerifyEmail

func SendVerifyEmail(username, to, tokenVerify, device string) error

SendVerifyEmail send a mail to new user, ask him to valide his new account

func TrustUsername

func TrustUsername(user *tat.User, username string) error

TrustUsername create user is not already registered

func Update

func Update(user *tat.User, newFullname, newEmail string) error

Update changes fullname and email of user

func UpdateSystemUser

func UpdateSystemUser(user *tat.User, canListUsersAsAdmin bool) error

UpdateSystemUser updates flags CanListUsersAsAdmin

func Verify

func Verify(user *tat.User, username, tokenVerify string) (bool, string, error)

Verify checks username and tokenVerify, if ok, return true, password if it's a new user Password is not stored in Database (only hashedPassword) return isNewUser, password, err

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL