>Hi everybody,
>
>We have the following class:
>
>
> [Serializable]
> public class OperatorSession
> {
> public OperatorSession()
> {
> Rights = new string[0];
> Roles = new List<SecRole>();
> }
>
> public string OpCode { get; set; }'
> etc.
>
>
> public static bool IsAdmin(string opCode)
> {
> return !String.IsNullOrEmpty(opCode) && opCode.Trim().ToLower() == SysManagerConstants.ADMIN_OPCODE.ToLower();
> }
>
>
>The problem here is that IsAdmin definition changed. Now in addition of the opCode being some specific code this method should also return true when the operator has the following role X_SYSADMIN.
>
>I am not able to add a check for Rights.contains in the static method and so I'm at loss as how can I check what I need to check.
>
>My other problem is that OperatorSession class is defined in the Models project. This project only contains classes definitions and it doesn't reference anything else. There is another project called Data which has Models as a reference. So, from the OperatorSession I can not even access DbSet to try to get an instance of the operator by the code to check operator's roles.
>
>I also checked that we do use something like this in the code:
>
>return OperatorSession.IsAdmin(id) || rights.Contains("SEC_OEDIT");
>
>
>
>I guess I need to create a different non static method to check if operator is an admin.
>
>Thanks in advance.
Have not understood completely, but
(1) You can add the same method with a different signature if necessary
(2) Rights class can be a static property of OperatorSession class - if needed
(3) You can always instantiate an object in a static method
Gregory