public override void ModifyUser(EngineRequest request, Security.User user) { CheckInitialization(); Logger.Storage.Debug("Modifying user '" + user.Username + "'..."); EngineMethods.ModifyUser act = new EngineMethods.ModifyUser(request, user); act.Execute(); }
public void RaiseCallbackEvent(string eventArgument) { Security.Token tok = (Security.Token)Page.Session["Token"]; if (tok != null && tok.Authenticated && tok.GetCurrentUser().Registered) { Security.User user = tok.GetCurrentUser(); string[] args = eventArgument.Split('|'); List <Security.Contact> contacts = user.GetContactsByGroup(args[1]); if (contacts.Count == 0) { result = "There is not any contact"; } else { result = args[0] + "\\|/"; foreach (Security.Contact c in contacts) { result += c.Name + "\\|/"; } } } else { result = "You haven't authenticated yet."; } }
public override void TaskComplete(Tasks.Base sender, ICommandReply reply) { Type t = sender.GetType(); if (t == typeof(Tasks.DownloadGlobalPermissions)) { Tasks.DownloadGlobalPermissions task = (Tasks.DownloadGlobalPermissions)sender; _gur = task.GlobalUsageRights; RunTaskProcess(new Tasks.CheckGlobalPermissions(_db, _gur, _requestingPartyType, _session, Security.Authorization.GlobalPermissionType.CreateResource, _sendTimeout, _receiveTimeout, _sendBufferSize, _receiveBufferSize)); } else if (t == typeof(Tasks.CheckGlobalPermissions)) { Tasks.CheckGlobalPermissions task = (Tasks.CheckGlobalPermissions)sender; if (!task.IsAuthorized) { TriggerOnAuthorizationDenied(task); return; } RunTaskProcess(new Tasks.DownloadUser(_db, User.Username, _sendTimeout, _receiveTimeout, _sendBufferSize, _receiveBufferSize)); } else if (t == typeof(Tasks.DownloadUser)) { Tasks.DownloadUser task = (Tasks.DownloadUser)sender; User = task.User; TriggerOnComplete(reply, User); } else { TriggerOnError(sender, reply.ToString(), null); } }
public void RaiseCallbackEvent(string eventArgument) { Security.Token tok = (Security.Token)Page.Session["Token"]; if (tok != null && tok.Authenticated) { Security.User user = tok.GetCurrentUser(); if (user.Registered) { string[] args = eventArgument.Split('β'); if (args != null) { if (user.RemoveGroup(args[0], Convert.ToBoolean(args[1]))) { result = "trueβ" + args[1] + "β" + args[0]; } } } else { result = "unrβ"; } } }
public void RaiseCallbackEvent(string eventArgument) { result = ""; Security.Token tok = (Security.Token)Page.Session["Token"]; if (tok != null && tok.Authenticated && tok.GetCurrentUser().Registered) { Security.User usr = tok.GetCurrentUser(); List <Security.FilledWorkflowReference> listForm = usr.GetCompiledForms(); if (listForm.Count == 0) { result = "You didn't create any form."; } else { foreach (Security.FilledWorkflowReference w in listForm) { result += w.getFilledWorkflowName() + "\\|)//" + w.getPublicationDescription() + "\\|//"; } } } else { result = "You haven't authenticated yet."; } }
protected override void OnInit(EventArgs e) { Security.Token tok = (Security.Token)Session["Token"]; base.OnInit(e); if (!Page.IsPostBack) { if (tok != null && tok.Authenticated) { user = (Security.User)tok.GetCurrentUser(); Session["user"] = user; if (user.Registered) { services = new Dictionary <string, string>(); foreach (Security.Service service in user.GetSubscribedServices()) { services.Add(Convert.ToString(service.ServiceId), service.ServiceName); } Session["services"] = services; } } } else { user = Session["user"] as Security.User; services = Session["services"] as Dictionary <string, string>; } }
public override void CreateUser(EngineRequest request, Security.User user) { CheckInitialization(); Logger.Storage.Debug("Creating user '" + user.Id + "'..."); EngineMethods.CreateUser act = new EngineMethods.CreateUser(request, user); act.Execute(); }
public UploadUser(IDatabase db, Security.User user, int sendTimeout, int receiveTimeout, int sendBufferSize, int receiveBufferSize) : base(sendTimeout, receiveTimeout, sendBufferSize, receiveBufferSize) { _db = db; _user = user; }
public DownloadUser(IDatabase db, string username, int sendTimeout, int receiveTimeout, int sendBufferSize, int receiveBufferSize) : base(sendTimeout, receiveTimeout, sendBufferSize, receiveBufferSize) { _db = db; _user = new Security.User(username); }
public void RaiseCallbackEvent(string eventArgument) { Security.Token tok = (Security.Token)Page.Session["Token"]; if (tok != null && tok.Authenticated && tok.GetCurrentUser().Registered) { Security.User user = tok.GetCurrentUser(); if (user.Registered) { if (user != null) { if (eventArgument != null && eventArgument.Equals("")) { result = "true"; foreach (Security.Service serv in user.GetSubscribedServices()) { result += "β" + serv.ServiceName + "γ" + Convert.ToString(user.LoginNeeded(serv.ServiceId)); } } } } else { result = "unrβ"; } } }
/// <summary> /// Makes BaseSession instance /// </summary> public virtual ISession MakeNewSessionInstance(Guid sessionID, Security.User user = null) { var result = new BaseSession(sessionID, Random.NextRandomUnsignedLong); result.User = user; return(result); }
public JsonpResult SaveUser(string Username, string firstName, string lastName, string password, string userType, string email) { string clientid = ""; Tz.Security.User u = new Security.User(clientid, Username, password, (string)userType, true, firstName, lastName, email); u.Save(); return(new JsonpResult(u.UserID)); }
/// <summary> /// Makes BaseSession instance /// </summary> public virtual ISession MakeNewSessionInstance(Guid sessionID, Security.User user = null) { var result = new BaseSession(sessionID); result.User = user; return(result); }
public Dashboard(Security.User user, Dictionary <string, double> dailyTotalHours, UserStatus userStats, List <Leave.ILeave> leaves, List <Alert> alerts, List <PublicHoliday> holidays) { this.user = user; this.dailyTotalHours = dailyTotalHours; this.userStats = userStats; this.userLeaves = leaves; this.alerts = alerts; this.publicHolidays = holidays; }
public void AddUser(Security.User user) { if (user == null) { throw new ArgumentNullException("User cannot be null."); } User = user; }
public CreateUser(IDatabase db, Security.User user, Security.RequestingPartyType requestingPartyType, Security.Session session, int sendTimeout, int receiveTimeout, int sendBufferSize, int receiveBufferSize) : base(db, sendTimeout, receiveTimeout, sendBufferSize, receiveBufferSize) { _user = user; _requestingPartyType = requestingPartyType; _session = session; }
public override void Process() { Remoting.SaveSingle rem; if (string.IsNullOrEmpty(_user.Rev)) { TriggerOnActionChanged(EngineActionType.CreatingGroup, true); } else { TriggerOnActionChanged(EngineActionType.ModifyingGroup, true); } try { Transitions.User txUser = new Transitions.User(); rem = new Remoting.SaveSingle(_db, txUser.Transition(_user), _sendTimeout, _receiveTimeout, _sendBufferSize, _receiveBufferSize); } catch (Exception e) { Logger.Storage.Error("An exception occurred while instantiating the Transactions.Tasks.Remoting.SaveSingle object.", e); throw; } rem.OnComplete += delegate(Remoting.Base sender, ICommandReply reply) { if (!((Commands.PutDocumentReply)reply).Ok) { User = null; } else { User = new Security.User(_user.Id, ((Commands.PutDocumentReply)reply).Rev, null, _user.FirstName, _user.MiddleName, _user.LastName, _user.Groups, _user.IsSuperuser); User.SetEncryptedPassword(_user.Password); } TriggerOnComplete(reply); }; rem.OnError += delegate(Remoting.Base sender, string message, Exception exception) { TriggerOnError(message, exception); }; rem.OnProgress += delegate(Remoting.Base sender, OpenDMS.Networking.Protocols.Tcp.DirectionType direction, int packetSize, decimal sendPercentComplete, decimal receivePercentComplete) { TriggerOnProgress(direction, packetSize, sendPercentComplete, receivePercentComplete); }; rem.OnTimeout += delegate(Remoting.Base sender) { TriggerOnTimeout(); }; rem.Process(); }
public void RaiseCallbackEvent(string eventArgument) { result = ""; Security.Token tok = (Security.Token)Page.Session["Token"]; if (tok != null && tok.Authenticated && tok.GetCurrentUser().Registered) { Security.User user = tok.GetCurrentUser(); List <Security.ComputableWorkflowReference> computableWf = user.GetComputableWorkflows(); List <Security.WorkflowReference> editableWf = user.GetEditableWorkflows(); if (computableWf.Count == 0 && editableWf.Count == 0) { result = "You didn't create or publish any form."; } else { if (computableWf.Count == 0) { result += "You didn't publish any form"; } else { int i = 0; foreach (Security.ComputableWorkflowReference w in computableWf) { result += w.GetWorkflowName() + "\\|)//" + w.GetWorkflowDescription() + "\\|)//" + i + "\\|)//" + w.GetWorkflowExpirationDate().ToString("d") + "\\|//"; i++; } } result += "\\||//"; if (editableWf.Count == 0) { result += "You didn't create any models"; } else { int i = 0; foreach (Security.WorkflowReference w in editableWf) { result += w.GetWorkflowName() + "\\|)//" + w.GetWorkflowDescription() + "\\|)//" + i + "\\|//"; i++; } } Page.Session["ComputableWorkflowReferenceList"] = computableWf; Page.Session["WorkflowReferenceList"] = editableWf; } } else { result = "You haven't authenticated yet."; } }
protected override Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { Security.User userObj = Security.Authentication.AuthenticateOld(request); if (userObj != null) { var accountId = userObj.AccountId; var principal = new ClaimsPrincipal(new GenericIdentity(accountId, "AccountId")); HttpContext.Current.User = principal; } return(base.SendAsync(request, cancellationToken)); }
public void RaiseCallbackEvent(string eventArgument) { Security.Contact tempcontact; string newgroupname = ""; List <Security.Contact> contacts = new List <Security.Contact>(); Security.Token tok = (Security.Token)Page.Session["Token"]; Dictionary <string, string> services = (Dictionary <string, string>)Page.Session["services"]; if (tok != null && tok.Authenticated && tok.GetCurrentUser().Registered) { Security.User user = tok.GetCurrentUser(); if (user.Registered) { string contactsadded = ""; if (eventArgument != null && !eventArgument.Equals("")) { string[] args = eventArgument.Split('β'); string[] argcontact; newgroupname = args[0]; if (args.Length > 1) { for (int i = 1; i < args.Length; i++) { argcontact = args[i].Split('γ'); contactsadded += "β" + args[i]; string servicename = services[argcontact[2]]; tempcontact = new Security.Contact(argcontact[0], argcontact[1], new Security.Service(servicename, Convert.ToInt32(argcontact[2]))); contacts.Add(tempcontact); } if (user.CreateGroup(newgroupname, contacts)) { result = "trueβ" + newgroupname + contactsadded; } } else if (user.CreateGroup(newgroupname)) { result = "trueβ" + newgroupname; } } } else { result = "unrβ"; } } }
public void RaiseCallbackEvent(string eventArgument) { string ingroupname = ""; string outgroupname = ""; List <Security.Contact> contacts = new List <Security.Contact>(); Security.Contact tempcontact; Security.Token tok = (Security.Token)Page.Session["Token"]; Dictionary <string, string> services = (Dictionary <string, string>)Page.Session["services"]; string groupandcontacts = ""; if (tok != null && tok.Authenticated) { Security.User user = tok.GetCurrentUser(); if (user.Registered) { if (eventArgument != null && !eventArgument.Equals("")) { string[] args = eventArgument.Split('β'); string[] argcontact; if (args.Length > 2) { ingroupname = args[0]; outgroupname = args[1]; groupandcontacts = "β" + ingroupname + "β" + outgroupname; for (int i = 2; i < args.Length; i++) { argcontact = args[i].Split('γ'); string servicename = services[argcontact[2]]; tempcontact = new Security.Contact(argcontact[0], argcontact[1], new Security.Service(servicename, Convert.ToInt32(argcontact[2]))); contacts.Add(tempcontact); groupandcontacts += "β" + args[i]; } if (user.MoveContacts(outgroupname, ingroupname, contacts)) { result = "true" + groupandcontacts; } } } } else { result = "unrβ"; } } }
public bool IsFeatureEnabled(string feature, Security.User user) { User ldUser = new User(user.Email); foreach (KeyValuePair <string, object> keyValuePair in user.GetAttributes()) { ldUser.AndCustomAttribute(keyValuePair.Key, keyValuePair.Value.ToString()); } bool value = _ldClient.BoolVariation("costings", ldUser, false); _ldClient.Flush(); return(value); }
protected void okButt_Click(object sender, EventArgs e) { if (chkTandCs.Checked) { Security.Token tok = (Security.Token)Session["Token"]; if (tok != null) { Security.User user = tok.GetCurrentUser(); string errorReg; Security.User.RegisterMeResult registration = user.RegisterMe(TextBoxNick.Text, TextBoxMail.Text, out errorReg); if (registration == Security.User.RegisterMeResult.OK) { Session["LoginPhase"] = null; Session["LoginService"] = null; string url = ""; if (string.IsNullOrEmpty((string)Session["OriginalURL"])) { url = (string)Session["ReturnURL"]; } else { url = (string)Session["OriginalURL"]; } Session["OriginalURL"] = null; if (string.IsNullOrEmpty(url)) { url = "http://" + Security.EnvironmentManagement.getEnvValue("webServerAddress") + "/FormFillier/index.aspx"; } Response.Redirect(url); } else { //Gestisci no reg Page.Controls.Add(new LiteralControl("<script>alert('" + errorReg + "');</script>")); } } else { //Gestione errore token } } else { //check non marcata Page.Controls.Add(new LiteralControl("<script>alert('Accept term & condition before submitting');</script>")); } }
public void RaiseCallbackEvent(string eventArgument) { string[] array = eventArgument.Split('|'); Security.Token tok = (Security.Token)Page.Session["Token"]; Security.User usr = tok.GetCurrentUser(); Security.ComputableWorkflowReference wf = null; if (array[0].Equals("-200")) { wf = (Security.ComputableWorkflowReference)Page.Session["WFE_CurrentWorkflow"]; } else { wf = ((List <Security.ComputableWorkflowReference>)Page.Session["ComputableWorkflowReferenceList"])[Int32.Parse(array[0])]; } string gruppo = ""; List <Security.Contact> contUsr = new List <Security.Contact>(); bool flag = false; List <Security.Contact> contSend = new List <Security.Contact>(); string[] array2 = merge(array).ToArray(); for (int i = 1; i < array2.Length - 1; i++) { string[] grp = array2[i].Split('/'); if (grp[1] != gruppo) { if (i > 1) { flag = flag || wf.PermitContacts(contSend); } gruppo = grp[1]; contUsr = usr.GetContactsByGroup(gruppo); contSend = new List <Security.Contact>(); } contSend.Add(contUsr[Int32.Parse(grp[0])]); } flag = flag || wf.PermitContacts(contSend); if (flag) { result = "OK"; } else { result = "ERROR"; } }
public void RaiseCallbackEvent(string eventArgument) { Security.Token tok = (Security.Token)Page.Session["Token"]; Security.User usr = tok.GetCurrentUser(); List <string> gruppi = usr.GetGroups(); if (gruppi.Count == 0) { result = "You did not create any group of contacts"; } else { result = eventArgument; foreach (string gruppo in gruppi) { result += "\\|/" + gruppo; } } }
public void RaiseCallbackEvent(string eventArgument) { List <Security.Contact> contacts = new List <Security.Contact>(); Security.Token tok = (Security.Token)Page.Session["Token"]; if (tok != null && tok.Authenticated) { Security.User user = tok.GetCurrentUser(); if (user.Registered) { if (eventArgument != null && !eventArgument.Equals("")) { foreach (Security.Service serv in user.GetSubscribedServices()) { if (eventArgument.Equals(serv.ServiceName)) { contacts = user.ImportContacts(serv.ServiceId); result = "true"; break; } } } if (contacts != null && contacts.Count > 0) { foreach (Security.Contact contact in contacts) { result += "β" + contact.Name + "γ" + contact.Email + "γ" + contact.Service.ServiceId; } } else { result = "false"; } } else { result = "unr"; } } }
public void RaiseCallbackEvent(string eventArgument) { Security.Token tok = (Security.Token)Page.Session["Token"]; List <string> listgroup = new List <string>(); List <Security.Contact> contacts = new List <Security.Contact>(); if (tok != null && tok.Authenticated && tok.GetCurrentUser().Registered) { Security.User user = tok.GetCurrentUser(); if (user.Registered) { listgroup = user.GetGroups(); if (listgroup != null || listgroup.Count > 0) { result = "true"; foreach (string s in listgroup) { result += "α" + s; contacts = user.GetContactsByGroup(s); foreach (Security.Contact con in contacts) { result += "β" + con.Name + "γ" + con.Email + "γ" + con.Service.ServiceId; } } if (result.Equals("trueαOtherContacts")) { result = "falseα"; } } else { result = "falseα"; } } else { result = "unrα"; } } }
public void RaiseCallbackEvent(string eventArgument) { Security.Token tok = (Security.Token)Page.Session["Token"]; if (tok != null && tok.Authenticated) { Security.User user = tok.GetCurrentUser(); if (user.Registered) { string[] args = eventArgument.Split('β'); if (args != null) { if (user.ModifyGroupName(args[0], args[1])) { result = "trueβ" + args[0] + "β" + args[1]; } } } } }
public Security.User Transition(Model.Document document) { List <string> groups = null; try { if (document["Groups"] != null) { groups = new List <string>(); JArray jarray = (JArray)document["Groups"]; for (int i = 0; i < jarray.Count; i++) { string groupName = jarray[i].Value <string>(); if (groupName.StartsWith("group-")) { groupName = groupName.Substring(6); } groups.Add(groupName); } } Security.User user = new Security.User(document.Id, document.Rev, null, document["FirstName"].Value <string>(), document["MiddleName"].Value <string>(), document["LastName"].Value <string>(), groups, document["Superuser"].Value <bool>()); user.SetEncryptedPassword(document["Password"].Value <string>()); return(user); } catch (Exception e) { Logger.Storage.Error("An exception occurred while attempting to parse the document.", e); throw; } }
public override void Process() { Remoting.Get rem; TriggerOnActionChanged(EngineActionType.GettingUser, true); try { rem = new Remoting.Get(_db, _user.Id, _sendTimeout, _receiveTimeout, _sendBufferSize, _receiveBufferSize); } catch (Exception e) { Logger.Storage.Error("An exception occurred while instantiating the Transactions.Tasks.Remoting.Get object.", e); throw; } rem.OnComplete += delegate(Remoting.Base sender, ICommandReply reply) { Transitions.User txUser = new Transitions.User(); User = txUser.Transition(((Remoting.Get)sender).Document); TriggerOnComplete(reply); }; rem.OnError += delegate(Remoting.Base sender, string message, Exception exception) { TriggerOnError(message, exception); }; rem.OnProgress += delegate(Remoting.Base sender, OpenDMS.Networking.Protocols.Tcp.DirectionType direction, int packetSize, decimal sendPercentComplete, decimal receivePercentComplete) { TriggerOnProgress(direction, packetSize, sendPercentComplete, receivePercentComplete); }; rem.OnTimeout += delegate(Remoting.Base sender) { TriggerOnTimeout(); }; rem.Process(); }