Documentation ¶
Index ¶
- Constants
- func AccessLog(username, projectName, repoName, action string) error
- func AddAccessLog(accessLog models.AccessLog) error
- func AddProject(project models.Project) error
- func AddProjectRole(projectRole models.ProjectRole) (int64, error)
- func AddUserProjectRole(userID int, projectID int64, roleID int) error
- func ChangeUserPassword(u models.User, oldPassword ...string) error
- func CheckUserPassword(query models.User) (*models.User, error)
- func DeleteUser(userID int) error
- func DeleteUserProjectRoles(userID int, projectID int64) error
- func GenerateRandomString() (string, error)
- func GetAccessLogs(accessLog models.AccessLog) ([]models.AccessLog, error)
- func GetPermission(username, projectName string) (string, error)
- func GetProjectByID(projectID int64) (*models.Project, error)
- func GetProjectByName(projectName string) (*models.Project, error)
- func GetUser(query models.User) (*models.User, error)
- func GetUserByProject(projectID int64, queryUser models.User) ([]models.User, error)
- func GetUserProjectRoles(userQuery models.User, projectID int64) ([]models.Role, error)
- func InitDB()
- func IsAdminRole(userID int) (bool, error)
- func IsProjectPublic(projectName string) bool
- func ListUsers(query models.User) ([]models.User, error)
- func LoginByDb(auth models.AuthModel) (*models.User, error)
- func ProjectExists(nameOrID interface{}) (bool, error)
- func QueryProject(query models.Project) ([]models.Project, error)
- func QueryRelevantProjects(userID int) ([]models.Project, error)
- func Register(user models.User) (int64, error)
- func ResetUserPassword(u models.User) error
- func ToggleProjectPublicity(projectID int64, publicity int) error
- func ToggleUserAdminRole(u models.User) error
- func UpdateUserResetUUID(u models.User) error
- func UserExists(user models.User, target string) (bool, error)
Constants ¶
const NonExistUserID = 0
NonExistUserID : if a user does not exist, the ID of the user will be 0.
Variables ¶
This section is empty.
Functions ¶
func AddAccessLog ¶
AddAccessLog persists the access logs
func AddProject ¶
AddProject adds a project to the database along with project roles information and access log records.
func AddProjectRole ¶
func AddProjectRole(projectRole models.ProjectRole) (int64, error)
AddProjectRole ...
func AddUserProjectRole ¶
AddUserProjectRole inserts role information to table project_role and user_project_role.
func ChangeUserPassword ¶
ChangeUserPassword ...
func CheckUserPassword ¶
CheckUserPassword checks whether the password is correct.
func DeleteUserProjectRoles ¶
DeleteUserProjectRoles ...
func GenerateRandomString ¶
GenerateRandomString generates a random string
func GetAccessLogs ¶
GetAccessLogs gets access logs according to different conditions
func GetPermission ¶
GetPermission gets roles that the user has according to the project.
func GetProjectByID ¶
GetProjectByID ...
func GetProjectByName ¶
GetProjectByName ...
func GetUserByProject ¶
GetUserByProject gets all members of the project.
func GetUserProjectRoles ¶
GetUserProjectRoles returns roles that the user has according to the project.
func IsAdminRole ¶
IsAdminRole returns whether the user is admin.
func ProjectExists ¶
ProjectExists returns whether the project exists according to its name of ID.
func QueryProject ¶
QueryProject querys the projects based on publicity and user, disregarding the names etc.
func QueryRelevantProjects ¶
QueryRelevantProjects returns all projects that the user is a member of.
func Register ¶
Register is used for user to register, the password is encrypted before the record is inserted into database.
func ToggleProjectPublicity ¶
ToggleProjectPublicity toggles the publicity of the project.
func ToggleUserAdminRole ¶
ToggleUserAdminRole gives a user admim role.
Types ¶
This section is empty.