database

package
v0.0.0-...-f7e652a Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2015 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

This package handles all the interactions with the local database This file implements initialization and table-independant functions

Index

Constants

View Source
const (
	TableUsers               = "users"
	TableInvitations         = "invitations"
	TableGroups              = "groups"
	TableVideoGroups         = "video_groups"
	TableVideos              = "videos"
	TableMembership          = "membership"
	TableVideoClassification = "video_classification"
	TableVideoPermissions    = "video_permissions"
	TableConfiguration       = "configuration"
)

Variables

View Source
var DeleteGroupFromId = deleteGroupFromId
View Source
var DeleteInvitationFromId = deleteInvitationFromId
View Source
var DeleteUserFromId = deleteUserFromId
View Source
var DeleteVideoFromId = deleteVideoFromId
View Source
var DeleteVideoGroupFromId = deleteVideoGroupFromId
View Source
var GetAllGroups = getAllGroups
View Source
var GetAllInvitations = getAllInvitations
View Source
var GetAllUsers = getAllUsers
View Source
var GetAllVideoGroups = getAllVideoGroups
View Source
var GetAllVideos = getAllVideos
View Source
var GetInvitationFromId = getInvitationFromId
View Source
var GetInvitationFromValue = getInvitationFromValue
View Source
var GetPermissionsFromGroupId = getPermissionsFromGroupId
View Source
var GetPermissionsFromVideoGroupId = getPermissionsFromVideoGroupId
View Source
var InsertInvitation = insertInvitation
View Source
var UpdateInvitation = updateInvitation

Functions

func AuthenticateUser

func AuthenticateUser(id int64, password string) error

Check if the password is correct

func CheckPermission

func CheckPermission(userId int64, videoId int64) (bool, error)

Check if the given user is allowed to access the given video

func GetAllowedVideos

func GetAllowedVideos(userId int64) ([]map[string]interface{}, error)

Get all videos allowed to the given user

func GetGroupFromId

func GetGroupFromId(id int64) (globals.Group, []globals.User, []globals.VideoGroup, error)

func GetUserFromId

func GetUserFromId(id int64) (globals.User, []globals.Group, error)

func GetUserFromLogin

func GetUserFromLogin(login string) (globals.User, []globals.Group, error)

func GetVideoFromId

func GetVideoFromId(id int64) (globals.Video, []globals.VideoGroup, error)

func GetVideoFromSlug

func GetVideoFromSlug(slug string) (globals.Video, []globals.VideoGroup, error)

func GetVideoGroupFromId

func GetVideoGroupFromId(id int64) (globals.VideoGroup, []globals.Video, []globals.Group, error)

func InitDatabase

func InitDatabase()

Initialize the database structure if needed

func InsertGroup

func InsertGroup(group globals.Group, users []globals.User, videoGroups []globals.VideoGroup) (globals.Group, []globals.User, []globals.VideoGroup, error)

func InsertUser

func InsertUser(user globals.User, groups []globals.Group) (globals.User, []globals.Group, error)

func InsertVideo

func InsertVideo(video globals.Video, videoGroups []globals.VideoGroup) (globals.Video, []globals.VideoGroup, error)

func InsertVideoGroup

func InsertVideoGroup(videoGroup globals.VideoGroup, videos []globals.Video, groups []globals.Group) (globals.VideoGroup, []globals.Video, []globals.Group, error)

func IsAdmin

func IsAdmin(userId int64) (bool, error)

Check if the given user as admin rights

func LoadConfiguration

func LoadConfiguration() error

func UpdateConfiguration

func UpdateConfiguration(configuration globals.Configuration) error

func UpdateGroup

func UpdateGroup(group globals.Group, users []globals.User, videoGroups []globals.VideoGroup) (globals.Group, []globals.User, []globals.VideoGroup, error)

Public functions

func UpdatePermissionsFromGroup

func UpdatePermissionsFromGroup(group globals.Group, videoGroups []globals.VideoGroup) ([]globals.VideoGroup, error)

Public functions

func UpdatePermissionsFromVideoGroup

func UpdatePermissionsFromVideoGroup(videoGroup globals.VideoGroup, groups []globals.Group) ([]globals.Group, error)

func UpdateUser

func UpdateUser(user globals.User, groups []globals.Group) (globals.User, []globals.Group, error)

func UpdateVideo

func UpdateVideo(video globals.Video, videoGroups []globals.VideoGroup) (globals.Video, []globals.VideoGroup, error)

func UpdateVideoGroup

func UpdateVideoGroup(videoGroup globals.VideoGroup, videos []globals.Video, groups []globals.Group) (globals.VideoGroup, []globals.Video, []globals.Group, error)

Public functions

Types

This section is empty.

Jump to

Keyboard shortcuts

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