Browse Source

get user and group dialog; generate api reverse proxy

master
Robin Thoni 8 years ago
parent
commit
3ce1df696c
2 changed files with 37 additions and 1 deletions
  1. BIN
      CubicOrange.Windows.Forms.ActiveDirectory.dll
  2. 37
    1
      sitegen.ps1

BIN
CubicOrange.Windows.Forms.ActiveDirectory.dll View File


+ 37
- 1
sitegen.ps1 View File

8
 [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null
8
 [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null
9
 $sqlserver = New-Object Microsoft.SqlServer.Management.Smo.Server($sqlinstance)
9
 $sqlserver = New-Object Microsoft.SqlServer.Management.Smo.Server($sqlinstance)
10
 
10
 
11
+Add-Type -Path (Join-Path -Path (Split-Path $script:MyInvocation.MyCommand.Path) -ChildPath 'CubicOrange.Windows.Forms.ActiveDirectory.dll')
12
+$DialogPicker = New-Object CubicOrange.Windows.Forms.ActiveDirectory.DirectoryObjectPickerDialog
13
+$DialogPicker.DefaultLocations = [CubicOrange.Windows.Forms.ActiveDirectory.Locations]::JoinedDomain
14
+$DialogPicker.AllowedObjectTypes = [CubicOrange.Windows.Forms.ActiveDirectory.ObjectTypes]::Groups,[CubicOrange.Windows.Forms.ActiveDirectory.ObjectTypes]::Users
15
+$DialogPicker.MultiSelect = $true
16
+
17
+
18
+$frontwebconfig = '<?xml version="1.0" encoding="UTF-8"?>
19
+<configuration>
20
+    <system.webServer>
21
+        <rewrite>
22
+            <rules>
23
+                <rule name="api">
24
+                    <match url="^api(/(.*))?$" />
25
+                    <action type="Rewrite" url="http://%%API_HOST%%/{R:1}" />
26
+                </rule>
27
+            </rules>
28
+        </rewrite>
29
+    </system.webServer>
30
+</configuration>'
31
+
32
+
11
 function sitegen($name)
33
 function sitegen($name)
12
 {
34
 {
13
     $sitedir = "$basedir$name"
35
     $sitedir = "$basedir$name"
125
 
147
 
126
 function frontgen($name)
148
 function frontgen($name)
127
 {
149
 {
128
-    return (sitegen($name))
150
+    if (-not (sitegen($name)))
151
+    {
152
+        return $false
153
+    }
154
+
155
+    $webconfig = $frontwebconfig -replace "%%API_HOST%%", "api.$name"
156
+    $webconfig | Set-Content "$basedir$name\web.config"
157
+
158
+    return $true
129
 }
159
 }
130
 
160
 
131
 function frontexists($name)
161
 function frontexists($name)
152
 {
182
 {
153
     frontrm($name)
183
     frontrm($name)
154
     apirm($name)
184
     apirm($name)
185
+}
186
+
187
+function getusers()
188
+{
189
+    $DialogPicker.ShowDialog()
190
+    return $DialogPicker.SelectedObjects
155
 }
191
 }

Loading…
Cancel
Save