port

package module
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 14 Imported by: 0

README

portsafebackend

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func CompareHashPass added in v0.0.51

func CompareHashPass(password, hash string) bool

func CompareNipp added in v0.0.51

func CompareNipp(MongoConn *mongo.Database, Colname, nipp string) bool

func DecodeGetRole added in v0.0.51

func DecodeGetRole(PublicKey, tokenStr string) (pay string, err error)

func DecodeGetRoleandUser added in v0.0.51

func DecodeGetRoleandUser(PublicKey, tokenStr string) (pay string, use string)

func DecodeGetUser added in v0.0.51

func DecodeGetUser(PublicKey, tokenStr string) (pay string, err error)

func DeleteUser added in v0.0.38

func DeleteUser(Mongoconn *mongo.Database, colname, nipp string) (deleted interface{}, err error)

func DeleteUserforAdmin added in v0.0.51

func DeleteUserforAdmin(Mongoenv, publickey, dbname, colname string, r *http.Request) string

func EncodeWithRole added in v0.0.51

func EncodeWithRole(role, nipp, privatekey string) (string, error)

func GCFGetHandler

func GCFGetHandler(MONGOCONNSTRINGENV, dbname, collectionname string) string

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

func GCFUpdateHandler added in v0.0.38

func GCFUpdateHandler(MONGOCONNSTRINGENV, dbname, collectionname string, r *http.Request) string

func GetDataUserForAdmin added in v0.0.51

func GetDataUserForAdmin(PublicKey, MongoEnv, dbname, colname string, r *http.Request) string

func HashPassword

func HashPassword(password string) (string, error)

func InsertOneDoc added in v0.0.51

func InsertOneDoc(db *mongo.Database, collection string, doc interface{}) (insertedID interface{})

func InsertUserdata added in v0.0.51

func InsertUserdata(MongoConn *mongo.Database, nipp, nama, jabatan, divisi, bidang, password, role string) (InsertedID interface{})

func IsAdmin added in v0.0.51

func IsAdmin(Tokenstr, PublicKey string) bool

func IsUser added in v0.0.51

func IsUser(TokenStr, Publickey string) bool

func Login added in v0.0.51

func Login(Privatekey, MongoEnv, dbname, Colname string, r *http.Request) string

func PasswordValidator added in v0.0.51

func PasswordValidator(MongoConn *mongo.Database, colname string, userdata User) bool

func Register added in v0.0.51

func Register(Mongoenv, dbname string, r *http.Request) string

func ReplaceOneDoc added in v0.0.38

func ReplaceOneDoc(mongoconn *mongo.Database, collection string, filter bson.M, userdata User) interface{}

func ResetPassword added in v0.0.51

func ResetPassword(MongoEnv, publickey, dbname, colname string, r *http.Request) string

func SetConnection

func SetConnection(MONGOCONNSTRINGENV, dbname string) *mongo.Database

func TokenEncoder added in v0.0.51

func TokenEncoder(username, privatekey string) string

func UpdatePassword added in v0.0.51

func UpdatePassword(mongoconn *mongo.Database, user User) (Updatedid interface{})

Types

type Cred added in v0.0.51

type Cred struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

type Credential

type Credential struct {
	Status  bool   `json:"status" bson:"status"`
	Token   string `json:"token,omitempty" bson:"token,omitempty"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
}

type Payload added in v0.0.38

type Payload struct {
	User string    `json:"user"`
	Role string    `json:"role"`
	Exp  time.Time `json:"exp"`
	Iat  time.Time `json:"iat"`
	Nbf  time.Time `json:"nbf"`
}

func Decoder added in v0.0.51

func Decoder(publickey, tokenstr string) (payload Payload, err error)

type Properties

type Properties struct {
	Name string `json:"name" bson:"name"`
}

type Report added in v0.0.44

type Report struct {
	ID                 primitive.ObjectID `bson:"_id,omitempty" `
	Reportid           string             `json:"reportid" bson:"reportid"`
	Date               string             `json:"date" bson:"date"`
	Supervisorid       int                `json:"supervisorid" bson:"supervisorid"`
	SupervisorName     string             `json:"supervisorname" bson:"supervisorname"`
	SupervisorPosition string             `json:"supervisorposition" bson:"supervisorposition"`
	IncidentLocation   string             `json:"incidentlocation" bson:"incidentlocation"`
	Description        string             `json:"description" bson:"description"`
	ObservationPhoto   string             `json:"observationphoto" bson:"observationphoto"`
	PeopleReactions    string             `json:"peoplereactions" bson:"peoplereactions"`
	PPE                string             `json:"ppe" bson:"ppe"`
	PersonPosition     string             `json:"personposition" bson:"personposition"`
	Equipment          string             `json:"equipment" bson:"equipment"`
	WorkProcedure      string             `json:"workprocedure" bson:"workprocedure"`
	Area               string             `json:"area" bson:"area"`
	ImmediateAction    string             `json:"immediateaction" bson:"immediateaction"`
	ImprovementPhoto   string             `json:"improvementphoto" bson:"improvementphoto"`
	CorrectiveAction   string             `json:"correctiveaction" bson:"correctiveaction"`
}

type ReqUsers added in v0.0.51

type ReqUsers struct {
	Nipp string `json:"nipp"`
}

type Response added in v0.0.38

type Response struct {
	Token string `json:"token,omitempty" bson:"token,omitempty"`
}

type ResponseDataUser added in v0.0.51

type ResponseDataUser struct {
	Status  bool   `json:"status" bson:"status"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
	Data    []User `json:"data,omitempty" bson:"data,omitempty"`
}

type ResponseEncode added in v0.0.51

type ResponseEncode struct {
	Message string `json:"message,omitempty" bson:"message,omitempty"`
	Token   string `json:"token,omitempty" bson:"token,omitempty"`
}

type User

type User struct {
	Nipp     string `json:"nipp" bson:"nipp"`
	Nama     string `json:"nama" bson:"nama"`
	Jabatan  string `json:"jabatan" bson:"jabatan"`
	Divisi   string `json:"divisi" bson:"divisi"`
	Bidang   string `json:"bidang" bson:"bidang"`
	Password string `json:"password" bson:"password"`
	Role     string `json:"role,omitempty" bson:"role,omitempty"`
}

func GCFGetHandle

func GCFGetHandle(mongoconn *mongo.Database, collection string) []User

func GetAllUser added in v0.0.51

func GetAllUser(MongoConn *mongo.Database, colname string) []User

func GetOneUser added in v0.0.51

func GetOneUser(MongoConn *mongo.Database, colname string, userdata User) User

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳