cb bugfixing v33

This commit is contained in:
Christian
2021-04-20 13:23:15 +02:00
parent cd84c70fbb
commit ebd0aabf9d
23 changed files with 358 additions and 151 deletions

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Windows;
using BeWo.Data;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BS.Shared;
using BS.Shared.DataContracts;
namespace BeWo.Service.Security
{
public class Method2Rights
{
public static Dictionary<String, IList<UserRightType>> GetAuthorizedMethodDictionary()
{
var dict = new Dictionary<String, IList<UserRightType>>();
dict.Add("DeleteUserGroups", new UserRightType[] { UserRightType.UserGroupView_Delete });
dict.Add("DeactivateUserGroup", new UserRightType[] { UserRightType.UserGroupView_Delete });
dict.Add("UpdateUserGroup", new UserRightType[] { UserRightType.UserGroupView_Edit });
dict.Add("InsertNewUserGroup", new UserRightType[] { UserRightType.UserGroupView_Create });
dict.Add("InsertNewUser", new UserRightType[] { UserRightType.UserView_Create });
dict.Add("DeactivateUser", new UserRightType[] { UserRightType.UserView_Delete });
dict.Add("DeactivateUsers", new UserRightType[] { UserRightType.UserView_Delete });
dict.Add("DeleteUsers", new UserRightType[] { UserRightType.UserView_Delete });
dict.Add("DeleteUser", new UserRightType[] { UserRightType.UserView_Delete });
dict.Add("UpdateUser", new UserRightType[] { UserRightType.UserView_Edit });
return dict;
}
}
}

View File

@@ -106,27 +106,37 @@ namespace BeWo.Service.Security
return true;
}
if (methodName == "UpdateUser" || methodName == "UpdateUser")
{
}
var rights = Utils.GetGrantedRights(lUser);
var dict = Right2Methods.GetAuthorizedMethodDictionary();
var dict = Method2Rights.GetAuthorizedMethodDictionary();
foreach (var right in rights)
if (dict.ContainsKey(methodName))
{
var benoetigteRechte = dict[methodName];
if (dict.ContainsKey(right))
foreach (var right in benoetigteRechte)
{
var names = dict[right];
if (names.Contains(methodName))
if (!rights.Contains(right))
{
return true;
return false;
}
return true;
}
}
//var dict = Right2Methods.GetAuthorizedMethodDictionary();
//foreach (var right in rights)
//{
// if (dict.ContainsKey(right))
// {
// var names = dict[right];
// if (names.Contains(methodName))
// {
// return true;
// }
// return true;
// }
//}
return true;
}