|
virtual void | Dispose (bool disposing) |
|
Definition at line 27 of file UserManager.cs.
Deveel.Data.Security.UserManager.UserManager |
( |
IQuery |
queryContext | ) |
|
|
inline |
Deveel.Data.Security.UserManager.~UserManager |
( |
| ) |
|
|
inlineprivate |
void Deveel.Data.Security.UserManager.AddUserToGroup |
( |
string |
userName, |
|
|
string |
groupName, |
|
|
bool |
asAdmin |
|
) |
| |
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 378 of file UserManager.cs.
379 if (
String.IsNullOrEmpty(groupName))
380 throw new ArgumentNullException(
"group");
381 if (
String.IsNullOrEmpty(userName))
382 throw new ArgumentNullException(
"username");
384 char c = groupName[0];
385 if (c ==
'@' || c ==
'&' || c ==
'#' || c ==
'$')
386 throw new ArgumentException(
String.Format(
"Group name '{0}' is invalid: cannot start with {1}", groupName, c),
"groupName");
389 var table =
QueryContext.GetMutableTable(SystemSchema.UserGroupTableName);
390 var row = table.NewRow();
391 row.SetValue(0, userName);
392 row.SetValue(1, groupName);
393 row.SetValue(2, asAdmin);
A long string in the system.
bool IsUserInGroup(string userName, string groupName)
void Deveel.Data.Security.UserManager.AlterUser |
( |
UserInfo |
userInfo, |
|
|
string |
identifier |
|
) |
| |
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 233 of file UserManager.cs.
234 var userName = userInfo.Name;
239 var table =
QueryContext.GetMutableTable(SystemSchema.PasswordTableName);
240 var c1 = table.GetResolvedColumnName(0);
243 throw new SecurityException(
String.Format(
"User '{0}' was not found.", userName));
249 var method = userInfo.Identification.Method;
252 if (method !=
"plain")
253 throw new NotImplementedException(
"Only mechanism implemented right now is plain text (it sucks!)");
256 table =
QueryContext.GetMutableTable(SystemSchema.PasswordTableName);
257 var row = table.NewRow();
258 row.SetValue(0, userName);
259 row.SetValue(1, method);
260 row.SetValue(2, methodArgs);
261 row.SetValue(3, identifier);
A long string in the system.
static byte[] SerializeArguments(IDictionary< string, object > args)
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
bool Deveel.Data.Security.UserManager.CheckIdentifier |
( |
string |
userName, |
|
|
string |
identifier |
|
) |
| |
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 323 of file UserManager.cs.
324 var table =
QueryContext.GetTable(SystemSchema.PasswordTableName);
325 var unameColumn = table.GetResolvedColumnName(0);
326 var idColumn = table.GetResolvedColumnName(3);
330 throw new SecurityException(
String.Format(
"User '{0}' is not registered.", userName));
332 var stored = t.GetValue(0, idColumn);
333 return stored.Value.ToString().Equals(identifier);
A long string in the system.
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
void Deveel.Data.Security.UserManager.ClearUserGroupsCache |
( |
string |
userName | ) |
|
|
inlineprivate |
Definition at line 174 of file UserManager.cs.
Dictionary< string, string[]> userGroupsCache
void Deveel.Data.Security.UserManager.ClearUserGroupsCache |
( |
| ) |
|
|
inlineprivate |
Definition at line 181 of file UserManager.cs.
Dictionary< string, string[]> userGroupsCache
void Deveel.Data.Security.UserManager.CreateUser |
( |
UserInfo |
userInfo, |
|
|
string |
identifier |
|
) |
| |
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 59 of file UserManager.cs.
61 throw new ArgumentNullException(
"userInfo");
62 if (
String.IsNullOrEmpty(identifier))
63 throw new ArgumentNullException(
"identifier");
67 var userName = userInfo.Name;
70 throw new SecurityException(
String.Format(
"User '{0}' is already registered.", userName));
73 var table =
QueryContext.GetMutableTable(SystemSchema.UserTableName);
74 var row = table.NewRow();
75 row[0] = DataObject.String(userName);
78 var method = userInfo.Identification.Method;
81 if (method !=
"plain")
82 throw new NotImplementedException(
"Only mechanism implemented right now is plain text (it sucks!)");
84 table =
QueryContext.GetMutableTable(SystemSchema.PasswordTableName);
86 row.SetValue(0, userName);
87 row.SetValue(1, method);
88 row.SetValue(2, methodArgs);
89 row.SetValue(3, identifier);
bool UserExists(string userName)
A long string in the system.
static byte[] SerializeArguments(IDictionary< string, object > args)
void Deveel.Data.Security.UserManager.CreateUserGroup |
( |
string |
groupName | ) |
|
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 337 of file UserManager.cs.
338 if (
String.IsNullOrEmpty(groupName))
339 throw new ArgumentNullException(
"groupName");
341 var c = groupName[0];
342 if (c ==
'$' || c ==
'%' || c ==
'@')
343 throw new ArgumentException(
String.Format(
"Group name '{0}' starts with an invalid character.", groupName));
345 var table =
QueryContext.GetMutableTable(SystemSchema.GroupsTableName);
347 var row = table.NewRow();
348 row.SetValue(0, groupName);
A long string in the system.
static IDictionary<string, object> Deveel.Data.Security.UserManager.DeserializeArguments |
( |
byte[] |
bytes | ) |
|
|
inlinestaticprivate |
Definition at line 122 of file UserManager.cs.
123 using (var stream =
new MemoryStream(bytes)) {
124 using (var reader =
new BinaryReader(stream)) {
125 var argCount = reader.ReadInt32();
127 var args =
new Dictionary<string, object>(argCount);
128 for (
int i = 0; i < argCount; i++) {
129 var argName = reader.ReadString();
130 var argType = reader.ReadByte();
133 value = reader.ReadBoolean();
134 }
else if (argType == 2) {
135 value = reader.ReadInt64();
136 }
else if (argType == 3) {
137 value = reader.ReadString();
140 args[argName] = value;
void Deveel.Data.Security.UserManager.Dispose |
( |
| ) |
|
|
inline |
virtual void Deveel.Data.Security.UserManager.Dispose |
( |
bool |
disposing | ) |
|
|
inlineprotectedvirtual |
Definition at line 45 of file UserManager.cs.
Dictionary< string, string[]> userGroupsCache
bool Deveel.Data.Security.UserManager.DropUser |
( |
string |
userName | ) |
|
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 196 of file UserManager.cs.
208 var table =
QueryContext.GetMutableTable(SystemSchema.PasswordTableName);
209 var c1 = table.GetResolvedColumnName(0);
213 table =
QueryContext.GetMutableTable(SystemSchema.UserTableName);
214 c1 = table.GetResolvedColumnName(0);
216 return table.Delete(t) > 0;
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
void RemoveUserFromAllGroups(string username)
bool Deveel.Data.Security.UserManager.DropUserGroup |
( |
string |
groupName | ) |
|
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 353 of file UserManager.cs.
354 var table =
QueryContext.GetMutableTable(SystemSchema.UserGroupTableName);
355 var c1 = table.GetResolvedColumnName(0);
360 if (t.RowCount > 0) {
void ClearUserGroupsCache()
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
UserInfo Deveel.Data.Security.UserManager.GetUser |
( |
string |
userName | ) |
|
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 300 of file UserManager.cs.
301 var table =
QueryContext.GetTable(SystemSchema.PasswordTableName);
302 var unameColumn = table.GetResolvedColumnName(0);
303 var methodColumn = table.GetResolvedColumnName(1);
304 var methodArgsColumn = table.GetResolvedColumnName(2);
308 throw new SecurityException(
String.Format(
"User '{0}' is not registered.", userName));
310 var method = t.GetValue(0, methodColumn);
311 var methodArgs = t.GetValue(0, methodArgsColumn);
312 var argBytes = ((
SqlBinary) methodArgs.Value).ToByteArray();
315 var identification =
new UserIdentification(method);
316 foreach (var arg
in args) {
317 identification.Arguments[arg.Key] = arg.Value;
320 return new UserInfo(userName, identification);
A long string in the system.
Implements a BINARY object that handles a limited number of bytes, not exceding MaxLength.
SqlExpressionType
All the possible type of SqlExpression supported
static IDictionary< string, object > DeserializeArguments(byte[] bytes)
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
string [] Deveel.Data.Security.UserManager.GetUserGroups |
( |
string |
userName | ) |
|
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 460 of file UserManager.cs.
string[] QueryUserGroups(string userName)
void SetUserGroupsInCache(string userName, string[] groups)
bool TryGetUserGroupsFromCache(string userName, out string[] groups)
UserStatus Deveel.Data.Security.UserManager.GetUserStatus |
( |
string |
userName | ) |
|
|
inline |
bool Deveel.Data.Security.UserManager.IsUserGroupAdmin |
( |
string |
userName, |
|
|
string |
groupName |
|
) |
| |
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 398 of file UserManager.cs.
401 var table =
QueryContext.GetTable(SystemSchema.UserGroupTableName);
402 var c1 = table.GetResolvedColumnName(0);
403 var c2 = table.GetResolvedColumnName(1);
413 return t.GetValue(0, 2).AsBoolean();
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
bool Deveel.Data.Security.UserManager.IsUserInGroup |
( |
string |
userName, |
|
|
string |
groupName |
|
) |
| |
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 440 of file UserManager.cs.
443 userGroups.Any(x =>
String.Equals(groupName, x, StringComparison.OrdinalIgnoreCase)))
448 var table =
QueryContext.GetTable(SystemSchema.UserGroupTableName);
449 var c1 = table.GetResolvedColumnName(0);
450 var c2 = table.GetResolvedColumnName(1);
457 return t.RowCount > 0;
A long string in the system.
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
bool TryGetUserGroupsFromCache(string userName, out string[] groups)
string [] Deveel.Data.Security.UserManager.QueryUserGroups |
( |
string |
userName | ) |
|
|
inlineprivate |
Definition at line 148 of file UserManager.cs.
149 var table =
QueryContext.GetTable(SystemSchema.UserGroupTableName);
150 var c1 = table.GetResolvedColumnName(0);
154 var groups =
new string[sz];
155 var rowEnum = t.GetEnumerator();
157 while (rowEnum.MoveNext()) {
158 groups[i] = t.GetValue(rowEnum.Current.RowId.RowNumber, 1).Value.ToString();
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
void Deveel.Data.Security.UserManager.RemoveUserFromAllGroups |
( |
string |
username | ) |
|
|
inlineprivate |
Definition at line 219 of file UserManager.cs.
222 var table =
QueryContext.GetMutableTable(SystemSchema.UserGroupTableName);
223 var c1 = table.GetResolvedColumnName(0);
226 if (t.RowCount > 0) {
void ClearUserGroupsCache()
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
bool Deveel.Data.Security.UserManager.RemoveUserFromGroup |
( |
string |
userName, |
|
|
string |
groupName |
|
) |
| |
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 416 of file UserManager.cs.
419 var table =
QueryContext.GetMutableTable(SystemSchema.UserGroupTableName);
420 var c1 = table.GetResolvedColumnName(0);
421 var c2 = table.GetResolvedColumnName(1);
429 if (t.RowCount > 0) {
void ClearUserGroupsCache()
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
static byte [] Deveel.Data.Security.UserManager.SerializeArguments |
( |
IDictionary< string, object > |
args | ) |
|
|
inlinestaticprivate |
Definition at line 93 of file UserManager.cs.
94 using (var stream =
new MemoryStream()) {
95 using (var writer =
new BinaryWriter(stream)) {
96 writer.Write(args.Count);
98 foreach (var arg
in args) {
99 writer.Write(arg.Key);
101 if (arg.Value is
bool) {
102 writer.Write((byte)1);
103 writer.Write((
bool) arg.Value);
104 }
else if (arg.Value is
short ||
107 var value = (long) arg.Value;
108 writer.Write((byte)2);
110 }
else if (arg.Value is
string) {
111 writer.Write((byte)3);
112 writer.Write((
string) arg.Value);
117 return stream.ToArray();
void Deveel.Data.Security.UserManager.SetUserGroupsInCache |
( |
string |
userName, |
|
|
string[] |
groups |
|
) |
| |
|
inlineprivate |
Definition at line 188 of file UserManager.cs.
Dictionary< string, string[]> userGroupsCache
void Deveel.Data.Security.UserManager.SetUserStatus |
( |
string |
userName, |
|
|
UserStatus |
status |
|
) |
| |
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 266 of file UserManager.cs.
268 var table =
QueryContext.GetMutableTable(SystemSchema.UserGroupTableName);
269 var c1 = table.GetResolvedColumnName(0);
270 var c2 = table.GetResolvedColumnName(1);
276 bool userBelongsToLockGroup = t.RowCount > 0;
278 !userBelongsToLockGroup) {
281 var rdat =
new Row(table);
282 rdat.SetValue(0, userName);
283 rdat.SetValue(1, SystemGroups.LockGroup);
286 userBelongsToLockGroup) {
A single row in a table of a database.
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
bool Deveel.Data.Security.UserManager.TryGetUserGroupsFromCache |
( |
string |
userName, |
|
|
out string[] |
groups |
|
) |
| |
|
inlineprivate |
Definition at line 165 of file UserManager.cs.
Dictionary< string, string[]> userGroupsCache
bool Deveel.Data.Security.UserManager.UserExists |
( |
string |
userName | ) |
|
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 50 of file UserManager.cs.
51 var table =
QueryContext.GetTable(SystemSchema.UserTableName);
52 var c1 = table.GetResolvedColumnName(0);
56 return t.RowCount > 0;
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
bool Deveel.Data.Security.UserManager.UserGroupExists |
( |
string |
groupName | ) |
|
|
inline |
Implements Deveel.Data.Security.IUserManager.
Definition at line 369 of file UserManager.cs.
370 var table =
QueryContext.GetTable(SystemSchema.UserGroupTableName);
371 var c1 = table.GetResolvedColumnName(0);
375 return t.RowCount > 0;
SqlExpressionType
All the possible type of SqlExpression supported
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
Dictionary<string, string[]> Deveel.Data.Security.UserManager.userGroupsCache |
|
private |
IQuery Deveel.Data.Security.UserManager.QueryContext |
|
getprivate set |
The documentation for this class was generated from the following file:
- /var/calculate/remote/distfiles/egit-src/deveeldb.git/src/deveeldb/Deveel.Data.Security/UserManager.cs