コード例 #1
0
        public static string GetRelationship(string MainModule, string ID, string ModuleToFind)
        {
            string result;

            try
            {
                EntryValue[] entries = RestAPIWrapper.GetRelationships(MainModule, ID, ModuleToFind, new string[] { "id" });
                result = entries.Length > 0 ? entries[0].id : string.Empty;
            }
            catch (System.Exception)
            {
                // Swallow exception(!)
                result = string.Empty;
            }

            return(result);
        }
コード例 #2
0
        public static bool EnsureLoggedIn(UserSession userSession)
        {
            bool result = false;

            if (userSession != null && userSession.AwaitingAuthentication == false)
            {
                string userId = RestAPIWrapper.GetRealUserId();
                if (string.IsNullOrEmpty(userId))
                {
                    userSession.Login();
                    result = RestAPIWrapper.GetRealUserId() != null;
                }
                else
                {
                    result = true;
                }
            }

            return(result);
        }