Changeset 2065 for trunk/sources
- Timestamp:
- 06/19/09 12:06:02 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 16 added
- 1 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Grid.HiveBridge/3.2
-
Property
svn:ignore
set to
obj
bin
-
Property
svn:ignore
set to
-
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HeuristicLab.Hive.Server.Console-3.2.csproj
r1956 r2065 122 122 </Compile> 123 123 <Compile Include="HiveServerConsolePlugin.cs" /> 124 <Compile Include="LogonDlg.cs"> 125 <SubType>Form</SubType> 126 </Compile> 127 <Compile Include="LogonDlg.Designer.cs"> 128 <DependentUpon>LogonDlg.cs</DependentUpon> 129 </Compile> 124 130 <Compile Include="Properties\AssemblyInfo.cs" /> 125 131 <EmbeddedResource Include="AddGroup.resx"> … … 140 146 <DependentUpon>HiveServerManagementConsole.cs</DependentUpon> 141 147 <SubType>Designer</SubType> 148 </EmbeddedResource> 149 <EmbeddedResource Include="LogonDlg.resx"> 150 <DependentUpon>LogonDlg.cs</DependentUpon> 142 151 </EmbeddedResource> 143 152 <EmbeddedResource Include="Properties\Resources.resx"> -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerConsole.Designer.cs
r1717 r2065 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveServerConsole)); 47 48 this.gbConfiguration = new System.Windows.Forms.GroupBox(); 48 49 this.lblPort = new System.Windows.Forms.Label(); … … 57 58 this.tbPwd = new System.Windows.Forms.TextBox(); 58 59 this.lblError = new System.Windows.Forms.Label(); 60 this.pictureBox1 = new System.Windows.Forms.PictureBox(); 61 this.btnCancel = new System.Windows.Forms.Button(); 59 62 this.gbConfiguration.SuspendLayout(); 60 63 this.gpUser.SuspendLayout(); 64 ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 61 65 this.SuspendLayout(); 62 66 // … … 67 71 this.gbConfiguration.Controls.Add(this.tbPort); 68 72 this.gbConfiguration.Controls.Add(this.tbIp); 69 this.gbConfiguration.Location = new System.Drawing.Point(1 2, 100);73 this.gbConfiguration.Location = new System.Drawing.Point(188, 100); 70 74 this.gbConfiguration.Name = "gbConfiguration"; 71 75 this.gbConfiguration.Size = new System.Drawing.Size(283, 82); … … 110 114 // btnLogin 111 115 // 112 this.btnLogin.Location = new System.Drawing.Point( 179, 188);116 this.btnLogin.Location = new System.Drawing.Point(355, 193); 113 117 this.btnLogin.Name = "btnLogin"; 114 118 this.btnLogin.Size = new System.Drawing.Size(116, 23); … … 125 129 this.gpUser.Controls.Add(this.lblUsername); 126 130 this.gpUser.Controls.Add(this.tbPwd); 127 this.gpUser.Location = new System.Drawing.Point(1 2, 12);131 this.gpUser.Location = new System.Drawing.Point(188, 12); 128 132 this.gpUser.Name = "gpUser"; 129 133 this.gpUser.Size = new System.Drawing.Size(283, 82); … … 171 175 this.lblError.AutoSize = true; 172 176 this.lblError.ForeColor = System.Drawing.Color.Red; 173 this.lblError.Location = new System.Drawing.Point(1 6, 238);177 this.lblError.Location = new System.Drawing.Point(12, 193); 174 178 this.lblError.Name = "lblError"; 175 179 this.lblError.Size = new System.Drawing.Size(0, 13); 176 180 this.lblError.TabIndex = 5; 177 181 // 182 // pictureBox1 183 // 184 this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); 185 this.pictureBox1.Location = new System.Drawing.Point(12, 12); 186 this.pictureBox1.Name = "pictureBox1"; 187 this.pictureBox1.Size = new System.Drawing.Size(170, 170); 188 this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 189 this.pictureBox1.TabIndex = 8; 190 this.pictureBox1.TabStop = false; 191 // 192 // btnCancel 193 // 194 this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 195 this.btnCancel.Location = new System.Drawing.Point(259, 193); 196 this.btnCancel.Name = "btnCancel"; 197 this.btnCancel.Size = new System.Drawing.Size(90, 23); 198 this.btnCancel.TabIndex = 9; 199 this.btnCancel.Text = "&Cancel"; 200 this.btnCancel.UseVisualStyleBackColor = true; 201 this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); 202 // 178 203 // HiveServerConsole 179 204 // … … 181 206 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 182 207 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 183 this.ClientSize = new System.Drawing.Size(311, 225); 208 this.BackColor = System.Drawing.Color.White; 209 this.CancelButton = this.btnCancel; 210 this.ClientSize = new System.Drawing.Size(482, 226); 211 this.Controls.Add(this.btnCancel); 212 this.Controls.Add(this.pictureBox1); 184 213 this.Controls.Add(this.lblError); 185 214 this.Controls.Add(this.gpUser); 186 215 this.Controls.Add(this.btnLogin); 187 216 this.Controls.Add(this.gbConfiguration); 217 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 188 218 this.Name = "HiveServerConsole"; 189 this.Text = "Server Console"; 219 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 220 this.Text = "Server Console Logon"; 190 221 this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.HiveServerConsole_KeyPress); 191 222 this.gbConfiguration.ResumeLayout(false); … … 193 224 this.gpUser.ResumeLayout(false); 194 225 this.gpUser.PerformLayout(); 226 ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 195 227 this.ResumeLayout(false); 196 228 this.PerformLayout(); … … 212 244 private System.Windows.Forms.TextBox tbPwd; 213 245 private System.Windows.Forms.Label lblError; 246 private System.Windows.Forms.PictureBox pictureBox1; 247 private System.Windows.Forms.Button btnCancel; 214 248 } 215 249 } -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerConsole.cs
r1832 r2065 33 33 using System.Security.Cryptography; 34 34 using System.Net; 35 using System.Threading; 35 36 36 37 namespace HeuristicLab.Hive.Server.ServerConsole { … … 42 43 public HiveServerConsole() { 43 44 InitializeComponent(); 45 #if(DEBUG) 44 46 tbIp.Text = "10.20.53.1"; 45 47 tbPort.Text = WcfSettings.GetDefaultPort().ToString(); 46 48 tbUserName.Text = "test45"; 47 49 tbPwd.Text = "test"; 50 #endif 48 51 } 49 52 … … 70 73 information.closeFormEvent += new closeForm(EnableForm); 71 74 information.Show(); 72 } else { 73 lblError.Text = "Problem with login"; 74 } 75 } 75 76 } 76 77 … … 81 82 /// <returns></returns> 82 83 private bool IsValid() { 83 if ((tbUserName.Text != "") && 84 (tbPwd.Text != "") && 85 (tbIp.Text != "") && 86 (tbPort.Text != "")) { 84 Thread t = new Thread(new ThreadStart(ShowWaitDlg)); 85 if (IsFormValidated()) { 86 IPAddress ipAdress = IPAddress.Parse(tbIp.Text); 87 int port = int.Parse(tbPort.Text); 88 IServerConsoleFacade scf = ServiceLocator.GetServerConsoleFacade(); 87 89 try { 88 IPAddress ipAdress; 89 int port; 90 if ((IPAddress.TryParse(tbIp.Text, out ipAdress)) && 91 int.TryParse(tbPort.Text, out port)) { 92 IServerConsoleFacade scf = ServiceLocator.GetServerConsoleFacade(); 93 Response resp = scf.Login(tbUserName.Text, tbPwd.Text); 94 string str = resp.StatusMessage; 95 if (resp.StatusMessage != "Logged in") { 96 return false; 97 } 98 } else { 99 lblError.Text = "IP or Port not valid"; 100 } 90 lblError.Text = "Trying to logon..."; 91 t.Start(); 92 Response resp = scf.Login(tbUserName.Text, tbPwd.Text); 93 t.Abort(); 94 if (resp.StatusMessage == "Logged in") return true; 95 lblError.Text = resp.StatusMessage; 101 96 } 102 97 catch (Exception ex) { 103 lblError.Text = "Server not online"; 98 //login failed 99 lblError.Text = "Logon failed!"; 100 t.Abort(); 104 101 return false; 105 102 } 106 return true;107 } else {108 if (tbUserName.Text == "") {109 lblError.Text = "Please type in Username";110 } else if (tbPwd.Text == "") {111 lblError.Text = "Please type in Password";112 } else if (tbPort.Text == "") {113 lblError.Text = "Please type in Port";114 } else if (tbIp.Text == "") {115 lblError.Text = "Please type in IP-Adress";116 }117 return false;118 103 } 104 //validation failed 105 t.Abort(); 106 return false; 107 } 108 109 private void ShowWaitDlg() { 110 LogonDlg dlg = new LogonDlg(); 111 dlg.ShowDialog(); 112 } 113 114 /// <summary> 115 /// Validates the form. 116 /// </summary> 117 /// <returns></returns> 118 private bool IsFormValidated() { 119 bool isValid = true; 120 if (String.IsNullOrEmpty(tbUserName.Text)) { 121 lblError.Text = "Please type in Username."; 122 isValid = false; 123 } 124 if (String.IsNullOrEmpty(tbPwd.Text)) { 125 lblError.Text = "Please type in Password."; 126 isValid = false; 127 } 128 if (String.IsNullOrEmpty(tbIp.Text)) { 129 lblError.Text = "Please type in Port."; 130 isValid = false; 131 } 132 if (String.IsNullOrEmpty(tbPort.Text)) { 133 lblError.Text = "Please type in IP-Address."; 134 isValid = false; 135 } 136 try { 137 int.Parse(tbPort.Text); 138 } 139 catch (Exception ex) { 140 isValid = false; 141 lblError.Text = "Please verify entered Port."; 142 } 143 try { 144 IPAddress.Parse(tbIp.Text); 145 } 146 catch (Exception ex) { 147 isValid = false; 148 lblError.Text = "Please verify entered IP address."; 149 } 150 return isValid; 119 151 } 120 152 … … 124 156 ServiceLocator.ShutDownFacade(); 125 157 if (error == true) { 126 lblError.Text = " Something went wrong with the server";158 lblError.Text = "Establishing server connection failed."; 127 159 } 128 160 } … … 134 166 } 135 167 } 168 169 private void btnCancel_Click(object sender, EventArgs e) { 170 Dispose(); 171 } 136 172 } 137 173 } -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerConsole.resx
r1530 r2065 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 121 <data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base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68rI/+xxrUWhbSkZg064 162 anNnpzVrTu96PngF9p1+dYhLUxJcM5INM4skbViWK9PLpPap9vKMbgFqxT4q1broKk31iOuT7R6JNX3y 163 rVgo25q66q26InwdbcDkzvE5prlj8Z10pSq/Gt4Rt2FZrVXHhUHn3Ay/aE0sgM8iqNpShzw+3Y5GLxLa 164 yACvddQ9LFEbkyoBb/hLg2nXh1EpThmO+JlTuuyJM7mzU624mi2e64v/2WIEz5hyNb7xWSirnwrruCX0 165 yHCMh0zkIhv5yEhOspKXzOQmw4vHTo6ylKf8ZOlR+cpYzvJQtczlLnvZdlD+spjHbGTLWJnMaE5zi5Wj 166 5ja7mTfJyXmznOdMZOzS+c54dl6e98xnZZ2rz4DuM9ECTWg61ynMhU50kUeHaEU7+m+aavSjJz2lhgQE 167 ADs= 168 </value> 169 </data> 120 170 </root> -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/HeuristicLab.Hive.Server.Core-3.2.csproj
r1941 r2065 85 85 </ItemGroup> 86 86 <ItemGroup> 87 <Compile Include="Authorization\HivePermissions.cs" /> 88 <Compile Include="Authorization\PermissionCollection.cs" /> 89 <Compile Include="Authorization\PermissionContext.cs" /> 90 <Compile Include="Authorization\PermissionException.cs" /> 91 <Compile Include="Authorization\Policy.cs" /> 92 <Compile Include="Authorization\PolicyCollection.cs" /> 87 93 <Compile Include="ClientCommunicator.cs" /> 88 94 <Compile Include="ClientFacade.cs" /> … … 90 96 <Compile Include="DbTestApp.cs" /> 91 97 <Compile Include="ExecutionEngineFacade.cs" /> 92 <Compile Include=" HivePermissionManager.cs" />98 <Compile Include="Authorization\HivePermissionManager.cs" /> 93 99 <Compile Include="HiveServerCorePlugin.cs" /> 94 100 <Compile Include="HiveServerMessages.Designer.cs" /> … … 98 104 <Compile Include="JobManager.cs" /> 99 105 <Compile Include="LifecycleManager.cs" /> 100 <Compile Include="PermissiveSecurityConstants.cs" />101 106 <Compile Include="Properties\AssemblyInfo.cs" /> 102 107 <Compile Include="ServerConsoleFacade.cs" /> … … 112 117 <None Include="app.config" /> 113 118 <None Include="HeuristicLab.snk" /> 119 <EmbeddedResource Include="Authorization\HivePermissionSet.xsd"> 120 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 121 </EmbeddedResource> 114 122 <None Include="Properties\AssemblyInfo.frame" /> 115 123 <None Include="Properties\Settings.settings"> … … 148 156 </ProjectReference> 149 157 </ItemGroup> 158 <ItemGroup> 159 <EmbeddedResource Include="Authorization\HivePermissionSet.xml"> 160 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 161 </EmbeddedResource> 162 </ItemGroup> 163 <ItemGroup> 164 <Content Include="Authorization\HivePermissionPolicy.xml" /> 165 </ItemGroup> 150 166 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 151 167 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/InternalInterfaces/IHivePermissionManager.cs
r1769 r2065 2 2 namespace HeuristicLab.Hive.Server.Core.InternalInterfaces { 3 3 public interface IHivePermissionManager { 4 /// <summary> 5 /// Checks user permission against predefined policy in database. 6 /// </summary> 7 /// <param name="permission">the name of policy defined in xml-file</param> 8 /// <param name="sessionID">the users current session ID</param> 9 /// <param name="entityID"></param> 10 /// <exception cref="PermissionException">thrown when access denied</exception> 11 void Authorize(string policyName, Guid sessionID, Guid entityID); 4 12 bool CheckPermission(Guid sessionID, Guid actionID, Guid entityId); 5 13 Guid Login(string username, string password); -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ServerConsoleFacade.cs
r2005 r2065 29 29 using HeuristicLab.Security.Contracts.Interfaces; 30 30 using HeuristicLab.Hive.Server.Core.InternalInterfaces; 31 using System.ServiceModel; 32 31 33 32 34 namespace HeuristicLab.Hive.Server.Core { … … 45 47 Response resp = new Response(); 46 48 47 /*48 49 sessionID = secMan.Login(username, password); 49 50 if (sessionID == Guid.Empty) { … … 55 56 ApplicationConstants.RESPONSE_SERVERCONSOLE_LOGIN_SUCCESS; 56 57 } 57 */58 sessionID = Guid.Empty;59 resp.Success = true;60 resp.StatusMessage = ApplicationConstants.RESPONSE_SERVERCONSOLE_LOGIN_SUCCESS;61 58 return resp; 62 59 } … … 64 61 65 62 public ResponseList<ClientInfo> GetAllClients() { 66 if (HasPermission(PermissiveSecurityAction.List_AllClients)) 67 return clientManager.GetAllClients(); 68 else 69 throw new PermissionException(); 63 secMan.Authorize("AccessClients", sessionID, Guid.Empty); 64 return clientManager.GetAllClients(); 70 65 } 71 66 72 67 public ResponseList<ClientGroup> GetAllClientGroups() { 73 if (HasPermission(PermissiveSecurityAction.List_AllClientGroups)) 74 return clientManager.GetAllClientGroups(); 75 else 76 throw new PermissionException(); 68 secMan.Authorize("AccessClientGroup", sessionID, Guid.Empty); 69 return clientManager.GetAllClientGroups(); 77 70 } 78 71 79 72 public ResponseList<UpTimeStatistics> GetAllUpTimeStatistics() { 80 if (HasPermission(PermissiveSecurityAction.Show_Statistics)) 81 return clientManager.GetAllUpTimeStatistics(); 82 else 83 throw new PermissionException(); 73 secMan.Authorize("AccessStatistics", sessionID, Guid.Empty); 74 return clientManager.GetAllUpTimeStatistics(); 84 75 } 85 76 86 77 public ResponseObject<ClientGroup> AddClientGroup(ClientGroup clientGroup) { 87 if (HasPermission(PermissiveSecurityAction.Add_ClientGroup)) 88 return clientManager.AddClientGroup(clientGroup); 89 else 90 throw new PermissionException(); 78 secMan.Authorize("AddClientGroup", sessionID, Guid.Empty); 79 return clientManager.AddClientGroup(clientGroup); 91 80 } 92 81 93 82 public Response AddResourceToGroup(Guid clientGroupId, Resource resource) { 94 if (HasPermission(PermissiveSecurityAction.Add_Resource)) 95 return clientManager.AddResourceToGroup(clientGroupId, resource); 96 else 97 throw new PermissionException(); 83 secMan.Authorize("AddResource", sessionID, Guid.Empty); 84 return clientManager.AddResourceToGroup(clientGroupId, resource); 98 85 } 99 86 100 87 public Response DeleteResourceFromGroup(Guid clientGroupId, Guid resourceId) { 101 if (HasPermission(PermissiveSecurityAction.Delete_Resource))102 88 return clientManager.DeleteResourceFromGroup(clientGroupId, resourceId); 103 else104 throw new PermissionException();105 89 } 106 90 107 108 public ResponseList<HeuristicLab.Hive.Contracts.BusinessObjects.Job> GetAllJobs() { 109 if (HasPermission(PermissiveSecurityAction.Get_AllJobs)) 110 return jobManager.GetAllJobs(); 111 else 112 throw new PermissionException(); 91 public ResponseList<Job> GetAllJobs() { 92 secMan.Authorize("AccessJobs", sessionID, Guid.Empty); 93 return jobManager.GetAllJobs(); 113 94 } 114 95 115 public ResponseObject<HeuristicLab.Hive.Contracts.BusinessObjects.Job> GetJobById(Guid jobId) { 96 public ResponseObject<Job> GetJobById(Guid jobId) { 97 secMan.Authorize("AccessJobs", sessionID, jobId); 116 98 return jobManager.GetJobById(jobId); 117 99 } 118 100 119 101 public ResponseObject<Job> AddNewJob(Job job) { 120 if (HasPermission(PermissiveSecurityAction.Add_Job)) 121 return jobManager.AddNewJob(job); 122 else 123 throw new PermissionException(); 102 secMan.Authorize("AddJob", sessionID, job.Id); 103 return jobManager.AddNewJob(job); 124 104 } 125 105 126 106 public ResponseObject<JobResult> GetLastJobResultOf(Guid jobId, bool requested) { 127 if (HasPermission(PermissiveSecurityAction.Get_LastJobResult)) 128 return jobManager.GetLastJobResultOf(jobId, requested); 129 else 130 throw new PermissionException(); 107 secMan.Authorize("AccessJobResults", sessionID, jobId); 108 return jobManager.GetLastJobResultOf(jobId, requested); 131 109 } 132 110 133 111 public ResponseList<JobResult> GetAllJobResults(Guid jobId) { 134 if (HasPermission(PermissiveSecurityAction.Get_AllJobResults)) 135 return jobManager.GetAllJobResults(jobId); 136 else 137 throw new PermissionException(); 112 secMan.Authorize("AccessJobResults", sessionID, jobId); 113 return jobManager.GetAllJobResults(jobId); 138 114 } 139 115 140 116 public Response RemoveJob(Guid jobId) { 141 if (HasPermission(PermissiveSecurityAction.Remove_Job)) 142 return jobManager.RemoveJob(jobId); 143 else 144 throw new PermissionException(); 117 secMan.Authorize("RemoveJob", sessionID, jobId); 118 return jobManager.RemoveJob(jobId); 145 119 } 146 120 147 121 public Response RequestSnapshot(Guid jobId) { 148 if (HasPermission(PermissiveSecurityAction.Request_Snapshot)) 149 return jobManager.RequestSnapshot(jobId); 150 else 151 throw new PermissionException(); 122 secMan.Authorize("AccessJobResults", sessionID, jobId); 123 return jobManager.RequestSnapshot(jobId); 152 124 } 153 125 154 126 public Response AbortJob(Guid jobId) { 155 if (HasPermission(PermissiveSecurityAction.Abort_Job)) 156 return jobManager.AbortJob(jobId); 157 else 158 throw new PermissionException(); 127 secMan.Authorize("AbortJob", sessionID, Guid.Empty); 128 return jobManager.AbortJob(jobId); 159 129 } 160 130 161 131 public ResponseObject<List<ClientGroup>> GetAllGroupsOfResource(Guid resourceId) { 162 if (HasPermission(PermissiveSecurityAction.Get_AllGroupsOfResource)) 163 return clientManager.GetAllGroupsOfResource(resourceId); 164 else 165 throw new PermissionException(); 132 secMan.Authorize("AccessUserGroup", sessionID, Guid.Empty); 133 return clientManager.GetAllGroupsOfResource(resourceId); 166 134 } 167 135 168 136 public Response DeleteClientGroup(Guid clientGroupId) { 137 secMan.Authorize("DeleteClientGroup", sessionID, Guid.Empty); 169 138 return clientManager.DeleteClientGroup(clientGroupId); 170 139 } 171 140 172 /*173 private bool HasPermission(Guid action) {174 return (sessionID == Guid.Empty) ? false : secMan.CheckPermission(sessionID, action, Guid.Empty);175 }176 177 private bool HasPermission(Guid action, Guid entityId) {178 return (sessionID == Guid.Empty) ? false : secMan.CheckPermission(sessionID, action, entityId);179 }180 */181 182 [Obsolete("Only for testing!")]183 private bool HasPermission(Guid g) { return true; }184 [Obsolete("Only for testing!")]185 private bool HasPermission(Guid g, Guid f) { return true; }186 187 public class PermissionException : Exception {188 public PermissionException()189 : base("Current user has insufficent rights for this action!") {190 }191 192 public PermissionException(string msg)193 : base(msg) {194 }195 196 197 }198 199 141 public ResponseList<Project> GetAllProjects() { 142 secMan.Authorize("AccessProjects", sessionID, Guid.Empty); 200 143 return jobManager.GetAllProjects(); 201 144 } 202 145 203 146 public Response CreateProject(Project project) { 147 secMan.Authorize("CreateProjects", sessionID, Guid.Empty); 204 148 return jobManager.CreateProject(project); 205 149 } 206 150 207 151 public Response ChangeProject(Project project) { 152 secMan.Authorize("ChangeProjects", sessionID, Guid.Empty); 208 153 return jobManager.ChangeProject(project); 209 154 } 210 155 211 156 public Response DeleteProject(Guid projectId) { 157 secMan.Authorize("DeleteProjects", sessionID, projectId); 212 158 return jobManager.DeleteProject(projectId); 213 159 } 214 160 215 161 public ResponseList<Job> GetJobsByProject(Guid projectId) { 162 secMan.Authorize("AccessJobs", sessionID, Guid.Empty); 216 163 return jobManager.GetJobsByProject(projectId); 217 164 } -
trunk/sources/HeuristicLab.Hive.Server/3.2/HeuristicLab.Hive.Server-3.2.csproj
r1534 r2065 112 112 <AutoGen>True</AutoGen> 113 113 <DependentUpon>Resources.resx</DependentUpon> 114 <DesignTime>True</DesignTime> 114 115 </Compile> 115 116 <None Include="Properties\AssemblyInfo.frame" /> … … 139 140 </ProjectReference> 140 141 </ItemGroup> 142 <ItemGroup> 143 <None Include="Resources\HeuristicLab.ico" /> 144 </ItemGroup> 141 145 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 142 146 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
trunk/sources/HeuristicLab.Hive.Server/3.2/HiveServerApplication.cs
r1939 r2065 30 30 using HeuristicLab.Hive.Contracts; 31 31 using HeuristicLab.Hive.Contracts.Interfaces; 32 using HeuristicLab.Hive.Server.Properties; 32 33 33 34 namespace HeuristicLab.Hive.Server { … … 158 159 159 160 lifecycleManager.Init(); 160 161 161 Form mainForm = new MainForm(baseAddrDict); 162 163 162 Application.Run(mainForm); 164 163 165 164 lifecycleManager.Shutdown(); 166 165 } -
trunk/sources/HeuristicLab.Hive.Server/3.2/MainForm.Designer.cs
r1530 r2065 29 29 private void InitializeComponent() 30 30 { 31 this.components = new System.ComponentModel.Container(); 31 32 this.label1 = new System.Windows.Forms.Label(); 32 this.lblAddress1 = new System.Windows.Forms.Label(); 33 this.label2 = new System.Windows.Forms.Label(); 34 this.lblAddress2 = new System.Windows.Forms.Label(); 35 this.label3 = new System.Windows.Forms.Label(); 36 this.lblAddress3 = new System.Windows.Forms.Label(); 33 this.rtfServices = new System.Windows.Forms.RichTextBox(); 34 this.ni = new System.Windows.Forms.NotifyIcon(this.components); 35 this.ctxNotifyMenu = new System.Windows.Forms.ContextMenuStrip(this.components); 36 this.tsShowInfo = new System.Windows.Forms.ToolStripMenuItem(); 37 this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 38 this.tsExit = new System.Windows.Forms.ToolStripMenuItem(); 39 this.btnClose = new System.Windows.Forms.Button(); 40 this.ctxNotifyMenu.SuspendLayout(); 37 41 this.SuspendLayout(); 38 42 // … … 40 44 // 41 45 this.label1.AutoSize = true; 42 this.label1.Location = new System.Drawing.Point(1 8, 18);46 this.label1.Location = new System.Drawing.Point(12, 9); 43 47 this.label1.Name = "label1"; 44 this.label1.Size = new System.Drawing.Size( 183, 13);48 this.label1.Size = new System.Drawing.Size(97, 13); 45 49 this.label1.TabIndex = 0; 46 this.label1.Text = " Hive Server Client Facade running @";50 this.label1.Text = "Available Services:"; 47 51 // 48 // lblAddress152 // rtfServices 49 53 // 50 this. lblAddress1.AutoSize = true;51 this. lblAddress1.Location = new System.Drawing.Point(18, 43);52 this. lblAddress1.Name = "lblAddress1";53 this. lblAddress1.Size = new System.Drawing.Size(44, 13);54 this. lblAddress1.TabIndex = 1;55 this. lblAddress1.Text = "address";54 this.rtfServices.Location = new System.Drawing.Point(12, 25); 55 this.rtfServices.Name = "rtfServices"; 56 this.rtfServices.ReadOnly = true; 57 this.rtfServices.Size = new System.Drawing.Size(280, 121); 58 this.rtfServices.TabIndex = 1; 59 this.rtfServices.Text = ""; 56 60 // 57 // label261 // ni 58 62 // 59 this.label2.AutoSize = true; 60 this.label2.Location = new System.Drawing.Point(18, 76); 61 this.label2.Name = "label2"; 62 this.label2.Size = new System.Drawing.Size(195, 13); 63 this.label2.TabIndex = 2; 64 this.label2.Text = "Hive Server Console Facade running @"; 63 this.ni.ContextMenuStrip = this.ctxNotifyMenu; 64 this.ni.Text = "notifyIcon1"; 65 this.ni.Visible = true; 65 66 // 66 // lblAddress267 // ctxNotifyMenu 67 68 // 68 this. lblAddress2.AutoSize = true;69 this.lblAddress2.Location = new System.Drawing.Point(18, 102);70 this.lblAddress2.Name = "lblAddress2";71 this.lblAddress2.Size = new System.Drawing.Size(44, 13);72 this. lblAddress2.TabIndex = 3;73 this. lblAddress2.Text = "address";69 this.ctxNotifyMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 70 this.tsShowInfo, 71 this.toolStripSeparator1, 72 this.tsExit}); 73 this.ctxNotifyMenu.Name = "ctxNotifyMenu"; 74 this.ctxNotifyMenu.Size = new System.Drawing.Size(106, 54); 74 75 // 75 // label376 // tsShowInfo 76 77 // 77 this.label3.AutoSize = true; 78 this.label3.Location = new System.Drawing.Point(18, 131); 79 this.label3.Name = "label3"; 80 this.label3.Size = new System.Drawing.Size(206, 13); 81 this.label3.TabIndex = 4; 82 this.label3.Text = "Hive Execution Engine Facade running @"; 78 this.tsShowInfo.Name = "tsShowInfo"; 79 this.tsShowInfo.Size = new System.Drawing.Size(105, 22); 80 this.tsShowInfo.Text = "&Info"; 81 this.tsShowInfo.Click += new System.EventHandler(this.ShowInfo); 83 82 // 84 // lblAddress383 // toolStripSeparator1 85 84 // 86 this.lblAddress3.AutoSize = true; 87 this.lblAddress3.Location = new System.Drawing.Point(18, 159); 88 this.lblAddress3.Name = "lblAddress3"; 89 this.lblAddress3.Size = new System.Drawing.Size(44, 13); 90 this.lblAddress3.TabIndex = 5; 91 this.lblAddress3.Text = "address"; 85 this.toolStripSeparator1.Name = "toolStripSeparator1"; 86 this.toolStripSeparator1.Size = new System.Drawing.Size(102, 6); 87 // 88 // tsExit 89 // 90 this.tsExit.Name = "tsExit"; 91 this.tsExit.Size = new System.Drawing.Size(105, 22); 92 this.tsExit.Text = "E&xit"; 93 this.tsExit.Click += new System.EventHandler(this.CloseApp); 94 // 95 // btnClose 96 // 97 this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 98 this.btnClose.Location = new System.Drawing.Point(279, 1); 99 this.btnClose.Name = "btnClose"; 100 this.btnClose.Size = new System.Drawing.Size(22, 21); 101 this.btnClose.TabIndex = 2; 102 this.btnClose.Text = "X"; 103 this.btnClose.UseVisualStyleBackColor = true; 104 this.btnClose.Click += new System.EventHandler(this.btnClose_Click); 92 105 // 93 106 // MainForm 94 107 // 108 this.AcceptButton = this.btnClose; 95 109 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 96 110 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 97 this.ClientSize = new System.Drawing.Size(304, 181); 98 this.Controls.Add(this.lblAddress3); 99 this.Controls.Add(this.label3); 100 this.Controls.Add(this.lblAddress2); 101 this.Controls.Add(this.label2); 102 this.Controls.Add(this.lblAddress1); 111 this.CancelButton = this.btnClose; 112 this.ClientSize = new System.Drawing.Size(304, 166); 113 this.ControlBox = false; 114 this.Controls.Add(this.btnClose); 115 this.Controls.Add(this.rtfServices); 103 116 this.Controls.Add(this.label1); 117 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 104 118 this.Name = "MainForm"; 119 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 105 120 this.Text = "Hive Server"; 121 this.TopMost = true; 122 this.ctxNotifyMenu.ResumeLayout(false); 106 123 this.ResumeLayout(false); 107 124 this.PerformLayout(); … … 112 129 113 130 private System.Windows.Forms.Label label1; 114 private System.Windows.Forms.Label lblAddress1; 115 private System.Windows.Forms.Label label2; 116 private System.Windows.Forms.Label lblAddress2; 117 private System.Windows.Forms.Label label3; 118 private System.Windows.Forms.Label lblAddress3; 131 private System.Windows.Forms.RichTextBox rtfServices; 132 private System.Windows.Forms.NotifyIcon ni; 133 private System.Windows.Forms.ContextMenuStrip ctxNotifyMenu; 134 private System.Windows.Forms.ToolStripMenuItem tsShowInfo; 135 private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 136 private System.Windows.Forms.ToolStripMenuItem tsExit; 137 private System.Windows.Forms.Button btnClose; 119 138 } 120 139 } -
trunk/sources/HeuristicLab.Hive.Server/3.2/MainForm.cs
r1530 r2065 7 7 using System.Text; 8 8 using System.Windows.Forms; 9 using HeuristicLab.Hive.Server.Properties; 9 10 10 11 namespace HeuristicLab.Hive.Server … … 13 14 public MainForm(Dictionary<string, Uri> addresses) { 14 15 InitializeComponent(); 16 this.Visible = false; 17 15 18 Uri uri; 19 StringBuilder servicesTxt = new StringBuilder(); 16 20 addresses.TryGetValue(HiveServerApplication.STR_ClientCommunicator, out uri); 17 if (uri!=null)18 this.lblAddress1.Text = uri.ToString();21 if (uri != null) 22 servicesTxt.AppendLine(String.Format("Server Client: {0}", uri)); 19 23 addresses.TryGetValue(HiveServerApplication.STR_ServerConsoleFacade, out uri); 20 24 if (uri != null) 21 this.lblAddress2.Text = uri.ToString();25 servicesTxt.AppendLine(String.Format("Server Console: {0}", uri)); 22 26 addresses.TryGetValue(HiveServerApplication.STR_ExecutionEngineFacade, out uri); 23 27 if (uri != null) 24 this.lblAddress3.Text = uri.ToString(); 28 servicesTxt.AppendLine(String.Format("Execution Engine: {0}", uri)); 29 30 rtfServices.AppendText(servicesTxt.ToString()); 31 32 ni.Icon = Resources.HeuristicLab; 33 ni.BalloonTipTitle = "HL Hive Server Services"; 34 ni.BalloonTipText = servicesTxt.ToString(); 35 ni.BalloonTipIcon = ToolTipIcon.Info; 36 ni.Text = "HL Hive Server Services"; 37 ni.ShowBalloonTip(10000); 38 } 39 40 private void CloseApp(object sender, EventArgs e) { 41 Dispose(); 42 } 43 44 private void ShowInfo(object sender, EventArgs e) { 45 this.Visible = true; 46 } 47 48 private void btnClose_Click(object sender, EventArgs e) { 49 this.Visible = false; 25 50 } 26 51 -
trunk/sources/HeuristicLab.Hive.Server/3.2/MainForm.resx
r1530 r2065 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="ni.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 <value>17, 17</value> 122 </metadata> 123 <metadata name="ctxNotifyMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 124 <value>77, 17</value> 125 </metadata> 120 126 </root> -
trunk/sources/HeuristicLab.Hive.Server/3.2/Properties/Resources.Designer.cs
r713 r2065 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:2.0.50727.30 534 // Runtime Version:2.0.50727.3082 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 9 9 //------------------------------------------------------------------------------ 10 10 11 namespace HeuristicLab.Hive.Server.Properties 12 { 13 14 11 namespace HeuristicLab.Hive.Server.Properties { 12 using System; 13 14 15 15 /// <summary> 16 16 /// A strongly-typed resource class, for looking up localized strings, etc. … … 23 23 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 24 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 internal class Resources 26 { 27 25 internal class Resources { 26 28 27 private static global::System.Resources.ResourceManager resourceMan; 29 28 30 29 private static global::System.Globalization.CultureInfo resourceCulture; 31 30 32 31 [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 internal Resources() 34 { 32 internal Resources() { 35 33 } 36 34 37 35 /// <summary> 38 36 /// Returns the cached ResourceManager instance used by this class. 39 37 /// </summary> 40 38 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 internal static global::System.Resources.ResourceManager ResourceManager 42 { 43 get 44 { 45 if ((resourceMan == null)) 46 { 39 internal static global::System.Resources.ResourceManager ResourceManager { 40 get { 41 if (object.ReferenceEquals(resourceMan, null)) { 47 42 global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeuristicLab.Hive.Server.Properties.Resources", typeof(Resources).Assembly); 48 43 resourceMan = temp; … … 51 46 } 52 47 } 53 48 54 49 /// <summary> 55 50 /// Overrides the current thread's CurrentUICulture property for all … … 57 52 /// </summary> 58 53 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 internal static global::System.Globalization.CultureInfo Culture 60 { 61 get 62 { 54 internal static global::System.Globalization.CultureInfo Culture { 55 get { 63 56 return resourceCulture; 64 57 } 65 set 66 { 58 set { 67 59 resourceCulture = value; 60 } 61 } 62 63 internal static System.Drawing.Icon HeuristicLab { 64 get { 65 object obj = ResourceManager.GetObject("HeuristicLab", resourceCulture); 66 return ((System.Drawing.Icon)(obj)); 68 67 } 69 68 } -
trunk/sources/HeuristicLab.Hive.Server/3.2/Properties/Resources.resx
r713 r2065 47 47 mimetype: application/x-microsoft.net.object.binary.base64 48 48 value : The object must be serialized with 49 : System. Serialization.Formatters.Binary.BinaryFormatter49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter 50 50 : and then encoded with base64 encoding. 51 51 … … 61 61 --> 62 62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> 63 <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> 63 64 <xsd:element name="root" msdata:IsDataSet="true"> 64 65 <xsd:complexType> … … 69 70 <xsd:element name="value" type="xsd:string" minOccurs="0" /> 70 71 </xsd:sequence> 71 <xsd:attribute name="name" type="xsd:string" />72 <xsd:attribute name="name" use="required" type="xsd:string" /> 72 73 <xsd:attribute name="type" type="xsd:string" /> 73 74 <xsd:attribute name="mimetype" type="xsd:string" /> 75 <xsd:attribute ref="xml:space" /> 74 76 </xsd:complexType> 75 77 </xsd:element> … … 86 88 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> 87 89 </xsd:sequence> 88 <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />90 <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> 89 91 <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> 90 92 <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> 93 <xsd:attribute ref="xml:space" /> 91 94 </xsd:complexType> 92 95 </xsd:element> … … 115 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 116 119 </resheader> 120 <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 121 <data name="HeuristicLab" type="System.Resources.ResXFileRef, System.Windows.Forms"> 122 <value>..\Resources\HeuristicLab.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> 123 </data> 117 124 </root> -
trunk/sources/HeuristicLab.Security.Core/3.2/SecurityCoreTest.cs
r1771 r2065 6 6 using HeuristicLab.Security.Contracts.BusinessObjects; 7 7 using HeuristicLab.Hive.Server.Core; 8 using System.Diagnostics; 8 9 9 10 namespace HeuristicLab.Security.Core { 10 11 [ClassInfo(Name = "Security Test App", 11 12 Description = "Test Application for the Security Service", 12 AutoRestart = true)]13 AutoRestart = false)] 13 14 class SecurityCoreTest : ApplicationBase { 14 15 … … 166 167 manager.RemovePermission(permission.Id); 167 168 } 168 #region TEST DATA INSERT SECTION for MB 169 170 private void InsertTestDataForPermissionCheck() { 171 int numberOfUsers = 10; 172 173 List<User> users = new List<User>(); 174 for (int i = 0; i < numberOfUsers; i++) { 175 users.Add(MB_InsertTestUser()); 176 } 177 MB_AssignGroups(users); 178 179 } 180 181 private User MB_InsertTestUser() { 182 Random rand = new Random(DateTime.Now.Millisecond); 183 int usr = rand.Next(1000); 184 User user = new User(); 185 user.Login = "test" + usr.ToString(); 186 user.SetHashedPassword("test"); 187 user.Name = "test" + usr.ToString(); 188 return manager.AddNewUser(user); 189 } 190 191 /// <summary> 192 /// Splits the given users into two groups and assigns them. Some will be not assigned. 193 /// </summary> 194 /// <param name="users"></param> 195 private void MB_AssignGroups(List<User> users) { 196 UserGroup group01 = new UserGroup(); 197 group01.Name = "Test Group 01"; 198 199 UserGroup group02 = new UserGroup(); 200 group02.Name = "Test Group 02"; 201 202 //three-way split users into group1, group2 and none 203 int idx = users.Count / 3; 204 for (int i = 0; i < idx; i++) { 205 group01.Members.Add(users[i]); 206 } 207 for (int i = idx; i < users.Count / 2; i++) { 208 group02.Members.Add(users[i]); 209 } 210 manager.AddNewUserGroup(group01); 211 manager.AddNewUserGroup(group02); 212 213 } 214 215 private void MB_AddPermission(List<User> users) { 216 if (users.Count < 2) return; 217 /* 218 Permission permission = new Permission(); 219 //permission.Id = PermissiveSecurityAction.Add_Job; 220 permission.Name = "ADD_JOB"; 221 permission.Description = "Add new jobs"; 222 permission.Plugin = "HeuristicLab.Hive.Server"; 223 manager.AddPermission(permission); 224 */ 225 //grant permission to random users 226 Random rand = new Random(DateTime.Now.Millisecond); 227 for (int i = 0; i < users.Count/2; i++) { 228 int idx = rand.Next(users.Count); 229 //manager.GrantPermission(users[i].Id, permission.Id, Guid.Empty); 230 manager.GrantPermission(users[i].Id, PermissiveSecurityAction.Add_Job, Guid.Empty); 231 } 232 } 233 234 #endregion 169 170 171 public void InsertClientUser() { 172 PermissionCollection pc = HivePermissions.GetPermissions(); 173 Debug.WriteLine("Revoke permissions...."); 174 try { 175 UserGroup group = manager.GetUserGroupByName("Projektmitglieder"); 176 manager.RevokePermission(group.Id, pc[pc.Convert(HivePermissions.Usermanagement.Client.Read)].Id, Guid.Empty); 177 manager.RevokePermission(group.Id, pc[pc.Convert(HivePermissions.Usermanagement.ClientGroup.Read)].Id, Guid.Empty); 178 } 179 catch (Exception ex) { 180 Debug.WriteLine(ex.Message); 181 } 182 Debug.WriteLine("Remove user..."); 183 try { 184 manager.RemoveUser(manager.GetUserByName("HIVE User").Id); 185 } 186 catch (Exception ex) { 187 Debug.WriteLine(ex.Message); 188 } 189 Debug.WriteLine("Remove group...."); 190 try { 191 manager.RemoveUserGroup(manager.GetUserGroupByName("Projektmitglieder").Id); 192 } 193 catch (Exception ex) { 194 Debug.WriteLine(ex.Message); 195 } 196 197 User user = new User(); 198 user.Login = "hive"; 199 user.SetHashedPassword("hive"); 200 user.Name = "HIVE User"; 201 Debug.WriteLine("Adding user..."); 202 try { 203 user = manager.AddNewUser(user); 204 } 205 catch (Exception ex) { 206 Debug.WriteLine(ex.Message); 207 } 208 209 UserGroup grp = new UserGroup(); 210 grp.Name = "Projektmitglieder"; 211 grp.Members.Add(user); 212 Debug.WriteLine("Adding group..."); 213 try { 214 manager.AddNewUserGroup(grp); 215 } 216 catch (Exception ex) { 217 Debug.WriteLine(ex.Message); 218 } 219 Debug.WriteLine("Grant permissions..."); 220 try { 221 manager.GrantPermission(grp.Id, pc[pc.Convert(HivePermissions.Usermanagement.Client.Read)].Id, Guid.Empty); 222 manager.GrantPermission(grp.Id, pc[pc.Convert(HivePermissions.Usermanagement.ClientGroup.Read)].Id, Guid.Empty); 223 } 224 catch (Exception ex) { 225 Debug.WriteLine(ex.Message); 226 } 227 } 228 229 public void InsertSuperUser() { 230 Debug.WriteLine("Revoke permissions..."); 231 try { 232 UserGroup group = manager.GetUserGroupByName("Administratoren"); 233 foreach (Permission item in HivePermissions.GetPermissions()) { 234 manager.RevokePermission(group.Id, item.Id, Guid.Empty); 235 } 236 } 237 catch (Exception ex) { 238 Debug.WriteLine(ex.Message); 239 } 240 Debug.WriteLine("Revoke permissions from admin..."); 241 try { 242 Guid g = manager.GetUserByName("HIVE Admin").Id; 243 foreach (Permission item in HivePermissions.GetPermissions()) { 244 manager.RevokePermission(g, item.Id, Guid.Empty); 245 } 246 } 247 catch (Exception ex) { 248 Debug.WriteLine(ex.Message); 249 } 250 Debug.WriteLine("Removing user..."); 251 try { 252 manager.RemoveUser(manager.GetUserByName("HIVE Admin").Id); 253 } 254 catch (Exception ex) { 255 Debug.WriteLine(ex.Message); 256 } 257 Debug.WriteLine("Removing group..."); 258 try { 259 manager.RemoveUserGroup(manager.GetUserGroupByName("Administratoren").Id); 260 } 261 catch (Exception ex) { 262 Debug.WriteLine(ex.Message); 263 } 264 265 User user = new User(); 266 user.Login = "admin"; 267 user.SetHashedPassword("admin"); 268 user.Name = "HIVE Admin"; 269 Debug.WriteLine("Grant ALL permissions to admin..."); 270 foreach (Permission item in HivePermissions.GetPermissions()) { 271 manager.GrantPermission(user.Id, item.Id, Guid.Empty); 272 } 273 Debug.WriteLine("Adding user..."); 274 try { 275 user = manager.AddNewUser(user); 276 } 277 catch (Exception ex) { 278 Debug.WriteLine(ex.Message); 279 } 280 281 UserGroup grp = new UserGroup(); 282 grp.Name = "Administratoren"; 283 grp.Members.Add(user); 284 Debug.WriteLine("Adding group..."); 285 try { 286 manager.AddNewUserGroup(grp); 287 } 288 catch (Exception ex) { 289 Debug.WriteLine(ex.Message); 290 } 291 Debug.WriteLine("Adding permissions..."); 292 //admins allowed to do everything ;) 293 foreach (Permission item in HivePermissions.GetPermissions()) { 294 manager.GrantPermission(grp.Id, item.Id, Guid.Empty); 295 } 296 } 297 298 public void InsertHivePermissions() { 299 foreach (Permission item in HivePermissions.GetPermissions()) { 300 try { 301 manager.AddPermission(item); 302 } 303 catch (Exception ex) { 304 Debug.WriteLine(ex.Message); 305 } 306 } 307 } 308 235 309 public override void Run() { 236 310 //testPermissionsGroup(); 237 InsertTestDataForPermissionCheck(); 311 312 InsertHivePermissions(); 313 InsertClientUser(); 314 InsertSuperUser(); 315 Debug.WriteLine("Complete!"); 238 316 } 239 317 }
Note: See TracChangeset
for help on using the changeset viewer.