Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GenericPrincipal.cs « System.Security.Principal « corlib « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5fa85b9e72bc1155884f0f83ee39bae703fc3ea7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// System.Security.Principal.GenericPrincipal.cs
//
// Author:
//   Miguel de Icaza (miguel@ximian.com)
//
// (C) Ximian, Inc.  http://www.ximian.com
//

namespace System.Security.Principal {

	[Serializable]
	public class GenericPrincipal : IPrincipal {
		IIdentity identity;
		string [] roles;
		
		public GenericPrincipal (IIdentity identity, string [] roles)
		{
			this.identity = identity;
			this.roles = roles;
		}

		public virtual IIdentity Identity {
			get {
				return identity;
			}
		}

		public virtual bool IsInRole (string role)
		{
			foreach (string r in roles)
				if (role == r)
					return true;

			return false;
		}
	}
}