Index: /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectPermissionsView.cs
===================================================================
--- /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectPermissionsView.cs	(revision 15759)
+++ /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectPermissionsView.cs	(revision 15760)
@@ -81,4 +81,13 @@
       }
     }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      bool enabled = Content != null && !Locked && !ReadOnly;
+
+      inheritButton.Enabled = enabled;
+      saveButton.Enabled = enabled;
+      treeView.Enabled = enabled;
+    }
     #endregion
 
Index: /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectResourcesView.cs
===================================================================
--- /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectResourcesView.cs	(revision 15759)
+++ /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectResourcesView.cs	(revision 15760)
@@ -50,5 +50,4 @@
     private readonly Dictionary<Guid, HashSet<Resource>> resourceDescendants = new Dictionary<Guid, HashSet<Resource>>();
 
-    //private readonly Color addedAssignmentColor = Color.FromArgb(255, 0, 174, 179); // #00aeb3
     private readonly Color addedAssignmentColor = Color.FromArgb(255, 87, 191, 193); // #57bfc1
     private readonly Color removedAssignmentColor = Color.FromArgb(255, 236, 159, 72); // #ec9f48
@@ -84,8 +83,15 @@
         var top = BuildResourceTree(HiveAdminClient.Instance.Resources);
         detailsViewHost.Content = top;
-        detailsViewHost.ActiveView.Locked = true;
-      }
-    }
-
+      }
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      bool enabled = Content != null && !Locked && !ReadOnly;
+
+      inheritButton.Enabled = enabled;
+      saveButton.Enabled = enabled;
+      treeView.Enabled = enabled;
+    }
     #endregion
 
@@ -208,10 +214,10 @@
       var resources = HiveAdminClient.Instance.Resources;
 
-      foreach(var r in resources) {
+      foreach(var r in resources.Where(x => x.Id != Guid.Empty)) {
         resourceAncestors.Add(r.Id, new HashSet<Resource>());
         resourceDescendants.Add(r.Id, new HashSet<Resource>());
       }
 
-      foreach(var r in resources) { 
+      foreach(var r in resources.Where(x => x.Id != Guid.Empty)) { 
         var parentResourceId = r.ParentResourceId;
         while(parentResourceId != null) {
@@ -253,4 +259,5 @@
       treeView.AfterCheck -= treeView_AfterCheck;
 
+      resources = resources.Where(x => x.Id != Guid.Empty);
       var mainResources = new HashSet<Resource>(resources.OfType<SlaveGroup>().Where(x => x.ParentResourceId == null));
       var parentedMainResources = new HashSet<Resource>(resources.OfType<SlaveGroup>()
@@ -379,10 +386,10 @@
       var projects = HiveAdminClient.Instance.Projects;
 
-      foreach(var p in projects) {
+      foreach(var p in projects.Where(x => x.Id != Guid.Empty)) {
         projectAncestors.Add(p.Id, new HashSet<Project>());
         projectDescendants.Add(p.Id, new HashSet<Project>());
       }
 
-      foreach (var p in projects) {
+      foreach (var p in projects.Where(x => x.Id != Guid.Empty)) {
         var parentProjectId = p.ParentProjectId;
         while (parentProjectId != null) {
Index: /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs
===================================================================
--- /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs	(revision 15759)
+++ /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs	(revision 15760)
@@ -92,5 +92,5 @@
     protected override void SetEnabledStateOfControls() {
       base.SetEnabledStateOfControls();
-      bool enabled = Content != null && !ReadOnly;
+      bool enabled = Content != null && !Locked && !ReadOnly;
       nameTextBox.Enabled = enabled;
       descriptionTextBox.Enabled = enabled;
Index: /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
===================================================================
--- /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs	(revision 15759)
+++ /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs	(revision 15760)
@@ -97,4 +97,9 @@
         projectPermissionsView.Content = top;
         projectResourcesView.Content = top;
+
+        if(top != null && top.Id == Guid.Empty) {
+          projectPermissionsView.Locked = true;
+          projectResourcesView.Locked = true;
+        }
       }
     }
@@ -390,4 +395,5 @@
       var stack = new Stack<Project>(mainProjects.OrderByDescending(x => x.Name));
       if (selectedProject != null) selectedProject = projects.Where(x => x.Id == selectedProject.Id).FirstOrDefault();
+      bool nodeSelected = false;
 
       TreeNode currentNode = null;
@@ -406,7 +412,8 @@
           selectedProject = newProject;
         }
-        if (newProject.Id == selectedProject.Id) {
+        if (newProject.Id == selectedProject.Id && !nodeSelected) {
           newNode.BackColor = selectedColor;
           newNode.Text += " [selected]";
+          nodeSelected = true;
         }
 
Index: /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
===================================================================
--- /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs	(revision 15759)
+++ /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs	(revision 15760)
@@ -95,5 +95,14 @@
       } else {
         var top = BuildResourceTree(Content);
+        SetEnabledStateOfControlsForSelectedResource();
+
         viewHost.Content = top;
+        bool locked = !IsAdmin();
+        viewHost.Locked = locked;
+        scheduleView.Locked = locked;
+
+        if (top != null && top.Id == Guid.Empty) {
+          scheduleView.SetEnabledStateOfSchedule(false);
+        }
       }
     }
@@ -105,5 +114,5 @@
       btnRemoveGroup.Enabled = enabled;
       btnSave.Enabled = enabled;
-      scheduleView.SetEnabledStateOfSchedule(enabled && IsAdmin()); // IsAuthorized((Resource)viewHost.Content));
+      scheduleView.SetEnabledStateOfSchedule(enabled && IsAdmin());
     }
     #endregion
@@ -415,5 +424,5 @@
       var stack = new Stack<Resource>(mainResources.OrderByDescending(x => x.Name));
       if (selectedResource != null) selectedResource = resources.Where(x => x.Id == selectedResource.Id).FirstOrDefault();
-      //bool nodeSelected = false;
+      bool nodeSelected = false;
 
       TreeNode currentNode = null;
@@ -432,7 +441,8 @@
           selectedResource = newResource;
         }
-        if (newResource.Id == selectedResource.Id) {
+        if (newResource.Id == selectedResource.Id && !nodeSelected) {
           newNode.BackColor = selectedColor;
           newNode.Text += " [selected]";
+          nodeSelected = true;
         }
 
@@ -490,7 +500,8 @@
           slaveNode.Text += " [changes not stored]";
         }
-        if (slave.Id == selectedResource.Id) {
+        if (slave.Id == selectedResource.Id && !nodeSelected) {
           slaveNode.BackColor = selectedColor;
           slaveNode.Text += " [selected]";
+          nodeSelected = true;
         }
       }
Index: /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs
===================================================================
--- /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs	(revision 15759)
+++ /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs	(revision 15760)
@@ -234,5 +234,5 @@
         Invoke(new Action(() => SetEnabledStateOfSchedule(state)));
       } else {
-        if (Content == null) state = false;
+        if (Content == null || Locked || ReadOnly) state = false;
         groupBox1.Enabled = state;
         btnClearCal.Enabled = state;
Index: /branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/AssignedJobResourceDao.cs
===================================================================
--- /branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/AssignedJobResourceDao.cs	(revision 15759)
+++ /branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/AssignedJobResourceDao.cs	(revision 15760)
@@ -105,5 +105,5 @@
 		      SELECT j.JobId
 		      FROM [Job] j
-		      WHERE j.ProjectId = {0}
+		      WHERE j.ProjectId = '{0}'
           AND j.OwnerUserId IN ({1})
 	      )
Index: /branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/ProjectPermissionDao.cs
===================================================================
--- /branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/ProjectPermissionDao.cs	(revision 15759)
+++ /branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/ProjectPermissionDao.cs	(revision 15760)
@@ -74,5 +74,5 @@
     private const string DeleteByProjectIdAndGrantedUserIdsQueryString = @"
       DELETE FROM [ProjectPermission]
-      WHERE ProjectId = {0}
+      WHERE ProjectId = '{0}'
       AND GrantedUserId IN ({1});
     ";
Index: /branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs
===================================================================
--- /branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs	(revision 15759)
+++ /branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs	(revision 15760)
@@ -401,5 +401,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteOnNull=true)]
 		public Resource Resource
 		{
@@ -435,5 +435,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE")]
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteOnNull=true)]
 		public Project Project
 		{
@@ -2850,5 +2850,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_TaskData", Storage="_Job", ThisKey="TaskId", OtherKey="TaskId", IsForeignKey=true)]
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_TaskData", Storage="_Job", ThisKey="TaskId", OtherKey="TaskId", IsForeignKey=true, DeleteOnNull=true)]
 		public Task Task
 		{
@@ -3488,5 +3488,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperiment", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperiment", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true, DeleteOnNull=true)]
 		public Job Job
 		{
@@ -6108,5 +6108,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteOnNull=true)]
 		public Project Project
 		{
@@ -6242,5 +6242,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true)]
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteOnNull=true)]
 		public Resource Resource
 		{
@@ -6276,5 +6276,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true, DeleteOnNull=true)]
 		public Job Job
 		{
Index: /branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs
===================================================================
--- /branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs	(revision 15759)
+++ /branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs	(revision 15760)
@@ -880,29 +880,29 @@
     }
 
-    private void GrantProjectPermissions(Guid projectId, List<Guid> grantedUserIds, bool cascading) {
-      throw new NotImplementedException();
-    }
-
-    private void RevokeProjectPermissions(Guid projectId, List<Guid> grantedUserIds, bool cascading) {
-      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      if (projectId == null || grantedUserIds == null || !grantedUserIds.Any()) return;
-      AuthorizationManager.AuthorizeForProjectAdministration(projectId, false);
-      var pm = PersistenceManager;
-      using (new PerformanceLogger("RevokeProjectPermissions")) {
-        var projectPermissionDao = pm.ProjectPermissionDao;
-        var projectDao = pm.ProjectDao;
-        var assignedJobResourceDao = pm.AssignedJobResourceDao;
-        pm.UseTransaction(() => {
-          if (cascading) {
-            var childProjectIds = projectDao.GetChildProjectIdsById(projectId).ToList();
-            projectPermissionDao.DeleteByProjectIdsAndGrantedUserIds(childProjectIds, grantedUserIds);
-            assignedJobResourceDao.DeleteByProjectIdsAndUserIds(childProjectIds, grantedUserIds);
-          }
-          projectPermissionDao.DeleteByProjectIdAndGrantedUserIds(projectId, grantedUserIds);
-          assignedJobResourceDao.DeleteByProjectIdAndUserIds(projectId, grantedUserIds);
-          pm.SubmitChanges();
-        });
-      }
-    }
+    //private void GrantProjectPermissions(Guid projectId, List<Guid> grantedUserIds, bool cascading) {
+    //  throw new NotImplementedException();
+    //}
+
+    //private void RevokeProjectPermissions(Guid projectId, List<Guid> grantedUserIds, bool cascading) {
+    //  RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+    //  if (projectId == null || grantedUserIds == null || !grantedUserIds.Any()) return;
+    //  AuthorizationManager.AuthorizeForProjectAdministration(projectId, false);
+    //  var pm = PersistenceManager;
+    //  using (new PerformanceLogger("RevokeProjectPermissions")) {
+    //    var projectPermissionDao = pm.ProjectPermissionDao;
+    //    var projectDao = pm.ProjectDao;
+    //    var assignedJobResourceDao = pm.AssignedJobResourceDao;
+    //    pm.UseTransaction(() => {
+    //      if (cascading) {
+    //        var childProjectIds = projectDao.GetChildProjectIdsById(projectId).ToList();
+    //        projectPermissionDao.DeleteByProjectIdsAndGrantedUserIds(childProjectIds, grantedUserIds);
+    //        assignedJobResourceDao.DeleteByProjectIdsAndUserIds(childProjectIds, grantedUserIds);
+    //      }
+    //      projectPermissionDao.DeleteByProjectIdAndGrantedUserIds(projectId, grantedUserIds);
+    //      assignedJobResourceDao.DeleteByProjectIdAndUserIds(projectId, grantedUserIds);
+    //      pm.SubmitChanges();
+    //    });
+    //  }
+    //}
 
     public IEnumerable<DT.ProjectPermission> GetProjectPermissions(Guid projectId) {
@@ -1001,31 +1001,29 @@
     }
 
-    private void AssignProjectResources(Guid projectId, List<Guid> resourceIds, bool cascading) {
-      throw new NotImplementedException();
-    }
-
-    // basic: unassign resourceIds from project and depending jobs
-    // cascading: unassign resourceIds from all child-projects and their depending jobs
-    private void UnassignProjectResources(Guid projectId, List<Guid> resourceIds, bool cascading) {
-      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      if (projectId == null || resourceIds == null || !resourceIds.Any()) return;
-      AuthorizationManager.AuthorizeForProjectResourceAdministration(projectId, resourceIds);
-      var pm = PersistenceManager;
-      using (new PerformanceLogger("UnassignProjectResources")) {
-        var assignedProjectResourceDao = pm.AssignedProjectResourceDao;
-        var assignedJobResourceDao = pm.AssignedJobResourceDao;
-        var projectDao = pm.ProjectDao;
-        pm.UseTransaction(() => {
-          if (cascading) {
-            var childProjectIds = projectDao.GetChildProjectIdsById(projectId).ToList();
-            assignedProjectResourceDao.DeleteByProjectIdsAndResourceIds(childProjectIds, resourceIds);
-            assignedJobResourceDao.DeleteByProjectIdsAndResourceIds(childProjectIds, resourceIds);
-          }
-          assignedProjectResourceDao.DeleteByProjectIdAndResourceIds(projectId, resourceIds);
-          assignedJobResourceDao.DeleteByProjectIdAndResourceIds(projectId, resourceIds);
-          pm.SubmitChanges();
-        });
-      }
-    }
+    //private void AssignProjectResources(Guid projectId, List<Guid> resourceIds, bool cascading) {
+    //  throw new NotImplementedException();
+    //}
+
+    //private void UnassignProjectResources(Guid projectId, List<Guid> resourceIds, bool cascading) {
+    //  RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+    //  if (projectId == null || resourceIds == null || !resourceIds.Any()) return;
+    //  AuthorizationManager.AuthorizeForProjectResourceAdministration(projectId, resourceIds);
+    //  var pm = PersistenceManager;
+    //  using (new PerformanceLogger("UnassignProjectResources")) {
+    //    var assignedProjectResourceDao = pm.AssignedProjectResourceDao;
+    //    var assignedJobResourceDao = pm.AssignedJobResourceDao;
+    //    var projectDao = pm.ProjectDao;
+    //    pm.UseTransaction(() => {
+    //      if (cascading) {
+    //        var childProjectIds = projectDao.GetChildProjectIdsById(projectId).ToList();
+    //        assignedProjectResourceDao.DeleteByProjectIdsAndResourceIds(childProjectIds, resourceIds);
+    //        assignedJobResourceDao.DeleteByProjectIdsAndResourceIds(childProjectIds, resourceIds);
+    //      }
+    //      assignedProjectResourceDao.DeleteByProjectIdAndResourceIds(projectId, resourceIds);
+    //      assignedJobResourceDao.DeleteByProjectIdAndResourceIds(projectId, resourceIds);
+    //      pm.SubmitChanges();
+    //    });
+    //  }
+    //}
 
     public IEnumerable<DT.AssignedProjectResource> GetAssignedResourcesForProject(Guid projectId) {
