Showing posts with label cognos advanced configuration. Show all posts
Showing posts with label cognos advanced configuration. Show all posts

Thursday, March 1, 2018

Restrictions Restrictions

      Welcome back to my blog posts. I hope the information I'm providing on my blog has been of use to atleast some of you. Leave a note in the comments section to tell me what information you find useful and what information you're looking forward to. I will do my best to post them (without giving away business secrets obviously *wink wink*)

      Cognos has the capability of providing authentication against Active Directory. In case you're not aware, in a simple answer, Active Directory is your windows domain authentication.The username and password that you use to login into windows can also be used to login into Cognos.

      This setup is usually good enough for the majority of installations. It allows everyone with a windows username and password to login and run reports. Cognos also honors groups and roles at the Active Directory level, so its easy to assign permissions based on the role or membership of a user in a role.

      This also has the undesired effect of leaving the system wide open to everyone with a username and password. Imagine a situation where a user in the IT department is able to view the financial information of the entire company. Scary!

      While Cognos allows one to lock down the ability to run reports or look at report outputs based on role membership, it would be most beneficial if it didn't allow users to login in the first place.

      On a environment that is configured with the appropriate set of roles and memberships, setting the value of the option 'Restrict users to built-in namespace' to true completely locks down the environment, preventing users from logging in unless they're members of a pre-configured group of users that is allowed access.

   

Monday, September 7, 2015

Advanced configuration settings

         I was working on something a few weeks ago that required me to look up the configuration settings on a few dispatchers. You know .. when you go to Launch -> Cognos Administration -> System -> Configuration -> Properties .. THAT one.

        I had to add changes to the configuration settings without making any changes to the existing options. I wasn't able to find a very efficient method of doing it, but what I did discover is that these configuration settings are returned in an XML format. And who can't work with XML ;-)

        So I whipped up a quick script to retrieve the existing advanced configuration values (if any) and add new values to it.

       Below is a generic format of how the settings are returned.

       

<settings>
<setting name='settingname'>settingvalue</setting>
<!-- below is an example of a configuration setting -->
<setting name='CM.DbConnectPoolMax'>50</setting>
</settings>


Below is a function to retrieve advanced settings. It retrieves the configuration values in the above XML format. A few general points of note.


  1. The language used is C#
  2. m_CMS is an object of type contentmanagerservice1
  3. log is an object of type Category from log4net logging library (http://logging.apache.org/log4net/). Its the .NET implementation of log4j and is an amazing library. 


       
public String GetAdvancedSettings()
{
    String config = "<settings></settings>";
    try
    {
        searchPathMultipleObject spmo = new searchPathMultipleObject();

        // Default and hard-coded search path of /configuration
        spmo.Value = "/configuration";

        /**
        * Make sure you use ONLY the properties that you want
        * I tried selecting ALL properties A-Z one time ...
        * turns out it wasn't one of my finest moments ;-)
        */
        propEnum[] props = new propEnum[] { propEnum.searchPath, propEnum.defaultName, propEnum.advancedSettings };

        baseClass[] bcConf = m_CMS.query(spmo, props, new sort[] { }, new queryOptions());

        if (bcConf.Length > 0)
        {
            configuration conf = (configuration)bcConf[0];
            anyTypeProp atp = (anyTypeProp)conf.advancedSettings;

            config = atp.value;
            log.Debug("Successfully retrieved advanced settings.");
        }
        else {
            log.Debug("No advanced settings set. Retrieved empty result");
        }
    }
    catch (Exception ex)
    {
        log.Error("Error in setting configuration. Error: " + ex.Message);
    }
    return config;
}


And below is a function that makes use of the above function and saves additional settings to the content store.



       

public Boolean SetAdvancedSettings(String configname, String configvalue)
{
    try
    {
        String config = GetAdvancedSettings();
        // Dirty hack instead of using a proper XML reader / writer
        // Gets the job done ;-)

        config = config.Replace("</settings>", "");
        config += "<setting name=\"" + configname + "\">" + configvalue + "</setting></settings>";

        anyTypeProp atp = new anyTypeProp();
        atp.value = config;

        configuration conf = new configuration();
        conf.advancedSettings = atp;

        m_CMS.update(new baseClass[] { conf }, new updateOptions());

        log.Debug("Successfully set advanced settings.");
        return true;
    }
    catch (Exception ex)
    {
        log.Error("Error in setting configuration. Error: " + ex.Message);
        return false;
    }
}