internal SqlAzManStoreGroupMember(NetSqlAzManStorageDataContext db, IAzManStoreGroup storeGroup, int storeGroupMemberId, IAzManSid sid, WhereDefined whereDefined, bool isMember, SqlAzManENS ens)
 {
     this.db = db;
     this.storeGroup = storeGroup;
     this.storeGroupMemberId = storeGroupMemberId;
     this.sid = sid;
     this.whereDefined = whereDefined;
     this.isMember = isMember;
     this.ens = ens;
 }
 internal SqlAzManApplication(NetSqlAzManStorageDataContext db, IAzManStore store, int applicationId, string name, string description, byte netsqlazmanFixedServerRole, SqlAzManENS ens)
 {
     this.db = db;
     this.applicationId = applicationId;
     this.store = store;
     this.name = name;
     this.description = description;
     this.netsqlazmanFixedServerRole = netsqlazmanFixedServerRole;
     this.ens = ens;
 }
Exemplo n.º 3
0
 internal SqlAzManItem(NetSqlAzManStorageDataContext db, IAzManApplication application, int itemId, string name, string description, ItemType itemType, string bizRule, BizRuleSourceLanguage? bizRuleScriptLanguage, SqlAzManENS ens)
 {
     this.db = db;
     this.itemId = itemId;
     this.application = application;
     this.name = name;
     this.bizRuleSource = bizRule;
     this.bizRuleSourceLanguage = bizRuleScriptLanguage;
     this.description = description;
     this.itemType = itemType;
     this.ens = ens;
 }
 internal SqlAzManAuthorization(NetSqlAzManStorageDataContext db, IAzManItem item, int authorizationId, IAzManSid owner, WhereDefined ownerSidWhereDefined, IAzManSid sid, WhereDefined objectSidWhereDefined, AuthorizationType authorizationType, DateTime? validFrom, DateTime? validTo, SqlAzManENS ens)
 {
     this.db = db;
     this.authorizationId = authorizationId;
     this.item = item;
     this.owner = owner;
     this.ownerSidWhereDefined = ownerSidWhereDefined;
     this.sid = sid;
     this.sidWhereDefined = objectSidWhereDefined;
     this.authorizationType = authorizationType;
     this.validFrom = validFrom;
     this.validTo = validTo;
     this.ens = ens;
 }
 internal SqlAzManApplicationGroup(NetSqlAzManStorageDataContext db, IAzManApplication application, int applicationGroupId, IAzManSid sid, string name, string description, string lDapQuery, GroupType groupType, SqlAzManENS ens)
 {
     this.db = db;
     this.application = application;
     this.applicationGroupId = applicationGroupId;
     this.sid = sid;
     this.name = name;
     this.description = description;
     this.lDapQuery = String.IsNullOrEmpty(lDapQuery) ? String.Empty : lDapQuery;
     this.groupType = groupType;
     this.ens = ens;
     if (groupType != GroupType.Basic)
     {
         this.members = new Dictionary<IAzManSid, IAzManApplicationGroupMember>();
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Writes the event.
 /// </summary>
 /// <param name="storage">The storage.</param>
 /// <param name="message">The message.</param>
 /// <param name="type">The type.</param>
 private void WriteEvent(IAzManStorage storage, string message, EventLogEntryType type)
 {
     try
     {
         SqlAzManStorage typedStorage = storage as SqlAzManStorage;
         bool logOnDb = false;
         bool logOnEventLog = true;
         string connectionString = String.Empty;
         Guid instanceGuid = Guid.Empty;
         Guid transactionGuid = Guid.Empty;
         int operationCounter = 0;
         DateTime now = DateTime.Now;
         if (typedStorage != null)
         {
             logOnDb = typedStorage.LogOnDb;
             logOnEventLog = typedStorage.LogOnEventLog;
             connectionString = typedStorage.db.Connection.ConnectionString;
             instanceGuid = typedStorage.instanceGuid;
             transactionGuid = typedStorage.transactionGuid;
             operationCounter = ++typedStorage.operationCounter;
         }
         string originalMessage = message;
         if (logOnDb)
         {
             string ENSType = "User Log";
             if (message.StartsWith("ENS Event: ", StringComparison.CurrentCultureIgnoreCase))
             {
                 ENSType = message.Substring(message.IndexOf("ENS Event: ") + 11);
                 ENSType = ENSType.Substring(0, ENSType.IndexOf("\r\n"));
                 message = message.Substring(message.IndexOf("\r\n") + 2);
                 message = message.TrimStart('\r').TrimStart('\n');
             }
             while (message.IndexOf("\r\n\r\n") != -1)
             {
                 message = message.Replace("\r\n\r\n", "\r\n");
             }
             message = message.Replace("\r\n", ";");
             string logType;
             switch (type)
             {
                 case EventLogEntryType.Error: logType = "E"; break;
                 case EventLogEntryType.Warning: logType = "W"; break;
                 default:
                     logType = "I"; break;
             }
             NTAccount nta = new NTAccount(((System.Threading.Thread.CurrentPrincipal.Identity as WindowsIdentity) ?? WindowsIdentity.GetCurrent()).Name);
             SecurityIdentifier sid = (SecurityIdentifier)nta.Translate(typeof(SecurityIdentifier));
             string winIdentity = String.Format("{0} ({1}", nta.Value, sid.Value);
             NetSqlAzManStorageDataContext db = new NetSqlAzManStorageDataContext(connectionString);
             NetSqlAzMan.LINQ.LogTable log = new LogTable();
             log.LogDateTime = now;
             log.WindowsIdentity = winIdentity;
             log.MachineName = Environment.MachineName;
             log.InstanceGuid = instanceGuid;
             log.TransactionGuid = transactionGuid == Guid.Empty ? null : new Guid?();
             log.OperationCounter = operationCounter;
             log.ENSType = ENSType;
             log.ENSDescription = message;
             log.LogType = logType;
             db.LogTables.InsertOnSubmit(log);
             db.SubmitChanges();
         }
         if (logOnEventLog)
         {
             if (!EventLog.SourceExists(LoggingUtility.EVENTSOURCE))
             {
                 EventLog.CreateEventSource(LoggingUtility.EVENTSOURCE, "Application");
             }
             originalMessage += String.Format("\r\nInstance Guid: {0}\r\nTransaction Guid: {1}\r\nOperation Counter: {2}", instanceGuid.ToString(), transactionGuid.ToString(), operationCounter);
             EventLog.WriteEntry(LoggingUtility.EVENTSOURCE, originalMessage, type);
         }
     }
     catch
     {
         //Ignore if error occur during logging
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Verifies if the database is a valid NetSqlAzMan Storage DB.
 /// </summary>
 public static void VerifyStorageDB(string connectionString)
 {
     using (NetSqlAzManStorageDataContext db = new NetSqlAzManStorageDataContext(connectionString))
     {
         db.AuthorizationAttributes().Any();
     }
 }
Exemplo n.º 8
0
 private void OnDeserialized(StreamingContext context)
 {
     this.db = new NetSqlAzManStorageDataContext(this.ConnectionString);
     this.logging = new LoggingUtility();
 }