func PublishApp(c *echo.Context) error { body, err := ioutil.ReadAll(c.Request().Body) if err != nil { log.Error(err) return reterr(err, "", c) } var all struct { Data struct { Attributes struct { Alias string `json:"alias"` CollectionName string `json:"collection-name"` DisplayName string `json:"display-name"` FilePath string `json:"file-path"` Path string `json:"path"` } Type string `json:"type"` } `json:"data"` } err = json.Unmarshal(body, &all) if err != nil { log.Error(err) return reterr(err, "", c) } username, pwd, _ := c.Request().BasicAuth() utils.ExecuteCommandAsAdmin("C:\\Windows\\System32\\WindowsPowershell\\v1.0\\powershell.exe Import-module RemoteDesktop; New-RDRemoteApp -CollectionName "+all.Data.Attributes.CollectionName+" -DisplayName "+all.Data.Attributes.DisplayName+" -FilePath '"+all.Data.Attributes.Path+"'", username, pwd, domain) return checkIfPublishSucceeded(c, all.Data.Attributes.DisplayName) }
func UnpublishApp(c *echo.Context) error { id := c.Param("id") username, pwd, _ := c.Request().BasicAuth() utils.ExecuteCommandAsAdmin("C:\\Windows\\System32\\WindowsPowershell\\v1.0\\powershell.exe Import-Module RemoteDesktop; Remove-RDRemoteApp -Alias '"+id+"' -CollectionName collection -Force", username, pwd, domain) return checkIfUnpublishSucceeded(c, id) }