Changeset 16117 for trunk/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectPermissionsView.cs
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Clients.Hive.Administrator
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectPermissionsView.cs
r15760 r16117 53 53 private readonly Color addedIncludeColor = Color.FromArgb(25, 169, 221, 221); // #a9dddd 54 54 private readonly Color removedIncludeColor = Color.FromArgb(25, 249, 210, 145); // #f9d291 55 private readonly Color projectOwnerColor = Color.DarkRed; 55 56 56 57 public new Project Content { … … 116 117 var selectedPermission = (UserGroupBase)e.Node.Tag; 117 118 detailsViewHost.Content = selectedPermission; 119 if (selectedPermission is LightweightUser) 120 detailsViewHost.ViewType = typeof(Access.Views.RefreshableLightweightUserInformationView); 118 121 } 119 122 120 123 private void treeView_BeforeCheck(object sender, TreeViewCancelEventArgs e) { 121 124 var checkedPermission = (UserGroupBase)e.Node.Tag; 122 if (e.Node.Parent == null || newInheritedPermissions.Contains(checkedPermission) || checkedPermission.Id == Guid.Empty) e.Cancel = true; 125 if (e.Node.Parent == null 126 || newInheritedPermissions.Contains(checkedPermission) 127 || checkedPermission.Id == Guid.Empty 128 || Content.OwnerUserId == checkedPermission.Id) 129 e.Cancel = true; 123 130 } 124 131 … … 136 143 #region Helpers 137 144 private void UpdatePermissionList() { 145 AccessClient.Instance.Refresh(); 146 138 147 UpdateUserGroupGenealogy(); 139 148 UpdateAssignedPermissions(); … … 162 171 private void UpdateNewAssignedPermissions() { 163 172 for(int i = newAssignedPermissions.Count-1; i >= 0; i--) { 164 if(newAssignedPermissions.Intersect(userGroupAncestors[newAssignedPermissions.ElementAt(i).Id]).Any()) { 173 if(newAssignedPermissions.Intersect(userGroupAncestors[newAssignedPermissions.ElementAt(i).Id]).Any() 174 && newAssignedPermissions.ElementAt(i).Id != Content.OwnerUserId) { 165 175 newAssignedPermissions.Remove(newAssignedPermissions.ElementAt(i)); 166 176 } … … 174 184 if(userGroupDescendants.ContainsKey(item.Id)) { 175 185 foreach(var descendant in userGroupDescendants[item.Id]) { 176 inheritedPermissions.Add(descendant); 177 newInheritedPermissions.Add(descendant); 186 if(!assignedPermissions.Contains(descendant)) { 187 inheritedPermissions.Add(descendant); 188 newInheritedPermissions.Add(descendant); 189 } 178 190 } 179 191 } … … 186 198 if(userGroupDescendants.ContainsKey(item.Id)) { 187 199 foreach(var descendant in userGroupDescendants[item.Id]) { 188 newInheritedPermissions.Add(descendant); 200 if(!newAssignedPermissions.Contains(descendant)) 201 newInheritedPermissions.Add(descendant); 189 202 } 190 203 } … … 216 229 217 230 private static IEnumerable<UserGroupBase> GetGrantedPermissionsForProject(Guid projectId) { 231 if (projectId == Guid.Empty) return Enumerable.Empty<UserGroupBase>(); 218 232 var projectPermissions = HiveServiceLocator.Instance.CallHiveService(s => s.GetProjectPermissions(projectId)); 219 233 var userIds = new HashSet<Guid>(projectPermissions.Select(x => x.GrantedUserId)); … … 308 322 } 309 323 324 if(Content != null && ug != null && ug.Id != Guid.Empty 325 && Content.OwnerUserId == ug.Id) { 326 node.ForeColor = projectOwnerColor; 327 } 328 310 329 } 311 330
Note: See TracChangeset
for help on using the changeset viewer.