Documentation
¶
Index ¶
- Constants
- Variables
- func Activate()
- func CompareHashAndPassword(hash string, password string) bool
- func Create(db sqlbuilder.Database, userObj *User, orgName string) (string, int, error)
- func Exists(DB sqlbuilder.Database, UID ID) (bool, error)
- func GenerateHashedPassword(password string) string
- func Inactivate()
- type ID
- type Org
- type User
Constants ¶
View Source
const Type string = "User"
Type of Model
Variables ¶
View Source
var (
EmailValidationCompiledRegex = regexp.MustCompile(emailValidatinRegex)
)
TODO : ADD constraints for password special characters
Functions ¶
func CompareHashAndPassword ¶
CompareHashAndPassword compares password and hashes
func Exists ¶
func Exists(DB sqlbuilder.Database, UID ID) (bool, error)
Exists check whether user exists using its id
func GenerateHashedPassword ¶
GenerateHashedPassword generates hashes for the password
Types ¶
type ID ¶
type ID string
ID userID
func Authenticate ¶
Authenticate authenticates user by username and password
type Org ¶
type Org struct { UserID ID `json:"user_id,omitempty" db:"USER_ID"` OrgID org.ID `json:"org_id,omitempty" db:"ORG_ID"` }
Org type
type User ¶
type User struct { ID ID `json:"user_id,omitempty" db:"ID"` UserName string `json:"user_name,omitempty" db:"USER_NAME"` FirstName string `json:"first_name,omitempty" db:"FIRST_NAME"` LastName string `json:"last_name,omitempty" db:"LAST_NAME"` SuperUser int8 `json:"is_super_user,omitempty" db:"IS_SUPER"` Staff int8 `json:"is_staff,omitempty" db:"IS_STAFF"` Email cryptography.EncryptedString `json:"email,omitempty" db:"EMAIL"` DOJ time.Time `json:"doj,omitempty" db:"DOJ"` Active int8 `json:"active,omitempty" db:"ACTIVE"` PasswordHash string `json:"password_hash,omitempty" db:"PASSWORD_HASH"` }
User user type
func AuthenticateByID ¶
AuthenticateByID checks whether user is available by user id if user is present , return user
func (*User) IsSuperUser ¶
IsSuperUser checks whether user is super user
Click to show internal directories.
Click to hide internal directories.