Index: /trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/ManyToManyRelationHelper.cs
===================================================================
--- /trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/ManyToManyRelationHelper.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/ManyToManyRelationHelper.cs	(revision 1729)
@@ -23,14 +23,14 @@
 
     public void UpdateRelationships(Guid objectA,
-      IList<Guid> relationships) {
-      UpdateRelationships(objectA, relationships, null);
+      IList<Guid> relationships, int childIndex) {
+      UpdateRelationships(objectA, relationships, null, childIndex);
     }
 
     public void UpdateRelationships(Guid objectA, 
       IList<Guid> relationships,
-      IList<object> additionalAttributes) {
+      IList<object> additionalAttributes, int childIndex) {
       //firstly check for created references
       IList<Guid> existing =
-        this.GetRelationships(objectA); 
+        this.GetRelationships(objectA, childIndex); 
 
       foreach (Guid relationship in relationships) {
@@ -63,5 +63,5 @@
       foreach (Guid relationship in deleted) {
         RowT toDelete =
-          FindRow(objectA, relationship);
+          FindRow(objectA, relationship, childIndex);
         if (toDelete != null) {
           toDelete.Delete();
@@ -71,5 +71,5 @@
     }
 
-    public IList<Guid> GetRelationships(Guid objectA) {
+    public IList<Guid> GetRelationships(Guid objectA, int childIndex) {
       IList<Guid> result =
         new List<Guid>();
@@ -79,5 +79,5 @@
 
       foreach(RowT row in rows) {
-        result.Add((Guid)row[1]);
+        result.Add((Guid)row[childIndex]);
       }
 
@@ -85,5 +85,5 @@
     }
 
-    private RowT FindRow(Guid objectA, Guid objectB) {
+    private RowT FindRow(Guid objectA, Guid objectB, int childIndex) {
       IEnumerable<RowT> rows =
        tableAdapterWrapper.FindById(objectA);
@@ -92,5 +92,5 @@
 
       foreach (RowT row in rows) {
-        if (row[1].Equals(objectB)) {
+        if (row[childIndex].Equals(objectB)) {
           found = row;
           break;
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientGroupAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientGroupAdapter.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientGroupAdapter.cs	(revision 1729)
@@ -86,5 +86,5 @@
 
         ICollection<Guid> resources =
-          ManyToManyRelationHelper.GetRelationships(clientGroup.Id);
+          ManyToManyRelationHelper.GetRelationships(clientGroup.Id, 1);
 
         clientGroup.Resources.Clear();
@@ -127,5 +127,5 @@
 
         ManyToManyRelationHelper.UpdateRelationships(group.Id,
-          relationships);
+          relationships, 1);
       }
     }
@@ -151,5 +151,5 @@
         //delete all relationships
         ManyToManyRelationHelper.UpdateRelationships(group.Id,
-          new List<Guid>());
+          new List<Guid>(), 1);
 
         return base.doDelete(group) && 
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobAdapter.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobAdapter.cs	(revision 1729)
@@ -164,5 +164,5 @@
 
         ICollection<Guid> requiredPlugins =
-          ManyToManyRelationHelper.GetRelationships(job.Id);
+          ManyToManyRelationHelper.GetRelationships(job.Id, 1);
         
         job.PluginsNeeded.Clear();
@@ -321,5 +321,5 @@
 
       ManyToManyRelationHelper.UpdateRelationships(
-        obj.Id, relationships);
+        obj.Id, relationships, 1);
     }
 
@@ -340,5 +340,5 @@
           //delete all relationships
           ManyToManyRelationHelper.UpdateRelationships(job.Id,
-            new List<Guid>());
+            new List<Guid>(), 1);
 
           //delete orphaned pluginInfos
Index: /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/HLUserAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/HLUserAdapter.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/HLUserAdapter.cs	(revision 1729)
@@ -33,4 +33,7 @@
       if (user != null && row != null) {
         row.PermissionOwnerId = user.Id;
+        row.Login = user.Login;
+        row.MailAddress = user.MailAddress;
+        row.Password = user.Password;
 
         return row;
@@ -99,8 +102,18 @@
         PermOwnerAdapter.GetByName(name);
 
-      return GetById(permOwner.Id);
+      if (permOwner != null)
+        return GetById(permOwner.Id);
+      else
+        return null;
+    }
+
+    public User GetByLogin(string login) {
+      return base.FindSingle(
+        delegate() {
+          return Adapter.GetDataByLogin(login);
+        });
     }
 
     #endregion
+  }
 }
-}
Index: /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/HeuristicLab.Security.ADODataAccess-3.2.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/HeuristicLab.Security.ADODataAccess-3.2.csproj	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/HeuristicLab.Security.ADODataAccess-3.2.csproj	(revision 1729)
@@ -74,4 +74,8 @@
   <ItemGroup>
     <Compile Include="ADODataAccessPlugin.cs" />
+    <Compile Include="dsSecurity.cs">
+      <DependentUpon>dsSecurity.xsd</DependentUpon>
+      <SubType>Component</SubType>
+    </Compile>
     <Compile Include="TableAdapterWrapper\GrantedPermissionsAdapterWrapper.cs" />
     <Compile Include="TableAdapterWrapper\PermissionOwner_UserGroupAdapterWrapper.cs" />
Index: /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/PermissionAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/PermissionAdapter.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/PermissionAdapter.cs	(revision 1729)
@@ -36,5 +36,5 @@
       get {
         if (userGroupAdapter == null)
-          this.Session.GetDataAdapter<UserGroup, IUserGroupAdapter>();
+          userGroupAdapter = this.Session.GetDataAdapter<UserGroup, IUserGroupAdapter>();
 
         return userGroupAdapter;
@@ -101,5 +101,5 @@
       } else {
         ICollection<UserGroup> groups =
-          UserGroupAdapter.MemberOf(permissionId);
+          UserGroupAdapter.MemberOf(permissionOwnerId);
 
         GrantedPermission perm = null;
@@ -119,5 +119,6 @@
 
     public bool grantPermission(Guid permissionOwnerId, Guid permissionId, Guid entityId) {
-      if (getPermission(permissionOwnerId, permissionId, entityId) == null) {
+      if (GrantedPermissionsAdapter.FindByPermissionPermissionOwnerEntityId(
+        permissionId, permissionOwnerId, entityId) == null) {
         GrantedPermission perm = new GrantedPermission();
         perm.PermissionId = permissionId;
Index: /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/TableAdapterWrapper/GrantedPermissionsAdapterWrapper.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/TableAdapterWrapper/GrantedPermissionsAdapterWrapper.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/TableAdapterWrapper/GrantedPermissionsAdapterWrapper.cs	(revision 1729)
@@ -29,4 +29,5 @@
 
       data.AddGrantedPermissionsRow(row);
+      TransactionalAdapter.Update(row);
 
       return row;
@@ -59,6 +60,6 @@
           permissionId, permissionOwnerId, entityId);
 
-      if(result.Count() == 1)
-        return result.GetEnumerator().Current;
+      if (result.Count() == 1)
+        return result.First();
       else
         return null;
Index: /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/UserGroupAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/UserGroupAdapter.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/UserGroupAdapter.cs	(revision 1729)
@@ -67,5 +67,5 @@
 
         ICollection<Guid> permissionOwners =
-          ManyToManyRelationHelper.GetRelationships(group.Id);
+          ManyToManyRelationHelper.GetRelationships(group.Id, 0);
 
         group.Members.Clear();
@@ -100,5 +100,5 @@
 
         ManyToManyRelationHelper.UpdateRelationships(group.Id,
-          relationships);
+          relationships, 0);
       }
     }
@@ -108,5 +108,5 @@
         //delete all relationships
         ManyToManyRelationHelper.UpdateRelationships(group.Id,
-          new List<Guid>());
+          new List<Guid>(), 0);
 
         return base.doDelete(group) &&
@@ -122,5 +122,8 @@
         PermOwnerAdapter.GetByName(name);
 
-      return GetById(permOwner.Id);
+      if (permOwner != null)
+        return GetById(permOwner.Id);
+      else
+        return null;
     }
 
Index: /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.Designer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.Designer.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.Designer.cs	(revision 1729)
@@ -3587,5 +3587,5 @@
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
         private void InitCommandCollection() {
-            this._commandCollection = new global::System.Data.SqlClient.SqlCommand[2];
+            this._commandCollection = new global::System.Data.SqlClient.SqlCommand[3];
             this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
             this._commandCollection[0].Connection = this.Connection;
@@ -3597,4 +3597,9 @@
             this._commandCollection[1].CommandType = global::System.Data.CommandType.Text;
             this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Id", global::System.Data.SqlDbType.UniqueIdentifier, 16, global::System.Data.ParameterDirection.Input, 0, 0, "PermissionOwnerId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+            this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand();
+            this._commandCollection[2].Connection = this.Connection;
+            this._commandCollection[2].CommandText = "SELECT * FROM HLUser WHERE Login = @Login";
+            this._commandCollection[2].CommandType = global::System.Data.CommandType.Text;
+            this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Login", global::System.Data.SqlDbType.VarChar, 2147483647, global::System.Data.ParameterDirection.Input, 0, 0, "Login", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
         }
         
@@ -3640,4 +3645,38 @@
             this.Adapter.SelectCommand = this.CommandCollection[1];
             this.Adapter.SelectCommand.Parameters[0].Value = ((System.Guid)(Id));
+            dsSecurity.HLUserDataTable dataTable = new dsSecurity.HLUserDataTable();
+            this.Adapter.Fill(dataTable);
+            return dataTable;
+        }
+        
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
+        [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, false)]
+        public virtual int FillByLogin(dsSecurity.HLUserDataTable dataTable, string Login) {
+            this.Adapter.SelectCommand = this.CommandCollection[2];
+            if ((Login == null)) {
+                this.Adapter.SelectCommand.Parameters[0].Value = global::System.DBNull.Value;
+            }
+            else {
+                this.Adapter.SelectCommand.Parameters[0].Value = ((string)(Login));
+            }
+            if ((this.ClearBeforeFill == true)) {
+                dataTable.Clear();
+            }
+            int returnValue = this.Adapter.Fill(dataTable);
+            return returnValue;
+        }
+        
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
+        [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
+        public virtual dsSecurity.HLUserDataTable GetDataByLogin(string Login) {
+            this.Adapter.SelectCommand = this.CommandCollection[2];
+            if ((Login == null)) {
+                this.Adapter.SelectCommand.Parameters[0].Value = global::System.DBNull.Value;
+            }
+            else {
+                this.Adapter.SelectCommand.Parameters[0].Value = ((string)(Login));
+            }
             dsSecurity.HLUserDataTable dataTable = new dsSecurity.HLUserDataTable();
             this.Adapter.Fill(dataTable);
@@ -4284,7 +4323,8 @@
             this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
             this._commandCollection[1].Connection = this.Connection;
-            this._commandCollection[1].CommandText = "SELECT * FROM PermissionOwner WHERE (Id = @Id)";
+            this._commandCollection[1].CommandText = "SELECT Name, PermissionOwnerId FROM PermissionOwner WHERE (PermissionOwnerId = @I" +
+                "d)";
             this._commandCollection[1].CommandType = global::System.Data.CommandType.Text;
-            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Id", global::System.Data.SqlDbType.Variant, 1024, global::System.Data.ParameterDirection.Input, 0, 0, "", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Id", global::System.Data.SqlDbType.UniqueIdentifier, 16, global::System.Data.ParameterDirection.Input, 0, 0, "PermissionOwnerId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
             this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand();
             this._commandCollection[2].Connection = this.Connection;
@@ -4319,12 +4359,7 @@
         [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
         [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, false)]
-        public virtual int FillById(dsSecurity.PermissionOwnerDataTable dataTable, object Id) {
+        public virtual int FillById(dsSecurity.PermissionOwnerDataTable dataTable, System.Guid Id) {
             this.Adapter.SelectCommand = this.CommandCollection[1];
-            if ((Id == null)) {
-                throw new global::System.ArgumentNullException("Id");
-            }
-            else {
-                this.Adapter.SelectCommand.Parameters[0].Value = ((object)(Id));
-            }
+            this.Adapter.SelectCommand.Parameters[0].Value = ((System.Guid)(Id));
             if ((this.ClearBeforeFill == true)) {
                 dataTable.Clear();
@@ -4337,12 +4372,7 @@
         [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
         [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
-        public virtual dsSecurity.PermissionOwnerDataTable GetDataById(object Id) {
+        public virtual dsSecurity.PermissionOwnerDataTable GetDataById(System.Guid Id) {
             this.Adapter.SelectCommand = this.CommandCollection[1];
-            if ((Id == null)) {
-                throw new global::System.ArgumentNullException("Id");
-            }
-            else {
-                this.Adapter.SelectCommand.Parameters[0].Value = ((object)(Id));
-            }
+            this.Adapter.SelectCommand.Parameters[0].Value = ((System.Guid)(Id));
             dsSecurity.PermissionOwnerDataTable dataTable = new dsSecurity.PermissionOwnerDataTable();
             this.Adapter.Fill(dataTable);
@@ -4613,25 +4643,25 @@
             this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand();
             this._adapter.DeleteCommand.Connection = this.Connection;
-            this._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[PermissionOwner_UserGroup] WHERE (([PermissionOwnerId] = @Orig" +
-                "inal_PermissionOwnerId) AND ([UserGroupId] = @Original_UserGroupId))";
+            this._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[PermissionOwner_UserGroup] WHERE (([UserGroupId] = @Original_U" +
+                "serGroupId) AND ([PermissionOwnerId] = @Original_PermissionOwnerId))";
             this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text;
+            this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UserGroupId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UserGroupId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
             this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_PermissionOwnerId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "PermissionOwnerId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
-            this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UserGroupId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UserGroupId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
             this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand();
             this._adapter.InsertCommand.Connection = this.Connection;
-            this._adapter.InsertCommand.CommandText = @"INSERT INTO [dbo].[PermissionOwner_UserGroup] ([PermissionOwnerId], [UserGroupId]) VALUES (@PermissionOwnerId, @UserGroupId);
-SELECT PermissionOwnerId, UserGroupId FROM PermissionOwner_UserGroup WHERE (PermissionOwnerId = @PermissionOwnerId) AND (UserGroupId = @UserGroupId)";
+            this._adapter.InsertCommand.CommandText = @"INSERT INTO [dbo].[PermissionOwner_UserGroup] ([UserGroupId], [PermissionOwnerId]) VALUES (@UserGroupId, @PermissionOwnerId);
+SELECT UserGroupId, PermissionOwnerId FROM PermissionOwner_UserGroup WHERE (PermissionOwnerId = @PermissionOwnerId) AND (UserGroupId = @UserGroupId)";
             this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text;
+            this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UserGroupId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UserGroupId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
             this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@PermissionOwnerId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "PermissionOwnerId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
-            this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UserGroupId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UserGroupId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
             this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand();
             this._adapter.UpdateCommand.Connection = this.Connection;
-            this._adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[PermissionOwner_UserGroup] SET [PermissionOwnerId] = @PermissionOwnerId, [UserGroupId] = @UserGroupId WHERE (([PermissionOwnerId] = @Original_PermissionOwnerId) AND ([UserGroupId] = @Original_UserGroupId));
-SELECT PermissionOwnerId, UserGroupId FROM PermissionOwner_UserGroup WHERE (PermissionOwnerId = @PermissionOwnerId) AND (UserGroupId = @UserGroupId)";
+            this._adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[PermissionOwner_UserGroup] SET [UserGroupId] = @UserGroupId, [PermissionOwnerId] = @PermissionOwnerId WHERE (([UserGroupId] = @Original_UserGroupId) AND ([PermissionOwnerId] = @Original_PermissionOwnerId));
+SELECT UserGroupId, PermissionOwnerId FROM PermissionOwner_UserGroup WHERE (PermissionOwnerId = @PermissionOwnerId) AND (UserGroupId = @UserGroupId)";
             this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text;
+            this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UserGroupId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UserGroupId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
             this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@PermissionOwnerId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "PermissionOwnerId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
-            this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UserGroupId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UserGroupId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+            this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UserGroupId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UserGroupId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
             this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_PermissionOwnerId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "PermissionOwnerId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
-            this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UserGroupId", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UserGroupId", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
         }
         
@@ -4651,12 +4681,12 @@
             this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
             this._commandCollection[1].Connection = this.Connection;
-            this._commandCollection[1].CommandText = "SELECT * FROM dbo.PermissionOwner_UserGroup WHERE PermissionOwnerId = @Permission" +
-                "OwnerId ";
+            this._commandCollection[1].CommandText = "SELECT PermissionOwnerId, UserGroupId FROM PermissionOwner_UserGroup WHERE (Permi" +
+                "ssionOwnerId = @PermissionOwnerId)";
             this._commandCollection[1].CommandType = global::System.Data.CommandType.Text;
             this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@PermissionOwnerId", global::System.Data.SqlDbType.UniqueIdentifier, 16, global::System.Data.ParameterDirection.Input, 0, 0, "PermissionOwnerId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
             this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand();
             this._commandCollection[2].Connection = this.Connection;
-            this._commandCollection[2].CommandText = "SELECT * FROM dbo.PermissionOwner_UserGroup WHERE PermissionOwnerId = @Permission" +
-                "OwnerId AND UserGroupId = @UserGroupId";
+            this._commandCollection[2].CommandText = "SELECT PermissionOwnerId, UserGroupId FROM PermissionOwner_UserGroup WHERE (Permi" +
+                "ssionOwnerId = @PermissionOwnerId) AND (UserGroupId = @UserGroupId)";
             this._commandCollection[2].CommandType = global::System.Data.CommandType.Text;
             this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@PermissionOwnerId", global::System.Data.SqlDbType.UniqueIdentifier, 16, global::System.Data.ParameterDirection.Input, 0, 0, "PermissionOwnerId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
@@ -4664,5 +4694,6 @@
             this._commandCollection[3] = new global::System.Data.SqlClient.SqlCommand();
             this._commandCollection[3].Connection = this.Connection;
-            this._commandCollection[3].CommandText = "SELECT * FROM dbo.PermissionOwner_UserGroup WHERE UserGroupId = @UserGroupId";
+            this._commandCollection[3].CommandText = "SELECT PermissionOwnerId, UserGroupId FROM PermissionOwner_UserGroup WHERE (UserG" +
+                "roupId = @UserGroupId)";
             this._commandCollection[3].CommandType = global::System.Data.CommandType.Text;
             this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UserGroupId", global::System.Data.SqlDbType.UniqueIdentifier, 16, global::System.Data.ParameterDirection.Input, 0, 0, "UserGroupId", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
@@ -4793,7 +4824,7 @@
         [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
         [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)]
-        public virtual int Delete(System.Guid Original_PermissionOwnerId, System.Guid Original_UserGroupId) {
-            this.Adapter.DeleteCommand.Parameters[0].Value = ((System.Guid)(Original_PermissionOwnerId));
-            this.Adapter.DeleteCommand.Parameters[1].Value = ((System.Guid)(Original_UserGroupId));
+        public virtual int Delete(System.Guid Original_UserGroupId, System.Guid Original_PermissionOwnerId) {
+            this.Adapter.DeleteCommand.Parameters[0].Value = ((System.Guid)(Original_UserGroupId));
+            this.Adapter.DeleteCommand.Parameters[1].Value = ((System.Guid)(Original_PermissionOwnerId));
             global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
             if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open) 
@@ -4815,7 +4846,7 @@
         [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
         [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]
-        public virtual int Insert(System.Guid PermissionOwnerId, System.Guid UserGroupId) {
-            this.Adapter.InsertCommand.Parameters[0].Value = ((System.Guid)(PermissionOwnerId));
-            this.Adapter.InsertCommand.Parameters[1].Value = ((System.Guid)(UserGroupId));
+        public virtual int Insert(System.Guid UserGroupId, System.Guid PermissionOwnerId) {
+            this.Adapter.InsertCommand.Parameters[0].Value = ((System.Guid)(UserGroupId));
+            this.Adapter.InsertCommand.Parameters[1].Value = ((System.Guid)(PermissionOwnerId));
             global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
             if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) 
@@ -4837,9 +4868,9 @@
         [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
         [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
-        public virtual int Update(System.Guid PermissionOwnerId, System.Guid UserGroupId, System.Guid Original_PermissionOwnerId, System.Guid Original_UserGroupId) {
-            this.Adapter.UpdateCommand.Parameters[0].Value = ((System.Guid)(PermissionOwnerId));
-            this.Adapter.UpdateCommand.Parameters[1].Value = ((System.Guid)(UserGroupId));
-            this.Adapter.UpdateCommand.Parameters[2].Value = ((System.Guid)(Original_PermissionOwnerId));
-            this.Adapter.UpdateCommand.Parameters[3].Value = ((System.Guid)(Original_UserGroupId));
+        public virtual int Update(System.Guid UserGroupId, System.Guid PermissionOwnerId, System.Guid Original_UserGroupId, System.Guid Original_PermissionOwnerId) {
+            this.Adapter.UpdateCommand.Parameters[0].Value = ((System.Guid)(UserGroupId));
+            this.Adapter.UpdateCommand.Parameters[1].Value = ((System.Guid)(PermissionOwnerId));
+            this.Adapter.UpdateCommand.Parameters[2].Value = ((System.Guid)(Original_UserGroupId));
+            this.Adapter.UpdateCommand.Parameters[3].Value = ((System.Guid)(Original_PermissionOwnerId));
             global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
             if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open) 
@@ -4861,6 +4892,6 @@
         [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
         [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
-        public virtual int Update(System.Guid Original_PermissionOwnerId, System.Guid Original_UserGroupId) {
-            return this.Update(Original_PermissionOwnerId, Original_UserGroupId, Original_PermissionOwnerId, Original_UserGroupId);
+        public virtual int Update(System.Guid Original_UserGroupId, System.Guid Original_PermissionOwnerId) {
+            return this.Update(Original_UserGroupId, Original_PermissionOwnerId, Original_UserGroupId, Original_PermissionOwnerId);
         }
     }
Index: /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.cs	(revision 1729)
+++ /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.cs	(revision 1729)
@@ -0,0 +1,8 @@
+﻿namespace HeuristicLab.Security.ADODataAccess {
+    
+    
+    public partial class dsSecurity {
+      partial class PermissionOwner_UserGroupDataTable {
+      }
+    }
+}
Index: /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.xsd
===================================================================
--- /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.xsd	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.xsd	(revision 1729)
@@ -229,4 +229,14 @@
                 </SelectCommand>
               </DbSource>
+              <DbSource ConnectionRef="HeuristicLab_SecurityConnectionString (Settings)" DbObjectName="[HeuristicLab.Security].dbo.HLUser" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="FillByLogin" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetDataByLogin" GeneratorSourceName="FillByLogin" GetMethodModifier="Public" GetMethodName="GetDataByLogin" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataByLogin" UserSourceName="FillByLogin">
+                <SelectCommand>
+                  <DbCommand CommandType="Text" ModifiedByUser="true">
+                    <CommandText>SELECT * FROM HLUser WHERE Login = @Login</CommandText>
+                    <Parameters>
+                      <Parameter AllowDbNull="true" AutogeneratedName="Login" ColumnName="Login" DataSourceName="[HeuristicLab.Security].dbo.HLUser" DataTypeServer="varchar(MAX)" DbType="AnsiString" Direction="Input" ParameterName="@Login" Precision="0" ProviderType="VarChar" Scale="0" Size="2147483647" SourceColumn="Login" SourceColumnNullMapping="false" SourceVersion="Current" />
+                    </Parameters>
+                  </DbCommand>
+                </SelectCommand>
+              </DbSource>
             </Sources>
           </TableAdapter>
@@ -342,7 +352,7 @@
                 <SelectCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="true">
-                    <CommandText>SELECT * FROM PermissionOwner WHERE (Id = @Id)</CommandText>
-                    <Parameters>
-                      <Parameter AllowDbNull="false" AutogeneratedName="Id" ColumnName="" DataSourceName="" DataTypeServer="unknown" DbType="Object" Direction="Input" ParameterName="@Id" Precision="0" Scale="0" Size="1024" SourceColumn="" SourceColumnNullMapping="false" SourceVersion="Current" />
+                    <CommandText>SELECT Name, PermissionOwnerId FROM PermissionOwner WHERE (PermissionOwnerId = @Id)</CommandText>
+                    <Parameters>
+                      <Parameter AllowDbNull="false" AutogeneratedName="Id" ColumnName="PermissionOwnerId" DataSourceName="[HeuristicLab.Security].dbo.PermissionOwner" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@Id" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Current" />
                     </Parameters>
                   </DbCommand>
@@ -366,8 +376,8 @@
                 <DeleteCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="false">
-                    <CommandText>DELETE FROM [dbo].[PermissionOwner_UserGroup] WHERE (([PermissionOwnerId] = @Original_PermissionOwnerId) AND ([UserGroupId] = @Original_UserGroupId))</CommandText>
-                    <Parameters>
-                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_PermissionOwnerId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Original" />
+                    <CommandText>DELETE FROM [dbo].[PermissionOwner_UserGroup] WHERE (([UserGroupId] = @Original_UserGroupId) AND ([PermissionOwnerId] = @Original_PermissionOwnerId))</CommandText>
+                    <Parameters>
                       <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_UserGroupId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="UserGroupId" SourceColumnNullMapping="false" SourceVersion="Original" />
+                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_PermissionOwnerId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Original" />
                     </Parameters>
                   </DbCommand>
@@ -375,9 +385,9 @@
                 <InsertCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="false">
-                    <CommandText>INSERT INTO [dbo].[PermissionOwner_UserGroup] ([PermissionOwnerId], [UserGroupId]) VALUES (@PermissionOwnerId, @UserGroupId);
-SELECT PermissionOwnerId, UserGroupId FROM PermissionOwner_UserGroup WHERE (PermissionOwnerId = @PermissionOwnerId) AND (UserGroupId = @UserGroupId)</CommandText>
-                    <Parameters>
-                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@PermissionOwnerId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Current" />
+                    <CommandText>INSERT INTO [dbo].[PermissionOwner_UserGroup] ([UserGroupId], [PermissionOwnerId]) VALUES (@UserGroupId, @PermissionOwnerId);
+SELECT UserGroupId, PermissionOwnerId FROM PermissionOwner_UserGroup WHERE (PermissionOwnerId = @PermissionOwnerId) AND (UserGroupId = @UserGroupId)</CommandText>
+                    <Parameters>
                       <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@UserGroupId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="UserGroupId" SourceColumnNullMapping="false" SourceVersion="Current" />
+                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@PermissionOwnerId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Current" />
                     </Parameters>
                   </DbCommand>
@@ -391,11 +401,11 @@
                 <UpdateCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="false">
-                    <CommandText>UPDATE [dbo].[PermissionOwner_UserGroup] SET [PermissionOwnerId] = @PermissionOwnerId, [UserGroupId] = @UserGroupId WHERE (([PermissionOwnerId] = @Original_PermissionOwnerId) AND ([UserGroupId] = @Original_UserGroupId));
-SELECT PermissionOwnerId, UserGroupId FROM PermissionOwner_UserGroup WHERE (PermissionOwnerId = @PermissionOwnerId) AND (UserGroupId = @UserGroupId)</CommandText>
-                    <Parameters>
-                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@PermissionOwnerId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Current" />
+                    <CommandText>UPDATE [dbo].[PermissionOwner_UserGroup] SET [UserGroupId] = @UserGroupId, [PermissionOwnerId] = @PermissionOwnerId WHERE (([UserGroupId] = @Original_UserGroupId) AND ([PermissionOwnerId] = @Original_PermissionOwnerId));
+SELECT UserGroupId, PermissionOwnerId FROM PermissionOwner_UserGroup WHERE (PermissionOwnerId = @PermissionOwnerId) AND (UserGroupId = @UserGroupId)</CommandText>
+                    <Parameters>
                       <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@UserGroupId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="UserGroupId" SourceColumnNullMapping="false" SourceVersion="Current" />
-                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_PermissionOwnerId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Original" />
+                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@PermissionOwnerId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Current" />
                       <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_UserGroupId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="UserGroupId" SourceColumnNullMapping="false" SourceVersion="Original" />
+                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="Input" ParameterName="@Original_PermissionOwnerId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="0" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Original" />
                     </Parameters>
                   </DbCommand>
@@ -411,5 +421,5 @@
                 <SelectCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="true">
-                    <CommandText>SELECT * FROM dbo.PermissionOwner_UserGroup WHERE PermissionOwnerId = @PermissionOwnerId </CommandText>
+                    <CommandText>SELECT PermissionOwnerId, UserGroupId FROM PermissionOwner_UserGroup WHERE (PermissionOwnerId = @PermissionOwnerId)</CommandText>
                     <Parameters>
                       <Parameter AllowDbNull="false" AutogeneratedName="PermissionOwnerId" ColumnName="PermissionOwnerId" DataSourceName="[HeuristicLab.Security].dbo.PermissionOwner_UserGroup" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@PermissionOwnerId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Current" />
@@ -421,5 +431,5 @@
                 <SelectCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="true">
-                    <CommandText>SELECT * FROM dbo.PermissionOwner_UserGroup WHERE PermissionOwnerId = @PermissionOwnerId AND UserGroupId = @UserGroupId</CommandText>
+                    <CommandText>SELECT PermissionOwnerId, UserGroupId FROM PermissionOwner_UserGroup WHERE (PermissionOwnerId = @PermissionOwnerId) AND (UserGroupId = @UserGroupId)</CommandText>
                     <Parameters>
                       <Parameter AllowDbNull="false" AutogeneratedName="PermissionOwnerId" ColumnName="PermissionOwnerId" DataSourceName="[HeuristicLab.Security].dbo.PermissionOwner_UserGroup" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@PermissionOwnerId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="PermissionOwnerId" SourceColumnNullMapping="false" SourceVersion="Current" />
@@ -432,5 +442,5 @@
                 <SelectCommand>
                   <DbCommand CommandType="Text" ModifiedByUser="true">
-                    <CommandText>SELECT * FROM dbo.PermissionOwner_UserGroup WHERE UserGroupId = @UserGroupId</CommandText>
+                    <CommandText>SELECT PermissionOwnerId, UserGroupId FROM PermissionOwner_UserGroup WHERE (UserGroupId = @UserGroupId)</CommandText>
                     <Parameters>
                       <Parameter AllowDbNull="false" AutogeneratedName="UserGroupId" ColumnName="UserGroupId" DataSourceName="[HeuristicLab.Security].dbo.PermissionOwner_UserGroup" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@UserGroupId" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="UserGroupId" SourceColumnNullMapping="false" SourceVersion="Current" />
Index: /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.xss
===================================================================
--- /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.xss	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/dsSecurity.xss	(revision 1729)
@@ -5,15 +5,15 @@
      the code is regenerated.
 </autogenerated>-->
-<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="306" ViewPortY="51" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
+<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="231" ViewPortY="64" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
   <Shapes>
     <Shape ID="DesignTable:GrantedPermissions" ZOrder="9" X="241" Y="438" Height="190" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="75" />
     <Shape ID="DesignTable:UserGroup" ZOrder="8" X="946" Y="238" Height="123" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="42" />
-    <Shape ID="DesignTable:HLUser" ZOrder="2" X="577" Y="484" Height="156" Width="182" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" />
-    <Shape ID="DesignTable:Permission" ZOrder="3" X="292" Y="192" Height="156" Width="204" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" />
-    <Shape ID="DesignTable:PermissionOwner" ZOrder="1" X="600" Y="61" Height="139" Width="242" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
-    <Shape ID="DesignTable:PermissionOwner_UserGroup" ZOrder="7" X="860" Y="455" Height="156" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
+    <Shape ID="DesignTable:HLUser" ZOrder="3" X="577" Y="484" Height="156" Width="182" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" />
+    <Shape ID="DesignTable:Permission" ZOrder="4" X="292" Y="192" Height="156" Width="204" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="92" />
+    <Shape ID="DesignTable:PermissionOwner" ZOrder="2" X="600" Y="61" Height="139" Width="242" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
+    <Shape ID="DesignTable:PermissionOwner_UserGroup" ZOrder="1" X="860" Y="455" Height="156" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="58" />
   </Shapes>
   <Connectors>
-    <Connector ID="DesignRelation:R_49" ZOrder="6" LineWidth="11">
+    <Connector ID="DesignRelation:R_49" ZOrder="7" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -43,5 +43,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:UserGroup_is_a_PermissionOwner" ZOrder="4" LineWidth="11">
+    <Connector ID="DesignRelation:UserGroup_is_a_PermissionOwner" ZOrder="5" LineWidth="11">
       <RoutePoints>
         <Point>
@@ -71,5 +71,5 @@
       </RoutePoints>
     </Connector>
-    <Connector ID="DesignRelation:R_44" ZOrder="5" LineWidth="11">
+    <Connector ID="DesignRelation:R_44" ZOrder="6" LineWidth="11">
       <RoutePoints>
         <Point>
Index: /trunk/sources/HeuristicLab.Security.Contracts/3.2/Interfaces/ISecurityManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.Contracts/3.2/Interfaces/ISecurityManager.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.Contracts/3.2/Interfaces/ISecurityManager.cs	(revision 1729)
@@ -9,4 +9,13 @@
   [ServiceContract]
   public interface ISecurityManager {
+
+    [OperationContract]
+    Permission AddPermission(Permission permission);
+
+    [OperationContract]
+    bool RemovePermission(Guid permissionId);
+
+    [OperationContract]
+    Permission UpdatePermission(Permission permission);
 
     [OperationContract]
Index: /trunk/sources/HeuristicLab.Security.Core/3.2/HeuristicLab.Security.Core-3.2.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Security.Core/3.2/HeuristicLab.Security.Core-3.2.csproj	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.Core/3.2/HeuristicLab.Security.Core-3.2.csproj	(revision 1729)
@@ -51,4 +51,5 @@
     <Compile Include="SecurityCorePlugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SecurityCoreTest.cs" />
     <Compile Include="SecurityManager.cs" />
     <Compile Include="ServiceLocator.cs" />
Index: /trunk/sources/HeuristicLab.Security.Core/3.2/PermissionManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.Core/3.2/PermissionManager.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.Core/3.2/PermissionManager.cs	(revision 1729)
@@ -35,5 +35,5 @@
 
         IUserAdapter userAdapter = session.GetDataAdapter<User, IUserAdapter>();
-        User user = userAdapter.GetByName(userName);
+        User user = userAdapter.GetByLogin(userName);
 
         if (user.Password.CompareTo(password) == 0) {
Index: /trunk/sources/HeuristicLab.Security.Core/3.2/SecurityCoreTest.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.Core/3.2/SecurityCoreTest.cs	(revision 1729)
+++ /trunk/sources/HeuristicLab.Security.Core/3.2/SecurityCoreTest.cs	(revision 1729)
@@ -0,0 +1,179 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Security.Contracts.BusinessObjects;
+
+namespace HeuristicLab.Security.Core {
+    [ClassInfo(Name = "Security Test App",
+        Description = "Test Application for the Security Service",
+        AutoRestart = true)]
+  class SecurityCoreTest : ApplicationBase {
+      private void testGroups() {
+        SecurityManager manager =
+          new SecurityManager();
+
+        User user = new User();
+        user.Login = "anna";
+        user.Password = "blubb";
+        user.Name = "Anna";
+        user = manager.AddNewUser(user);
+
+        User user2 = new User();
+        user2.Login = "stefan";
+        user2.Name = "Stefan";
+
+        UserGroup group = new UserGroup();
+        group.Name = "Students";
+
+        UserGroup group2 = new UserGroup();
+        group2.Name = "Lazy Students";
+
+        group.Members.Add(user);
+        group.Members.Add(group2);
+
+        group2.Members.Add(user2);
+
+        manager.AddNewUserGroup(group);
+
+        group = manager.GetUserGroupByName("Students");
+        group2 = manager.GetUserGroupByName("Lazy Students");
+
+        manager.RemoveUserGroup(group2.Id);
+
+        group = manager.GetUserGroupByName("Students");
+        group2 = manager.GetUserGroupByName("Lazy Students");
+
+        manager.RemoveUser(user.Id);
+
+        group = manager.GetUserGroupByName("Students");
+        manager.RemoveUserGroup(group.Id);
+
+        group = manager.GetUserGroupByName("Students");
+        manager.RemoveUser(user2.Id);
+      }
+
+      private void testPermissions() {
+        SecurityManager manager =
+           new SecurityManager();
+
+        PermissionManager permManager =
+          new PermissionManager();
+
+        Permission permission = new Permission();
+        permission.Name = "ADD_JOBS";
+        permission.Description = "Add jobs";
+        permission.Plugin = "TestPlugin";
+
+        manager.AddPermission(permission);
+
+        permission = manager.GetPermissionById(permission.Id);
+
+        User user = new User();
+        user.Login = "anna";
+        user.Password = "blubb";
+        user.Name = "Anna";
+        user = manager.AddNewUser(user);
+
+        manager.GrantPermission(user.Id, permission.Id, Guid.Empty);
+
+        Guid sessionId = permManager.Authenticate("anna", "blubb");
+
+        bool hasPermission = 
+          permManager.CheckPermission(sessionId, permission.Id, Guid.Empty);
+
+        manager.RevokePermission(user.Id, permission.Id, Guid.Empty);
+
+        hasPermission =
+          permManager.CheckPermission(sessionId, permission.Id, Guid.Empty);
+
+        permManager.EndSession(sessionId);
+
+        manager.RemoveUser(user.Id);
+
+        manager.RemovePermission(permission.Id);
+
+        permission = manager.GetPermissionById(permission.Id);
+      }
+
+      private void testPermissionsGroup() {
+        SecurityManager manager =
+          new SecurityManager();
+
+        PermissionManager permManager =
+          new PermissionManager();
+
+        User user = new User();
+        user.Login = "anna";
+        user.Password = "blubb";
+        user.Name = "Anna";
+        user = manager.AddNewUser(user);
+
+        User user2 = new User();
+        user2.Login = "stefan";
+        user2.Password = "foo";
+        user2.Name = "Stefan";
+
+        UserGroup group = new UserGroup();
+        group.Name = "Students";
+
+        UserGroup group2 = new UserGroup();
+        group2.Name = "Lazy Students";
+
+        group.Members.Add(user);
+        group.Members.Add(group2);
+
+        group2.Members.Add(user2);
+
+        manager.AddNewUserGroup(group);
+
+        Permission permission = new Permission();
+        permission.Name = "ADD_JOBS";
+        permission.Description = "Add jobs";
+        permission.Plugin = "TestPlugin";
+
+        manager.AddPermission(permission);
+
+        manager.GrantPermission(group.Id, permission.Id, Guid.Empty);
+        manager.GrantPermission(group2.Id, permission.Id, Guid.Empty);
+
+        Guid sessionId = permManager.Authenticate("anna", "blubb");
+
+        bool hasPermission =
+          permManager.CheckPermission(sessionId, permission.Id, Guid.Empty);
+
+        Guid sessionId2 = permManager.Authenticate("stefan", "foo");
+
+        hasPermission =
+          permManager.CheckPermission(sessionId2, permission.Id, Guid.Empty);
+
+        manager.RevokePermission(group.Id, permission.Id, Guid.Empty);
+
+        hasPermission =
+          permManager.CheckPermission(sessionId, permission.Id, Guid.Empty);
+
+        hasPermission =
+          permManager.CheckPermission(sessionId2, permission.Id, Guid.Empty);
+
+        manager.RevokePermission(group2.Id, permission.Id, Guid.Empty);
+
+        hasPermission =
+          permManager.CheckPermission(sessionId2, permission.Id, Guid.Empty);
+
+        permManager.EndSession(sessionId);
+        permManager.EndSession(sessionId2);
+
+        manager.RemoveUser(user.Id);
+        manager.RemoveUser(user2.Id);
+        manager.RemoveUserGroup(group.Id);
+        manager.RemoveUserGroup(group2.Id);
+
+        manager.RemovePermission(permission.Id);                        
+      }
+      
+      public override void Run() {
+        testPermissionsGroup();
+      }
+    }
+}
Index: /trunk/sources/HeuristicLab.Security.Core/3.2/SecurityManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.Core/3.2/SecurityManager.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.Core/3.2/SecurityManager.cs	(revision 1729)
@@ -353,5 +353,57 @@
       }
     }
- 
+
+    public Permission AddPermission(Permission permission) {
+      try {
+        session = factory.GetSessionForCurrentThread();
+        IPermissionAdapter permissionAdapter = session.GetDataAdapter<Permission, IPermissionAdapter>();
+
+        if (permission != null) {
+          permissionAdapter.Update(permission);
+
+          return permission;
+        } else
+          return null;
+      }
+      finally {
+        if (session != null)
+          session.EndSession();
+      }
+    }
+
+    public bool RemovePermission(Guid permissionId) {
+      try {
+        session = factory.GetSessionForCurrentThread();
+        IPermissionAdapter permissionAdapter = session.GetDataAdapter<Permission, IPermissionAdapter>();
+
+        Permission permission = permissionAdapter.GetById(permissionId);
+        if (permission != null)
+          return permissionAdapter.Delete(permission);
+        else
+          return false;
+      }
+      finally {
+        if (session != null)
+          session.EndSession();
+      }
+    }
+
+    public Permission UpdatePermission(Permission permission) {
+      try {
+        session = factory.GetSessionForCurrentThread();
+        IPermissionAdapter permissionAdapter = session.GetDataAdapter<Permission, IPermissionAdapter>();
+
+        if(permission != null) {
+          permissionAdapter.Update(permission);
+          return permission;
+        }
+        else
+          return null;
+      }
+      finally {
+        if (session != null)
+          session.EndSession();
+      }
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.Security.DataAccess/3.2/IUserAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Security.DataAccess/3.2/IUserAdapter.cs	(revision 1728)
+++ /trunk/sources/HeuristicLab.Security.DataAccess/3.2/IUserAdapter.cs	(revision 1729)
@@ -37,4 +37,11 @@
     /// <returns></returns>
     User GetByName(string name);
+
+    /// <summary>
+    /// Get the user with the specified name
+    /// </summary>
+    /// <param name="userId"></param>
+    /// <returns></returns>
+    User GetByLogin(string login);
   }
 }
