Documentation ¶
Index ¶
- func DecodeCommentRequest(w http.ResponseWriter, r *http.Request, c models.Comment) (models.Comment, int)
- func DecodeCommentsRequest(w http.ResponseWriter, r *http.Request, c []models.Comment) ([]models.Comment, int)
- func DecodeIPFSNodeRequest(w http.ResponseWriter, r *http.Request, ipfs models.IPFSNode) (models.IPFSNode, int)
- func DecodeMediaEventMapRequest(w http.ResponseWriter, r *http.Request) (models.MediaEventMap, int)
- func DecodeMediaGroupMapRequest(w http.ResponseWriter, r *http.Request) (models.MediaGroupMap, int)
- func DecodeMediaRequest(w http.ResponseWriter, r *http.Request, m models.Media) (models.Media, int)
- func DecodeMediasRequest(w http.ResponseWriter, r *http.Request) ([]models.Media, int)
- func DecodeStringsRequest(w http.ResponseWriter, r *http.Request, u []string) ([]string, int)
- func DecodeTagEventMapRequest(w http.ResponseWriter, r *http.Request) (models.TagEventMap, int)
- func DecodeTagMediaMapRequest(w http.ResponseWriter, r *http.Request) (models.TagMediaMap, int)
- func DecodeTagRequest(w http.ResponseWriter, r *http.Request, t models.Tag) (models.Tag, int)
- func DecodeTagStringRequest(w http.ResponseWriter, r *http.Request, t string) (string, int)
- func DecodeTagsRequest(w http.ResponseWriter, r *http.Request, t []models.Tag) ([]models.Tag, int)
- func DecodeUserGroupRequest(w http.ResponseWriter, r *http.Request, ug models.UserGroup) (models.UserGroup, int)
- func DecodeUserGroupsRequest(w http.ResponseWriter, r *http.Request, ugs []models.UserGroup) ([]models.UserGroup, int)
- func HashPassword(password string) (hashedPassword string)
- func Logger(inner http.Handler, name string) http.Handler
- func MatchesBcrypt(password string, hash string) error
- func ParseIDs(ids []string) ([]primitive.ObjectID, error)
- func RemoveString(s []string, r string) []string
- func UnParseIDs(ids []primitive.ObjectID) []string
- type AppGateway
- func (g *AppGateway) AddCommentByMediaID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddDescriptionByMediaID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddEvent(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddMedia(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddNode(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddTag(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddTagByMediaID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddTagsByMediaID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddTimestampByMediaID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddTitleByMediaID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddUserGroup(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddUserToUserGroupByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) AddUsersToUserGroupByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) Authenticate(h http.Handler, logout bool) http.Handler
- func (g *AppGateway) Connect()
- func (g *AppGateway) DeleteEventByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) DeleteMediaByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) DeleteNodeByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) DeleteTagByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) DeleteUserGroupByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GenerateInvite(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetEventByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetEvents(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetEventsByName(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetMedia(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetMediaByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetMediaByIDs(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetNodeByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetNodes(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetSession(token string) *iModels.Session
- func (g *AppGateway) GetSessionByUser(user string) *iModels.Session
- func (g *AppGateway) GetSessionByUsername(user string) *iModels.Session
- func (g *AppGateway) GetTagByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetTags(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetTagsByName(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetUserGroupAPI(w http.ResponseWriter, db *mongo.Database, ug *models.UserGroup) int
- func (g *AppGateway) GetUserGroupByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetUserGroups(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetUserGroupsByName(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) GetUserPermission(username string, ownerOnly bool) bson.M
- func (g *AppGateway) GetUserPermissionW(w http.ResponseWriter, ownerOnly bool) bson.M
- func (g *AppGateway) Initialize(config infrastructure.APIGatewayConfig)
- func (g *AppGateway) MapEventsToMedia(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) MapGroupsToMedia(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) MapTagsToEvents(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) MapTagsToMedia(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) NewSession(user string, db *mongo.Database, token string) *iModels.Session
- func (g *AppGateway) ReadSessionCookie(w *http.ResponseWriter, r *http.Request) string
- func (g *AppGateway) RemoveSessionByToken(token string)
- func (g *AppGateway) RemoveUserFromUserGroupByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) RemoveUsersFromUserGroupByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) Run(addr string)
- func (g *AppGateway) UpdateEventByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) UpdateMediaByHash(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) UpdateMediaByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) UpdateNodeByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) UpdateTagByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) UpdateUserGroupByID(w http.ResponseWriter, r *http.Request)
- func (g *AppGateway) UploadMedia(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeCommentRequest ¶
func DecodeCommentRequest(w http.ResponseWriter, r *http.Request, c models.Comment) (models.Comment, int)
DecodeCommentRequest decodes the api request into the passed object responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeCommentsRequest ¶
func DecodeCommentsRequest(w http.ResponseWriter, r *http.Request, c []models.Comment) ([]models.Comment, int)
DecodeCommentsRequest decodes the api request into the passed slice responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeIPFSNodeRequest ¶
func DecodeIPFSNodeRequest(w http.ResponseWriter, r *http.Request, ipfs models.IPFSNode) (models.IPFSNode, int)
DecodeIPFSNodeRequest decodes the api request into the passed object responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeMediaEventMapRequest ¶
func DecodeMediaEventMapRequest(w http.ResponseWriter, r *http.Request) (models.MediaEventMap, int)
DecodeMediaEventMapRequest decodes the api request into the passed slice responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeMediaGroupMapRequest ¶
func DecodeMediaGroupMapRequest(w http.ResponseWriter, r *http.Request) (models.MediaGroupMap, int)
DecodeMediaGroupMapRequest decodes the api request into the passed slice responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeMediaRequest ¶
DecodeMediaRequest decodes the api request into the passed object responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeMediasRequest ¶
DecodeMediasRequest decodes the api request into the passed slice responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeStringsRequest ¶
DecodeStringsRequest decodes the api request into the passed user slice responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeTagEventMapRequest ¶
func DecodeTagEventMapRequest(w http.ResponseWriter, r *http.Request) (models.TagEventMap, int)
DecodeTagEventMapRequest decodes the api request into the passed slice responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeTagMediaMapRequest ¶
func DecodeTagMediaMapRequest(w http.ResponseWriter, r *http.Request) (models.TagMediaMap, int)
DecodeTagMediaMapRequest decodes the api request into the passed slice responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeTagRequest ¶
DecodeTagRequest decodes the api request into the passed object responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeTagStringRequest ¶
DecodeTagStringRequest decodes the api request into the passed object responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeTagsRequest ¶
DecodeTagsRequest decodes the api request into the passed slice responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeUserGroupRequest ¶
func DecodeUserGroupRequest(w http.ResponseWriter, r *http.Request, ug models.UserGroup) (models.UserGroup, int)
DecodeUserGroupRequest decodes the api request into the passed object responds with decode error if occurs status 0 => ok || status 1 => error
func DecodeUserGroupsRequest ¶
func DecodeUserGroupsRequest(w http.ResponseWriter, r *http.Request, ugs []models.UserGroup) ([]models.UserGroup, int)
DecodeUserGroupsRequest decodes the api request into the passed slice responds with decode error if occurs status 0 => ok || status 1 => error
func HashPassword ¶
HashPassword hashes the passed passwort using bcrypt
func MatchesBcrypt ¶
MatchesBcrypt verifies, that a given string is equal to a encrypted string
func RemoveString ¶
RemoveString removes a given string from a given slice
func UnParseIDs ¶
UnParseIDs parses a slice of hex ids into primitive.ObjectIDs
Types ¶
type AppGateway ¶
type AppGateway struct { Router *mux.Router DB *mongo.Database Config *infrastructure.APIGatewayConfig Ctx context.Context Nodes map[primitive.ObjectID]*models.Node // stores all authenticated nodes Sessions []*iModels.Session HTTPClient *http.Client KeycloakClient gocloak.GoCloak KeycloakToken *gocloak.JWT KeycloakTokenCache map[string]*gocloak.RetrospecTokenResult }
AppGateway struct to maintain database connection and router
func (*AppGateway) AddCommentByMediaID ¶
func (g *AppGateway) AddCommentByMediaID(w http.ResponseWriter, r *http.Request)
AddCommentByMediaID appends a comment to the specified media
func (*AppGateway) AddDescriptionByMediaID ¶
func (g *AppGateway) AddDescriptionByMediaID(w http.ResponseWriter, r *http.Request)
AddDescriptionByMediaID adds the description to the media
func (*AppGateway) AddEvent ¶
func (g *AppGateway) AddEvent(w http.ResponseWriter, r *http.Request)
AddEvent handles the webrequest for Event creation
func (*AppGateway) AddMedia ¶
func (g *AppGateway) AddMedia(w http.ResponseWriter, r *http.Request)
AddMedia handles the webrequest for Media creation
func (*AppGateway) AddNode ¶
func (g *AppGateway) AddNode(w http.ResponseWriter, r *http.Request)
AddNode handles the webrequest for Node creation
func (*AppGateway) AddTag ¶
func (g *AppGateway) AddTag(w http.ResponseWriter, r *http.Request)
AddTag handles the webrequest for Tag creation
func (*AppGateway) AddTagByMediaID ¶
func (g *AppGateway) AddTagByMediaID(w http.ResponseWriter, r *http.Request)
AddTagByMediaID appends a tag to the specified media creates a new tag if not in the tag document
func (*AppGateway) AddTagsByMediaID ¶
func (g *AppGateway) AddTagsByMediaID(w http.ResponseWriter, r *http.Request)
AddTagsByMediaID appends multiple tags to the specified media creates a new tag if not in the tag document
func (*AppGateway) AddTimestampByMediaID ¶
func (g *AppGateway) AddTimestampByMediaID(w http.ResponseWriter, r *http.Request)
AddTimestampByMediaID adds the creation date to the media
func (*AppGateway) AddTitleByMediaID ¶
func (g *AppGateway) AddTitleByMediaID(w http.ResponseWriter, r *http.Request)
AddTitleByMediaID adds the title to the media
func (*AppGateway) AddUserGroup ¶
func (g *AppGateway) AddUserGroup(w http.ResponseWriter, r *http.Request)
AddUserGroup handles the webrequest for usergroup creation
func (*AppGateway) AddUserToUserGroupByID ¶
func (g *AppGateway) AddUserToUserGroupByID(w http.ResponseWriter, r *http.Request)
AddUserToUserGroupByID adds a User to the specified usergroup
func (*AppGateway) AddUsersToUserGroupByID ¶
func (g *AppGateway) AddUsersToUserGroupByID(w http.ResponseWriter, r *http.Request)
AddUsersToUserGroupByID adds a User to the specified usergroup
func (*AppGateway) Authenticate ¶
Authenticate is a middleware to pre-authenticate routes via the session token if logout is true, no new session token is beeing generated
func (*AppGateway) Connect ¶
func (g *AppGateway) Connect()
Connect initializes a mongodb connection
func (*AppGateway) DeleteEventByID ¶
func (g *AppGateway) DeleteEventByID(w http.ResponseWriter, r *http.Request)
DeleteEventByID handles the webrequest for Event deletion
func (*AppGateway) DeleteMediaByID ¶
func (g *AppGateway) DeleteMediaByID(w http.ResponseWriter, r *http.Request)
DeleteMediaByID handles the webrequest for Media deletion
func (*AppGateway) DeleteNodeByID ¶
func (g *AppGateway) DeleteNodeByID(w http.ResponseWriter, r *http.Request)
DeleteNodeByID handles the webrequest for Node deletion
func (*AppGateway) DeleteTagByID ¶
func (g *AppGateway) DeleteTagByID(w http.ResponseWriter, r *http.Request)
DeleteTagByID handles the webrequest for Tag deletion
func (*AppGateway) DeleteUserGroupByID ¶
func (g *AppGateway) DeleteUserGroupByID(w http.ResponseWriter, r *http.Request)
DeleteUserGroupByID handles the webrequest for usergroup deletion
func (*AppGateway) GenerateInvite ¶
func (g *AppGateway) GenerateInvite(w http.ResponseWriter, r *http.Request)
GenerateInvite handles the webrequest for creating a new invite
func (*AppGateway) GetEventByID ¶
func (g *AppGateway) GetEventByID(w http.ResponseWriter, r *http.Request)
GetEventByID handles the webrequest for receiving Event model by id
func (*AppGateway) GetEvents ¶
func (g *AppGateway) GetEvents(w http.ResponseWriter, r *http.Request)
GetEvents handles the webrequest for receiving all events
func (*AppGateway) GetEventsByName ¶
func (g *AppGateway) GetEventsByName(w http.ResponseWriter, r *http.Request)
GetEventsByName returns available Events by their name, starting with
func (*AppGateway) GetMedia ¶
func (g *AppGateway) GetMedia(w http.ResponseWriter, r *http.Request)
GetMedia handles the webrequest for receiving all media
func (*AppGateway) GetMediaByID ¶
func (g *AppGateway) GetMediaByID(w http.ResponseWriter, r *http.Request)
GetMediaByID handles the webrequest for receiving Media model by id
func (*AppGateway) GetMediaByIDs ¶
func (g *AppGateway) GetMediaByIDs(w http.ResponseWriter, r *http.Request)
GetMediaByIDs handles the webrequest for receiving Media models by ids
func (*AppGateway) GetNodeByID ¶
func (g *AppGateway) GetNodeByID(w http.ResponseWriter, r *http.Request)
GetNodeByID handles the webrequest for receiving Node model by id
func (*AppGateway) GetNodes ¶
func (g *AppGateway) GetNodes(w http.ResponseWriter, r *http.Request)
GetNodes handles the webrequest for receiving all nodes
func (*AppGateway) GetSession ¶
func (g *AppGateway) GetSession(token string) *iModels.Session
GetSession returns the session object for the passed token
func (*AppGateway) GetSessionByUser ¶
func (g *AppGateway) GetSessionByUser(user string) *iModels.Session
GetSessionByUser Returns the session for the passed user if exist
func (*AppGateway) GetSessionByUsername ¶
func (g *AppGateway) GetSessionByUsername(user string) *iModels.Session
GetSessionByUsername returns the session for the passed username if exist
func (*AppGateway) GetTagByID ¶
func (g *AppGateway) GetTagByID(w http.ResponseWriter, r *http.Request)
GetTagByID handles the webrequest for receiving Tag model by id
func (*AppGateway) GetTags ¶
func (g *AppGateway) GetTags(w http.ResponseWriter, r *http.Request)
GetTags returns all Tags available
func (*AppGateway) GetTagsByName ¶
func (g *AppGateway) GetTagsByName(w http.ResponseWriter, r *http.Request)
GetTagsByName returns available Tags by their name, starting with
func (*AppGateway) GetUserGroupAPI ¶
func (g *AppGateway) GetUserGroupAPI(w http.ResponseWriter, db *mongo.Database, ug *models.UserGroup) int
GetUserGroupAPI handles possible errors during the select and writes Responses
func (*AppGateway) GetUserGroupByID ¶
func (g *AppGateway) GetUserGroupByID(w http.ResponseWriter, r *http.Request)
GetUserGroupByID handles the webrequest for receiving usergroup model by id
func (*AppGateway) GetUserGroups ¶
func (g *AppGateway) GetUserGroups(w http.ResponseWriter, r *http.Request)
GetUserGroups returns all groups, the current user is assigned to
func (*AppGateway) GetUserGroupsByName ¶
func (g *AppGateway) GetUserGroupsByName(w http.ResponseWriter, r *http.Request)
GetUserGroupsByName returns available Tags by their name, starting with
func (*AppGateway) GetUserPermission ¶
func (g *AppGateway) GetUserPermission(username string, ownerOnly bool) bson.M
GetUserPermission parses the permissionfilter and returns it
func (*AppGateway) GetUserPermissionW ¶
func (g *AppGateway) GetUserPermissionW(w http.ResponseWriter, ownerOnly bool) bson.M
GetUserPermissionW parses the permissionfilter and returns it it reads the username from passed response writer
func (*AppGateway) Initialize ¶
func (g *AppGateway) Initialize(config infrastructure.APIGatewayConfig)
Initialize initializes application related content - mongodb connection initialization - router initialization
func (*AppGateway) MapEventsToMedia ¶
func (g *AppGateway) MapEventsToMedia(w http.ResponseWriter, r *http.Request)
MapEventsToMedia maps an media slice to each event entry
func (*AppGateway) MapGroupsToMedia ¶
func (g *AppGateway) MapGroupsToMedia(w http.ResponseWriter, r *http.Request)
MapGroupsToMedia maps an media slice to each event entry
func (*AppGateway) MapTagsToEvents ¶
func (g *AppGateway) MapTagsToEvents(w http.ResponseWriter, r *http.Request)
MapTagsToEvents maps a slice of Tags to a slice of events
func (*AppGateway) MapTagsToMedia ¶
func (g *AppGateway) MapTagsToMedia(w http.ResponseWriter, r *http.Request)
MapTagsToMedia adds a list of tags to a list of media
func (*AppGateway) NewSession ¶
NewSession initializes a new Session (if not exists) for the passed user otherwise it updates the token
func (*AppGateway) ReadSessionCookie ¶
func (g *AppGateway) ReadSessionCookie(w *http.ResponseWriter, r *http.Request) string
ReadSessionCookie reads the stoken cookie from the request and returns the value
func (*AppGateway) RemoveSessionByToken ¶
func (g *AppGateway) RemoveSessionByToken(token string)
RemoveSessionByToken finds the session with the given token and removes it from the cached session slice
func (*AppGateway) RemoveUserFromUserGroupByID ¶
func (g *AppGateway) RemoveUserFromUserGroupByID(w http.ResponseWriter, r *http.Request)
RemoveUserFromUserGroupByID adds a User to the specified usergroup
func (*AppGateway) RemoveUsersFromUserGroupByID ¶
func (g *AppGateway) RemoveUsersFromUserGroupByID(w http.ResponseWriter, r *http.Request)
RemoveUsersFromUserGroupByID adds a User to the specified usergroup
func (*AppGateway) Run ¶
func (g *AppGateway) Run(addr string)
Run starts the application on the passed address with the inherited router WARN: router must be initialized first
func (*AppGateway) UpdateEventByID ¶
func (g *AppGateway) UpdateEventByID(w http.ResponseWriter, r *http.Request)
UpdateEventByID handles the webrequest for updating the Event with the passed request body
func (*AppGateway) UpdateMediaByHash ¶
func (g *AppGateway) UpdateMediaByHash(w http.ResponseWriter, r *http.Request)
UpdateMediaByHash handles the webrequest for updating the Media with the passed request body
func (*AppGateway) UpdateMediaByID ¶
func (g *AppGateway) UpdateMediaByID(w http.ResponseWriter, r *http.Request)
UpdateMediaByID handles the webrequest for updating the Media with the passed request body
func (*AppGateway) UpdateNodeByID ¶
func (g *AppGateway) UpdateNodeByID(w http.ResponseWriter, r *http.Request)
UpdateNodeByID handles the webrequest for updating the Node with the passed request body
func (*AppGateway) UpdateTagByID ¶
func (g *AppGateway) UpdateTagByID(w http.ResponseWriter, r *http.Request)
UpdateTagByID handles the webrequest for updating the Tag with the passed request body
func (*AppGateway) UpdateUserGroupByID ¶
func (g *AppGateway) UpdateUserGroupByID(w http.ResponseWriter, r *http.Request)
UpdateUserGroupByID handles the webrequest for updating the usergroup with the passed request body
func (*AppGateway) UploadMedia ¶
func (g *AppGateway) UploadMedia(w http.ResponseWriter, r *http.Request)
UploadMedia handles the webrequest for uploading a file to the api