Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

171 ip disclosure request form #175

Merged
merged 4 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .bicep/webapp/parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
"COMMUNITY_PORTAL_APP_ID": "",
"CALLBACK_RETRY_FREQ": "",
"SESSION_KEY": "",
"SCOPE":""
"SCOPE":"",
"IPDR_MODULE_ID": "",
"IPDR_APP_ID": "",
"CTO": ""
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/setup-appservice-resource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
parameters.appServiceSettings.value.CALLBACK_RETRY_FREQ: ${{ vars.CALLBACK_RETRY_FREQ }}
parameters.appServiceSettings.value.SESSION_KEY: ${{ secrets.SESSION_KEY }}
parameters.appServiceSettings.value.SCOPE: ${{ secrets.SCOPE}}
parameters.appServiceSettings.value.IPDR_MODULE_ID: ${{ vars.IPDR_MODULE_ID }}
parameters.appServiceSettings.value.IPDR_APP_ID: ${{ vars.IPDR_APP_ID }}
parameters.appServiceSettings.value.CTO: ${{ vars.CTO }}

- name: Deploy App Service Plan and Web App
uses: azure/arm-deploy@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/setup-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
jobs:
setup-server-and-database-resource:
if: ${{ github.event.inputs.deploy_database_resource == 'true' }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
environment: ${{ github.event.inputs.selected_environment }}

steps:
Expand All @@ -48,7 +48,7 @@ jobs:

build-and-publish-database-project:
if: ${{ github.event.inputs.publish_database_project == 'true' }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
environment: ${{ github.event.inputs.selected_environment }}

steps:
Expand Down
5 changes: 4 additions & 1 deletion src/goapp/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ LINK_FOOTERS=""
ORGANIZATION_NAME=""
COMMUNITY_PORTAL_APP_ID=""
SESSION_KEY=""
SCOPE=""
SCOPE=""
IPDR_APP_ID=""
IPDR_MODULE_ID=""
CTO=""
19 changes: 11 additions & 8 deletions src/goapp/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@ type Config struct {
}

type ConfigManager interface {
GetCallbackRetryFreq() string
GetClientID() string
GetClientSecret() string
GetCTO() string
GetCommunityPortalAppId() string
GetDatabaseConnectionString() string
GetEnterpriseOwners() []string
GetEmailTenantID() string
GetEmailClientID() string
GetEmailClientSecret() string
GetEmailTenantID() string
GetEmailUserID() string
GetEnterpriseOwners() []string
GetHomeURL() string
GetIPDRAppId() string
GetIPDRModuleId() string
GetIsEmailEnabled() bool
GetTenantID() string
GetClientID() string
GetClientSecret() string
GetLinkFooters() string
GetOrganizationName() string
GetCommunityPortalAppId() string
GetCallbackRetryFreq() string
GetPort() string
GetSessionKey() string
GetScope() string
GetSessionKey() string
GetTenantID() string
}
74 changes: 43 additions & 31 deletions src/goapp/config/env-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,24 @@ func NewEnvConfigManager() *envConfigManager {
return &envConfigManager{}
}

func (ecm *envConfigManager) GetDatabaseConnectionString() string {
return os.Getenv("APPROVALSYSTEMDB_CONNECTION_STRING")
func (ecm *envConfigManager) GetCallbackRetryFreq() string {
return os.Getenv("CALLBACK_RETRY_FREQ")
}

func (ecm *envConfigManager) GetEnterpriseOwners() []string {
enterpriseOwners := os.Getenv("ENTERPRISE_OWNERS")
if enterpriseOwners == "" {
return nil
}
ownersArray := strings.Split(enterpriseOwners, ",")
return ownersArray
func (ecm *envConfigManager) GetClientID() string {
return os.Getenv("CLIENT_ID")
}

func (ecm *envConfigManager) GetEmailTenantID() string {
return os.Getenv("EMAIL_TENANT_ID")
func (ecm *envConfigManager) GetClientSecret() string {
return os.Getenv("CLIENT_SECRET")
}

func (ecm *envConfigManager) GetCommunityPortalAppId() string {
return os.Getenv("COMMUNITY_PORTAL_APP_ID")
}

func (ecm *envConfigManager) GetDatabaseConnectionString() string {
return os.Getenv("APPROVALSYSTEMDB_CONNECTION_STRING")
}

func (ecm *envConfigManager) GetEmailClientID() string {
Expand All @@ -47,28 +50,41 @@ func (ecm *envConfigManager) GetEmailClientSecret() string {
return os.Getenv("EMAIL_CLIENT_SECRET")
}

func (ecm *envConfigManager) GetCTO() string {
return os.Getenv("CTO")
}

func (ecm *envConfigManager) GetEmailTenantID() string {
return os.Getenv("EMAIL_TENANT_ID")
}

func (ecm *envConfigManager) GetEmailUserID() string {
return os.Getenv("EMAIL_USER_ID")
}

func (ecm *envConfigManager) GetHomeURL() string {
return os.Getenv("HOME_URL")
func (ecm *envConfigManager) GetEnterpriseOwners() []string {
enterpriseOwners := os.Getenv("ENTERPRISE_OWNERS")
if enterpriseOwners == "" {
return nil
}
ownersArray := strings.Split(enterpriseOwners, ",")
return ownersArray
}

func (ecm *envConfigManager) GetIsEmailEnabled() bool {
return os.Getenv("EMAIL_ENABLED") == "true"
func (ecm *envConfigManager) GetHomeURL() string {
return os.Getenv("HOME_URL")
}

func (ecm *envConfigManager) GetTenantID() string {
return os.Getenv("TENANT_ID")
func (ecm *envConfigManager) GetIPDRAppId() string {
return os.Getenv("IPDR_APP_ID")
}

func (ecm *envConfigManager) GetClientID() string {
return os.Getenv("CLIENT_ID")
func (ecm *envConfigManager) GetIPDRModuleId() string {
return os.Getenv("IPDR_MODULE_ID")
}

func (ecm *envConfigManager) GetClientSecret() string {
return os.Getenv("CLIENT_SECRET")
func (ecm *envConfigManager) GetIsEmailEnabled() bool {
return os.Getenv("EMAIL_ENABLED") == "true"
}

func (ecm *envConfigManager) GetLinkFooters() string {
Expand All @@ -79,22 +95,18 @@ func (ecm *envConfigManager) GetOrganizationName() string {
return os.Getenv("ORGANIZATION_NAME")
}

func (ecm *envConfigManager) GetCommunityPortalAppId() string {
return os.Getenv("COMMUNITY_PORTAL_APP_ID")
}

func (ecm *envConfigManager) GetCallbackRetryFreq() string {
return os.Getenv("CALLBACK_RETRY_FREQ")
}

func (ecm *envConfigManager) GetPort() string {
return os.Getenv("PORT")
}

func (ecm *envConfigManager) GetScope() string {
return os.Getenv("SCOPE")
}

func (ecm *envConfigManager) GetSessionKey() string {
return os.Getenv("SESSION_KEY")
}

func (ecm *envConfigManager) GetScope() string {
return os.Getenv("SCOPE")
func (ecm *envConfigManager) GetTenantID() string {
return os.Getenv("TENANT_ID")
}
35 changes: 29 additions & 6 deletions src/goapp/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@ import (
cApplicationModule "main/controller/app-module"
cAuthentication "main/controller/authentication"
cFallback "main/controller/fallback"
cInvolvement "main/controller/involvement"
cIPDiscloure "main/controller/ip-disclosure"
cItem "main/controller/item"
cUser "main/controller/user"
"main/service"
)

type Controller struct {
ApplicationModule cApplicationModule.ApplicationModuleController
AuthenticationPage cAuthentication.AuthenticationPageController
Fallback cFallback.FallbackController
Involvement cInvolvement.InvolvementController
IPDisclosure cIPDiscloure.IpDisclosureController
IPDisclourePage cIPDiscloure.IpDisclosurePageController
Item cItem.ItemController
ItemPage cItem.ItemPageController
ApplicationModule cApplicationModule.ApplicationModuleController
User cUser.UserController
Fallback cFallback.FallbackController
}

type ControllerOptionFunc func(*Controller)
Expand All @@ -31,21 +36,33 @@ func NewController(opts ...ControllerOptionFunc) *Controller {
return controller
}

func NewApplicationModuleController(svc *service.Service) ControllerOptionFunc {
return func(c *Controller) {
c.ApplicationModule = cApplicationModule.NewApplicationModuleController(svc)
}
}

func NewAuthenticationController(svc *service.Service) ControllerOptionFunc {
return func(c *Controller) {
c.AuthenticationPage = cAuthentication.NewAuthenticationController(svc)
}
}

func NewItemController(svc *service.Service) ControllerOptionFunc {
func NewInvolvementController(svc *service.Service) ControllerOptionFunc {
return func(c *Controller) {
c.Item = cItem.NewItemController(svc)
c.Involvement = cInvolvement.NewInvolvementController(svc)
}
}

func NewApplicationModuleController(svc *service.Service) ControllerOptionFunc {
func NewIPDisclosureController(svc *service.Service, conf config.ConfigManager) ControllerOptionFunc {
return func(c *Controller) {
c.ApplicationModule = cApplicationModule.NewApplicationModuleController(svc)
c.IPDisclosure = cIPDiscloure.NewIpDisclosureController(svc, conf)
}
}

func NewItemController(svc *service.Service) ControllerOptionFunc {
return func(c *Controller) {
c.Item = cItem.NewItemController(svc)
}
}

Expand All @@ -57,6 +74,12 @@ func NewUserController(svc *service.Service) ControllerOptionFunc {

// PAGES

func NewIPDisclosurePageController(svc *service.Service) ControllerOptionFunc {
return func(c *Controller) {
c.IPDisclourePage = cIPDiscloure.NewIpDisclosurePageController(svc)
}
}

func NewItemPageController(svc *service.Service, conf config.ConfigManager) ControllerOptionFunc {
return func(c *Controller) {
c.ItemPage = cItem.NewItemPageController(svc, conf)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package involvement

import (
"net/http"
)

type InvolvementController interface {
GetInvolvementList(w http.ResponseWriter, r *http.Request)
}
34 changes: 34 additions & 0 deletions src/goapp/controller/involvement/involvement-controller.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package involvement

import (
"encoding/json"
"fmt"
"main/service"
"net/http"
)

type involvementController struct {
*service.Service
}

func NewInvolvementController(s *service.Service) InvolvementController {
return &involvementController{
Service: s,
}
}

func (c *involvementController) GetInvolvementList(w http.ResponseWriter, r *http.Request) {
involvements, err := c.Service.Involvement.GetInvolvementList()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}

b, err := json.Marshal(involvements)
if err != nil {
fmt.Println(err)
return
}

w.Write(b)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ipdisclosure

import "net/http"

type IpDisclosureController interface {
InsertIPDisclosureRequest(w http.ResponseWriter, r *http.Request)
}

type IpDisclosurePageController interface {
IpDisclosureRequest(w http.ResponseWriter, r *http.Request)
}
Loading
Loading