Пример #1
0
        public TisSystemUser(
            string sUserName,
            AUTHENTICATION_TYPE enAuthType)
        {
            m_sName = sUserName;
            m_sAuthenticationType = enAuthType.ToString();

            m_oSystemUser = new GenericIdentity(sUserName, m_sAuthenticationType);
        }
Пример #2
0
        ITisSystemUser ITisSystemUsers.AddUserByType(string sSystemUserName,
                                                     AUTHENTICATION_TYPE enAuthenticationType)
        {
            ITisSystemUser[] SystemUsers = (this as ITisSystemUsers).AddUsersByType(
                new string[] { sSystemUserName },
                enAuthenticationType);

            return(SystemUsers [SystemUsers.Length - 1]);
        }
Пример #3
0
        public TisSystemUser GetByIdentity(string sName, AUTHENTICATION_TYPE enAuthType)
        {
            foreach (TisSystemUser oSystemUser in m_oSystemUsers)
            {
                if (StringUtil.CompareIgnoreCase(oSystemUser.Name, sName))
                {
                    return(oSystemUser);
                }
            }

            return(null);
        }
Пример #4
0
        public void RemoveAll(AUTHENTICATION_TYPE enAuthType)
        {
            TisSystemUser oSystemUser;

            for (int i = m_oSystemUsers.Count - 1; i >= 0; i--)
            {
                oSystemUser = (TisSystemUser)m_oSystemUsers [i];

                if (oSystemUser.AuthenticationType == enAuthType)
                {
                    m_oSystemUsers.Remove(oSystemUser);
                }
            }
        }
Пример #5
0
        public void Remove(string[] UsersName, AUTHENTICATION_TYPE enAuthType)
        {
            TisSystemUser oSystemUser;

            for (int i = m_oSystemUsers.Count - 1; i >= 0; i--)
            {
                oSystemUser = (TisSystemUser)m_oSystemUsers [i];

                if (Array.IndexOf(UsersName, oSystemUser.Name) > -1 &&
                    oSystemUser.AuthenticationType == enAuthType)
                {
                    m_oSystemUsers.Remove(oSystemUser);
                }
            }
        }
Пример #6
0
    public void CreateUser(AUTHENTICATION_TYPE authType, string authString, onUserLoaded callback = null)

    {
        if (!isWebServiceReady)

        {
            throw new Exception("WebService is not ready yet.");
        }



        isWebServiceReady = false;

        onUserLoadedEvent = callback;

        StartCoroutine(CreateNewUser(authType, authString, authString));
    }
Пример #7
0
        private TisSystemUser GetGroupByPrincipal(IPrincipal oPrincipal)
        {
            AUTHENTICATION_TYPE enPrincipalAuthType = StringToAuthentication(oPrincipal.Identity.AuthenticationType);

            foreach (TisSystemUser oSystemUser in m_oSystemUsers)
            {
                if (oSystemUser.AuthenticationType == enPrincipalAuthType)
                {
                    if (OnFindSystemUserInNetGroup != null &&
                        OnFindSystemUserInNetGroup(
                            new SystemUserInNetGroupArgs(oPrincipal.Identity.Name, oSystemUser.Name)))
                    {
                        return(oSystemUser);
                    }
                }
            }

            return(null);
        }
Пример #8
0
        public ITisSystemUser[] Add(string[] UsersName, AUTHENTICATION_TYPE enAuthType)
        {
            ArrayList     oSystemUsers = new ArrayList();
            TisSystemUser oSystemUser;

            foreach (string sUserName in UsersName)
            {
                oSystemUser = GetByIdentity(sUserName, enAuthType);

                if (OnSystemUserAdded != null && oSystemUser == null)
                {
                    oSystemUser = new TisSystemUser(sUserName, enAuthType);

                    SystemUserArgs oSystemUserArgs = new SystemUserArgs(oSystemUser);

                    OnSystemUserAdded(oSystemUserArgs);

                    if (oSystemUserArgs.IsValid)
                    {
                        m_oSystemUsers.Add(oSystemUser);
                    }
                    else
                    {
                        Log.WriteWarning("{0} : [{1}]",
                                         System.Reflection.MethodInfo.GetCurrentMethod(),
                                         String.Format("Attempt to add user [{0}] failed", oSystemUser.Name));

                        continue;
                    }
                }

                oSystemUsers.Add(oSystemUser);
            }

            return((ITisSystemUser[])ArrayBuilder.CreateArray(
                       oSystemUsers,
                       typeof(ITisSystemUser),
                       new ArrayElementFilter(AddSystemUsersFilter)));
        }
Пример #9
0
    IEnumerator CreateNewUser(AUTHENTICATION_TYPE authType, string authString, string authString2)

    {
        WWW www = null;



        if (authType == AUTHENTICATION_TYPE.EMAIL)

        {
            user.email = authString;



            WWWForm form = new WWWForm();

            form.AddField("SECURITY_STRING", securityString);

            form.AddField("EMAIL", authString);



            www = new WWW(webServiceURL + "/update_user.php", form);
        }

        else if (authType == AUTHENTICATION_TYPE.FACEBOOK)

        {
            user.facebookId = authString;



            WWWForm form = new WWWForm();

            form.AddField("SECURITY_STRING", securityString);

            form.AddField("FACEBOOK", authString);



            www = new WWW(webServiceURL + "/update_user.php", form);
        }



        yield return(www);



        isWebServiceReady = true;



        if (www.text != null)

        {
            try

            {
                JSONNode n = JSON.Parse(www.text);



                user.id = n["userId"].AsInt;



                if (onUserLoadedEvent != null)

                {
                    onUserLoadedEvent(GetWebServiceReturn(n["success"]));
                }
            }

            catch (Exception e)

            {
                Debug.Log("LoadUser Method: " + www.text);
            }
        }

        else

        {
            Debug.Log("LoadUser Method: " + www.error);
        }
    }
Пример #10
0
 public bool Contains(string SytemUserName, AUTHENTICATION_TYPE enAuthType)
 {
     return(Contains(new TisSystemUser(SytemUserName, enAuthType)));
 }
Пример #11
0
        public ITisSystemUser Add(string UsersName, AUTHENTICATION_TYPE enAuthType)
        {
            ITisSystemUser[] SystemUsers = Add(new string[] { UsersName }, enAuthType);

            return(SystemUsers [0]);
        }
Пример #12
0
 public bool ContainsByType(string sSystemUserName, AUTHENTICATION_TYPE enAuthenticationType)
 {
     return(m_oSystemUserMngr.Contains(sSystemUserName, enAuthenticationType));
 }
Пример #13
0
 void ITisSystemUsers.RemoveUserByType(string sSystemUserName,
                                       AUTHENTICATION_TYPE enAuthenticationType)
 {
     (this as ITisSystemUsers).RemoveUsersByType(new string[] { sSystemUserName }, enAuthenticationType);
 }
Пример #14
0
 void ITisSystemUsers.RemoveUsersByType(string[] SystemUsersName,
                                        AUTHENTICATION_TYPE enAuthenticationType)
 {
     m_oSystemUserMngr.Remove(SystemUsersName, enAuthenticationType);
 }
Пример #15
0
 void ITisSystemUsers.RemoveAllByType(AUTHENTICATION_TYPE enAuthenticationType)
 {
     m_oSystemUserMngr.RemoveAll(enAuthenticationType);
 }
Пример #16
0
 ITisSystemUser[] ITisSystemUsers.AddUsersByType(string[] SystemUsersName,
                                                 AUTHENTICATION_TYPE enAuthenticationType)
 {
     return(m_oSystemUserMngr.Add(SystemUsersName, enAuthenticationType));
 }