/// <summary> /// 删除权限节点 /// </summary> /// <param name="node">权限节点</param> private void DeleteAuthNode(TreeListNode node) { foreach (TreeListNode child in node.Nodes) { DeleteAuthNode(child); } AuthorizationNode authNode = node.Tag as AuthorizationNode; if (authNode != null) { try { AuthorizationNodeService.Delete(authNode); // 更新角色的授权信息 IList <AuthorizationStore> stores = AuthorizationStoreService.GetAll(); if (stores != null) { foreach (AuthorizationStore store in stores) { store.Remove(authNode); AuthorizationStoreService.SaveAuthorization(store); } } } catch { } } }
/// <summary> /// 更新角色的授权信息 /// </summary> /// <param name="authNode">The auth node.</param> private void UpdateRoleAuthorization(AuthorizationNode authNode) { Guard.ArgumentNotNull(authNode, "Authorization node"); IList <AuthorizationStore> stores = AuthorizationStoreService.GetAll(); if (stores != null) { foreach (AuthorizationStore store in stores) { store.Store(authNode); AuthorizationStoreService.SaveAuthorization(store); } } }