Exemple #1
0
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed)
 {
     base.setJSON(obj, host, processed);
     obj["OwningUser"]        = OwningUser.getJson(this, processed);
     obj["OwningApplication"] = OwningApplication.getJson(this, processed);
     if (mState != IfcStateEnum.NA)
     {
         obj["State"] = mState.ToString();
     }
     obj["ChangeAction"] = mChangeAction.ToString();
     if (mLastModifiedDate > 0)
     {
         obj["LastModifiedDate"] = mLastModifiedDate;
     }
     if (mLastModifyingUser > 0)
     {
         obj["LastModifyingUser"] = LastModifyingUser.getJson(this, processed);
     }
     if (mLastModifyingApplication > 0)
     {
         obj["LastModifyingApplication"] = LastModifyingApplication.getJson(this, processed);
     }
     if (mCreationDate > 0)
     {
         obj["CreationDate"] = mCreationDate;
     }
 }
        internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <string, XmlElement> processed)
        {
            base.SetXML(xml, host, processed);

            xml.AppendChild(OwningUser.GetXML(xml.OwnerDocument, "OwningUser", this, processed));
            xml.AppendChild(OwningApplication.GetXML(xml.OwnerDocument, "OwningApplication", this, processed));
            if (mState != IfcStateEnum.NOTDEFINED)
            {
                xml.SetAttribute("State", mState.ToString().ToLower());
            }
            xml.SetAttribute("ChangeAction", mChangeAction.ToString().ToLower());
            if (mLastModifiedDate > 0)
            {
                xml.SetAttribute("LastModifiedDate", mLastModifiedDate.ToString());
            }
            if (mLastModifyingUser != null)
            {
                xml.AppendChild(LastModifyingUser.GetXML(xml.OwnerDocument, "LastModifyingUser", this, processed));
            }
            if (mLastModifyingApplication != null)
            {
                xml.AppendChild(LastModifyingApplication.GetXML(xml.OwnerDocument, "LastModifyingApplication", this, processed));
            }
            xml.SetAttribute("CreationDate", mCreationDate.ToString());
        }
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     obj["OwningUser"]        = OwningUser.getJson(this, options);
     obj["OwningApplication"] = OwningApplication.getJson(this, options);
     if (mState != IfcStateEnum.NOTDEFINED)
     {
         obj["State"] = mState.ToString();
     }
     obj["ChangeAction"] = mChangeAction.ToString();
     if (mLastModifiedDate > 0)
     {
         obj["LastModifiedDate"] = mLastModifiedDate;
     }
     if (mLastModifyingUser != null)
     {
         obj["LastModifyingUser"] = LastModifyingUser.getJson(this, options);
     }
     if (mLastModifyingApplication != null)
     {
         obj["LastModifyingApplication"] = LastModifyingApplication.getJson(this, options);
     }
     if (mCreationDate > 0)
     {
         obj["CreationDate"] = mCreationDate;
     }
 }
Exemple #4
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(OwningUser != null ? OwningUser.ToStepValue() : "$");
            parameters.Add(OwningApplication != null ? OwningApplication.ToStepValue() : "$");
            parameters.Add(State.ToStepValue());
            parameters.Add(ChangeAction.ToStepValue());
            parameters.Add(LastModifiedDate != null ? LastModifiedDate.ToStepValue() : "$");
            parameters.Add(LastModifyingUser != null ? LastModifyingUser.ToStepValue() : "$");
            parameters.Add(LastModifyingApplication != null ? LastModifyingApplication.ToStepValue() : "$");
            parameters.Add(CreationDate != null ? CreationDate.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
Exemple #5
0
        /// <summary>
        /// Saves a client to the database
        /// </summary>
        public void Commit()
        {
            Validate(); // will throw an exception as appropriate
            DBHelper dbh = new DBHelper("REPLACE INTO allowedoauthclients SET ClientID=?id, ClientSecret=?secret, CallBack=?callback, ClientName=?name, Scopes=?scopes, owningUserName=?user, ClientType=1");

            dbh.DoNonQuery((comm) =>
            {
                comm.Parameters.AddWithValue("id", ClientIdentifier.LimitTo(45));
                comm.Parameters.AddWithValue("secret", ClientSecret.LimitTo(255));
                comm.Parameters.AddWithValue("callback", CallbacksAsString.LimitTo(1024));
                comm.Parameters.AddWithValue("name", ClientName.LimitTo(255));
                comm.Parameters.AddWithValue("scopes", Scope.LimitTo(255));
                comm.Parameters.AddWithValue("user", OwningUser.LimitTo(255));
            });
            OAuth2AuthorizationServer.RefreshClients();
        }
Exemple #6
0
        public virtual Boolean AllowWrite(VirtualFtpSession session)
        {
            if (Invalid)
            {
                return(false);
            }

            if (session.IsFileAdmin)
            {
                return(true);
            }

            if (session.Username.ToLower().Equals(OwningUser.ToLower()) && UserWrite)
            {
                return(true);
            }

            if (WorldWrite)
            {
                return(true);
            }

            return(false);
        }