Commit for development environment setup
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Csla;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public partial class Permission
|
||||
{
|
||||
private static List<vlnValueKey> _permADLookup;
|
||||
private static List<vlnValueKey> _permLevelLookup;
|
||||
private static void setupLookup()
|
||||
{
|
||||
if (_permADLookup == null)
|
||||
{
|
||||
_permADLookup = new List<vlnValueKey>();
|
||||
_permADLookup.Add(new vlnValueKey(0,"Allow"));
|
||||
_permADLookup.Add(new vlnValueKey(1, "Deny"));
|
||||
}
|
||||
if (_permLevelLookup == null)
|
||||
{
|
||||
_permLevelLookup = new List<vlnValueKey>();
|
||||
_permLevelLookup.Add(new vlnValueKey(0, "Security"));
|
||||
_permLevelLookup.Add(new vlnValueKey(1, "System"));
|
||||
_permLevelLookup.Add(new vlnValueKey(2, "RO"));
|
||||
_permLevelLookup.Add(new vlnValueKey(3, "Procedure"));
|
||||
_permLevelLookup.Add(new vlnValueKey(4, "Sections"));
|
||||
_permLevelLookup.Add(new vlnValueKey(5, "Steps"));
|
||||
_permLevelLookup.Add(new vlnValueKey(6, "Comments"));
|
||||
}
|
||||
}
|
||||
public static List<vlnValueKey> PermADLookup
|
||||
{
|
||||
get { setupLookup(); return _permADLookup; }
|
||||
}
|
||||
public static List<vlnValueKey> PermLevelLookup
|
||||
{
|
||||
get { setupLookup(); return _permLevelLookup; }
|
||||
}
|
||||
public bool ReadAccess
|
||||
{
|
||||
get { return ((PermValue & 1) == 1); }
|
||||
set { PermValue = (value?PermValue|1:PermValue^(PermValue&1));}
|
||||
}
|
||||
public bool WriteAccess
|
||||
{
|
||||
get { return ((PermValue & 2) == 2); }
|
||||
set { PermValue = (value ? PermValue | 2 : PermValue ^ (PermValue & 2)); }
|
||||
}
|
||||
public bool CreateAccess
|
||||
{
|
||||
get { return ((PermValue & 4) == 4); }
|
||||
set { PermValue = (value ? PermValue | 4 : PermValue ^ (PermValue & 4)); }
|
||||
}
|
||||
public bool DeleteAccess
|
||||
{
|
||||
get { return ((PermValue & 8) == 8); }
|
||||
set { PermValue = (value ? PermValue | 8 : PermValue ^ (PermValue & 8)); }
|
||||
}
|
||||
// partial class Extension : extensionBase
|
||||
// {
|
||||
// TODO: Override automatic defaults
|
||||
// public virtual int DefaultPermad
|
||||
// {
|
||||
// get { return 0; }
|
||||
// }
|
||||
// public virtual SmartDate DefaultStartDate
|
||||
// {
|
||||
// get { return DateTime.Now.ToShortDateString(); }
|
||||
// }
|
||||
// public virtual DateTime DefaultDts
|
||||
// {
|
||||
// get { return DateTime.Now; }
|
||||
// }
|
||||
// public virtual string DefaultUsrid
|
||||
// {
|
||||
// get { return Environment.UserName.ToUpper(); }
|
||||
// }
|
||||
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||
// {
|
||||
// //rules.AllowRead(Dbid, "<Role(s)>");
|
||||
// }
|
||||
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
|
||||
// {
|
||||
// rules.AddRule(
|
||||
// Csla.Validation.CommonRules.StringMaxLength,
|
||||
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Csla;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public partial class RolePermission : BusinessBase<RolePermission>
|
||||
{
|
||||
public static RolePermission New()
|
||||
{
|
||||
return new RolePermission(1, 1, 1);
|
||||
}
|
||||
public bool ReadAccess
|
||||
{
|
||||
get { return ((PermValue & 1) == 1); }
|
||||
set { PermValue = (value ? PermValue | 1 : PermValue ^ (PermValue & 1)); }
|
||||
}
|
||||
public bool WriteAccess
|
||||
{
|
||||
get { return ((PermValue & 2) == 2); }
|
||||
set { PermValue = (value ? PermValue | 2 : PermValue ^ (PermValue & 2)); }
|
||||
}
|
||||
public bool CreateAccess
|
||||
{
|
||||
get { return ((PermValue & 4) == 4); }
|
||||
set { PermValue = (value ? PermValue | 4 : PermValue ^ (PermValue & 4)); }
|
||||
}
|
||||
public bool DeleteAccess
|
||||
{
|
||||
get { return ((PermValue & 8) == 8); }
|
||||
set { PermValue = (value ? PermValue | 8 : PermValue ^ (PermValue & 8)); }
|
||||
}
|
||||
public List<vlnValueKey> PermADLookup
|
||||
{
|
||||
get { return Permission.PermADLookup; }
|
||||
}
|
||||
public List<vlnValueKey> PermLevelLookup
|
||||
{
|
||||
get { return Permission.PermLevelLookup; }
|
||||
}
|
||||
}
|
||||
public class PermLookup
|
||||
{
|
||||
public List<vlnValueKey> PermADLookup
|
||||
{
|
||||
get { return Permission.PermADLookup; }
|
||||
}
|
||||
public List<vlnValueKey> PermLevelLookup
|
||||
{
|
||||
get { return Permission.PermLevelLookup; }
|
||||
}
|
||||
}
|
||||
}
|
30
PROMS/VEPROMS.CSLA.Library/Extension/Security/vlnValueKey.cs
Normal file
30
PROMS/VEPROMS.CSLA.Library/Extension/Security/vlnValueKey.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public class vlnValueKey
|
||||
{
|
||||
public vlnValueKey() { ;}
|
||||
public vlnValueKey(int key, string value)
|
||||
{
|
||||
_key = key;
|
||||
_value = value;
|
||||
}
|
||||
private int _key;
|
||||
public int Key
|
||||
{
|
||||
get { return _key; }
|
||||
}
|
||||
private string _value;
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user