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); }
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); }