/** Licensed Materials - Property of IBM IBM Cognos Products: DOCS (C) Copyright IBM Corp. 2005, 2008 US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ //* //* security.sln //* //* Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved. //* Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated). //* //* This sample illustrates the use of the logon and logoff methods. //* using System; using System.Web.Services.Protocols; using SamplesCommon; using cognosdotnet_10_2; namespace Security { /// /// Summary description for Security. /// class Security { /// /// The main entry point for the application. /// /// public Security(){} static void Main(string[] args) { string cBIUrl = ""; contentManagerService1 cBIServer = null; SamplesConnect connectDlg = new SamplesConnect(); SecurityDlg securityDlgObject = new SecurityDlg(); // The savedUserName and savedNamespace variables are only used for convenience, // so that the user name and the namespace can be remembered when prompting for // logon multiple times. string savedUserName = ""; string savedNamespace = ""; if (args.GetLength(0) == 0 ) { // GUI mode connectDlg.ShowDialog(); if (connectDlg.IsConnectedToCBI() == true) { cBIServer = connectDlg.CBICMS; cBIUrl = connectDlg.CBIURL; savedUserName = connectDlg.getUserName(); savedNamespace = connectDlg.getNamespace(); securityDlgObject.setConnection(connectDlg, cBIUrl, savedUserName, savedNamespace); securityDlgObject.ShowDialog(); } } } public bool getLogonInfo(SamplesConnect cBIConnection, ref string result) { if ( cBIConnection == null) { result = "...the Server connection is invalid.\n"; return false; } try { account myAccount = new account(); baseClass[] bc = new baseClass[1]; propEnum[] props = new propEnum[] { propEnum.searchPath, propEnum.defaultName }; searchPathMultipleObject homeSearchPath = new searchPathMultipleObject(); homeSearchPath.Value = "~"; bc = cBIConnection.CBICMS.query(homeSearchPath, props, new sort[] {}, new queryOptions()); if ( (bc != null) && (bc.GetLength(0) >0) ) { for (int i=0; i