Method2Rights in RequirePermissionAttribute übertragen
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
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, UserRightType.EditAll });
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,40 +149,6 @@ namespace BeWo.Service.Security
|
||||
|
||||
}
|
||||
|
||||
var dict = Method2Rights.GetAuthorizedMethodDictionary();
|
||||
|
||||
if (dict.ContainsKey(methodName))
|
||||
{
|
||||
bool allowed = false;
|
||||
var minimumRechte = dict[methodName];
|
||||
|
||||
foreach (var right in minimumRechte)
|
||||
{
|
||||
if (rights.Contains(right))
|
||||
{
|
||||
allowed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return allowed;
|
||||
}
|
||||
//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;
|
||||
}
|
||||
|
||||
|
||||
@@ -472,7 +472,6 @@
|
||||
<Compile Include="Reporting\AnnualReportFactory.cs" />
|
||||
<Compile Include="SBD\VertretungsAlgorithmus.cs" />
|
||||
<Compile Include="SBD\VertretungsManager.cs" />
|
||||
<Compile Include="Security\Method2Rights.cs" />
|
||||
<Compile Include="Security\SecurityBehaviorExtension.cs" />
|
||||
<Compile Include="Security\SecurityEndpointBehavior.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@@ -5,6 +5,7 @@ using BeWo.Data.Entities;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Attributes;
|
||||
|
||||
namespace BeWo.Service.ServiceContracts
|
||||
{
|
||||
@@ -21,31 +22,38 @@ namespace BeWo.Service.ServiceContracts
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequirePermission(UserRightType.UserView_Delete)]
|
||||
void DeactivateUser(long pOid, long pVersion);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequirePermission(UserRightType.UserGroupView_Delete)]
|
||||
void DeactivateUserGroup(long pOid, long pVersion);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
void DeactivateUsers(Dictionary<long, long> pOid2Version);
|
||||
[RequirePermission(UserRightType.UserView_Delete)]
|
||||
void DeactivateUsers(Dictionary<long, long> pOid2Version);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
void DeleteUser(long pOid, long pVersion);
|
||||
[RequirePermission(UserRightType.UserView_Delete)]
|
||||
void DeleteUser(long pOid, long pVersion);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
void DeleteUserGroup(long pOid, long pVersion);
|
||||
[RequirePermission(UserRightType.UserGroupView_Delete)]
|
||||
void DeleteUserGroup(long pOid, long pVersion);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequirePermission(UserRightType.UserGroupView_Delete)]
|
||||
void DeleteUserGroups(Dictionary<long, long> pOid2Version);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
void DeleteUsers(Dictionary<long, long> pOid2Version);
|
||||
[RequirePermission(UserRightType.UserView_Delete)]
|
||||
void DeleteUsers(Dictionary<long, long> pOid2Version);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
@@ -69,10 +77,12 @@ namespace BeWo.Service.ServiceContracts
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
long InsertNewUser(UserDC pUser);
|
||||
[RequirePermission(UserRightType.UserGroupView_Create)]
|
||||
long InsertNewUser(UserDC pUser);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequirePermission(UserRightType.UserGroupView_Create)]
|
||||
long InsertNewUserGroup(UserGroupDC pUserGroup);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
@@ -105,6 +115,7 @@ namespace BeWo.Service.ServiceContracts
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequirePermission(UserRightType.UserGroupView_Edit, UserRightType.EditAll)]
|
||||
long UpdateUserGroup(UserGroupDC pUserGroup);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
|
||||
Reference in New Issue
Block a user