DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
UserProtocolAccess.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 
19 namespace Deveel.Data.Security {
24  public sealed class UserProtocolAccess {
29  public const string AnyAddress = "%";
30 
41  public UserProtocolAccess(string userName, string protocol, AccessPrivilege privilege)
42  : this(userName, protocol, AnyAddress, privilege) {
43  }
55  public UserProtocolAccess(string userName, string protocol, string address, AccessPrivilege privilege) {
56  if (String.IsNullOrEmpty(userName))
57  throw new ArgumentNullException("userName");
58  if (String.IsNullOrEmpty(protocol))
59  throw new ArgumentNullException("protocol");
60 
61  UserName = userName;
62  Protocol = protocol;
63  Address = address;
64  Privilege = privilege;
65  }
66 
70  public string UserName { get; private set; }
71 
75  public string Protocol { get; private set; }
76 
80  public string Address { get; private set; }
81 
85  public AccessPrivilege Privilege { get; private set; }
86 
92  public bool IsForAnyAddress {
93  get { return Address.Equals(AnyAddress); }
94  }
95  }
96 }
UserProtocolAccess(string userName, string protocol, AccessPrivilege privilege)
Constructs a user access control that matches all the addresses for the given protocol.
UserProtocolAccess(string userName, string protocol, string address, AccessPrivilege privilege)
Constructs a user access control that matches the address for the given protocol. ...
Contains the information about the access control to a user from a defined connection protocol to the...
AccessPrivilege
The privilege granted to a user on a given resource.