Documentation ¶
Index ¶
- Constants
- Variables
- func AuthGMVerifierWrapper(handler http.HandlerFunc) http.HandlerFunc
- func AuthReviewerVerifyWrapper(handler http.HandlerFunc) http.HandlerFunc
- func AuthUserVerifierWrapper(handler http.HandlerFunc) http.HandlerFunc
- func ConvertName(rawString string) string
- func EmailFilter(orig string) string
- func FormalIdVerifier(str string) bool
- func GetGMSessionValue(req *http.Request, key interface{}) (interface{}, error)
- func GetNewApplicationDatabase() *mgo.Database
- func GetNewMiscDatabase() *mgo.Database
- func GetNewReviewerDatabase() *mgo.Database
- func GetNewStagingDatabase() *mgo.Database
- func GetNewUserDatabase() *mgo.Database
- func GetReviewerSessionValue(req *http.Request, key interface{}) (interface{}, error)
- func GetSessionGMId(req *http.Request) (bson.ObjectId, error)
- func GetSessionReviewerId(req *http.Request) (bson.ObjectId, error)
- func GetSessionUserId(req *http.Request) (bson.ObjectId, error)
- func GetUserSessionValue(req *http.Request, key interface{}) (interface{}, error)
- func NewHashString() string
- func NewSecureHashString() string
- func RequestMethodGuard(handler http.HandlerFunc, methods ...string) http.HandlerFunc
- func ResponseOkAsJson(resp http.ResponseWriter, value interface{}) (int, error)
- func ResponseStatusAsJson(resp http.ResponseWriter, status int, value interface{}) (int, error)
- func SendMail(to string, applier BasicUser, url string) error
- func SetGMSessionValue(req *http.Request, resp http.ResponseWriter, key, value interface{}) error
- func SetReviewerSessionValue(req *http.Request, resp http.ResponseWriter, key, value interface{}) error
- func SetUserSessionValue(req *http.Request, resp http.ResponseWriter, key, value interface{}) error
- func StringJoin(sep string, elements ...string) string
- type BasicUser
- type FileStoragePath
- type RecommResult
- type RecommView
- type ReviewResponse
- type ReviewScore
- type ReviewerProfile
- type SimpleResult
- type TopicId
- type UserPermission
- type UserProfile
Constants ¶
View Source
const ( /* Permission Bit mask */ USER_PERMISSION_NORMAL = 0 USER_PERMISSION_REVIEW = 1 USER_PERMISSION_RECOMM = 2 /*Admin Permission*/ USER_PERMISSION_GM = 4 )
View Source
const ( MAIN_STORAGE_BUCKET = "nthu-a-plus-storage" USER_AUTH_SESSION = "user-auth" USER_ID_SESSION_KEY = "user_id" USER_PERMISSION_SESSION_KEY = "user_perm" REVIEWER_AUTH_SESSION = "reviewer-auth" REVIEWER_ID_SESSION_KEY = "reviewer_id" GM_AUTH_SESSION = "gm-auth" GM_ID_SESSION_KEY = "gm_id" APPLICATION_DB_FORM_COLLECTION = "forms" APPLICATION_DB_RECOMM_COLLECTION = "recomms" )
View Source
const (
GM_PERMITTED_HEADER_KEY = "GM-AUTHORIZE-DATA"
)
Variables ¶
View Source
var ( CONFIG_FILE_NAME string = "config" Config *viper.Viper DB_ADDRESS string = "127.0.0.1" //Loggers LogV *log.Logger LogD *log.Logger LogE *log.Logger LogW *log.Logger //Session SessionStorage *sessions.CookieStore //Cloud Storage Signed URL StoragePrivateKey []byte StorageServiceAccountEmail string RecommLetterSubject string RecommLetterTmpl *template.Template )
Functions ¶
func AuthGMVerifierWrapper ¶
func AuthGMVerifierWrapper(handler http.HandlerFunc) http.HandlerFunc
func AuthReviewerVerifyWrapper ¶
func AuthReviewerVerifyWrapper(handler http.HandlerFunc) http.HandlerFunc
func AuthUserVerifierWrapper ¶
func AuthUserVerifierWrapper(handler http.HandlerFunc) http.HandlerFunc
func ConvertName ¶
func EmailFilter ¶
func FormalIdVerifier ¶
func GetGMSessionValue ¶
func GetNewApplicationDatabase ¶
func GetNewApplicationDatabase() *mgo.Database
func GetNewMiscDatabase ¶
func GetNewMiscDatabase() *mgo.Database
func GetNewReviewerDatabase ¶
func GetNewReviewerDatabase() *mgo.Database
func GetNewStagingDatabase ¶
func GetNewStagingDatabase() *mgo.Database
func GetNewUserDatabase ¶
func GetNewUserDatabase() *mgo.Database
func GetReviewerSessionValue ¶
func GetUserSessionValue ¶
func NewHashString ¶
func NewHashString() string
func NewSecureHashString ¶
func NewSecureHashString() string
func RequestMethodGuard ¶
func RequestMethodGuard(handler http.HandlerFunc, methods ...string) http.HandlerFunc
func ResponseOkAsJson ¶
func ResponseOkAsJson(resp http.ResponseWriter, value interface{}) (int, error)
func ResponseStatusAsJson ¶
func ResponseStatusAsJson(resp http.ResponseWriter, status int, value interface{}) (int, error)
func SetGMSessionValue ¶
func SetGMSessionValue(req *http.Request, resp http.ResponseWriter, key, value interface{}) error
func SetReviewerSessionValue ¶
func SetReviewerSessionValue(req *http.Request, resp http.ResponseWriter, key, value interface{}) error
func SetUserSessionValue ¶
func SetUserSessionValue(req *http.Request, resp http.ResponseWriter, key, value interface{}) error
func StringJoin ¶
Types ¶
type FileStoragePath ¶
type FileStoragePath string
type RecommResult ¶
type RecommView ¶
type ReviewResponse ¶
type ReviewResponse struct { ResearchArea int `json:"researchArea"` Classes int `json:"classes"` Skills int `json:"skills"` Grade int `json:"grade"` Language int `json:"language"` ResearchPlan int `json:"researchPlan"` Recomm int `json:"recomm"` Other int `json:"other"` Overall int `json:"overall"` }
type ReviewScore ¶
type ReviewScore uint
type ReviewerProfile ¶
type SimpleResult ¶
type UserPermission ¶
type UserPermission uint64
func GetSessionUserPermission ¶
func GetSessionUserPermission(req *http.Request) (UserPermission, error)
func (UserPermission) ContainsPermission ¶
func (this UserPermission) ContainsPermission(perm_bit uint64) bool
Click to show internal directories.
Click to hide internal directories.