Quantcast
Viewing all articles
Browse latest Browse all 10473

Adding A Ldap group

Can you please provide an alternate way of adding a new ldap group versus just creating it in CMC and then doing the ldap update from authentication in CMC? ( we are unable to us ethat at this time)


Can the following be used:

<%@ page import = "com.crystaldecisions.sdk.framework.*"%>
<%@ page import = "com.crystaldecisions.sdk.exception.*"%>
<%@ page import = "com.crystaldecisions.sdk.occa.infostore.*"%>
<%@ page import = "com.crystaldecisions.sdk.occa.security.*"%>
<%@ page import = "com.crystaldecisions.sdk.occa.pluginmgr.*"%>
<%@ page import = "com.crystaldecisions.sdk.plugin.desktop.user.*"%>
<%@ page import = "com.crystaldecisions.sdk.plugin.desktop.usergroup.*"%>
<%@ page import = " com.crystaldecisions.sdk.plugin.desktop.common.*"%>
<%@ page import = "java.util.*"%>

<html>
<head>
<title>Add User Group</title>
</head>
<body>

<%
// Set the logon information
    String boUser = "Administrator";
    String boPassword = "";
    String boCmsName = "localhost";
    String boAuthType = "secEnterprise";

// Declare Variables
    IInfoStore boInfoStore=null;
IInfoObjects boInfoObjects=null;
SDKException failure = null;
IEnterpriseSession boEnterpriseSession = null;
   
IPluginMgr boPluginMgr = null; //Plugin Manager returned from InfoStore
    IPluginInfo boUserGroupPlugin = null; //User PluginInfo object
    IInfoObjects boNewInfoObjects = null; //new collection created from InfoStore
    IInfoObject boNewUserGroup = null;
    IUserGroup boUserGroupPluginInfo = null; //IUser interface to allow us to change user specific settings
    IInfoObject boExistingUser = null;
    Set boUserList = null;
   
   try{
        // Logon and obtain an Enterprise Session
     boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( boUser, boPassword, boCmsName, boAuthType);

        boInfoStore = (IInfoStore) boEnterpriseSession.getService("", "InfoStore");
       
   //Retrieve the PluginManager and use it to retrieve User plug-in.
        boPluginMgr = boInfoStore.getPluginMgr();
        boUserGroupPlugin = boPluginMgr.getPluginInfo("CrystalEnterprise.UserGroup");
       
   //Create a new, empty InfoObjects collection.
        boNewInfoObjects = boInfoStore.newInfoObjectCollection();

        //Add the plug-in to the collection.  This creates a new InfoObject that represents a new User
        boNewUserGroup = boNewInfoObjects.add(boUserGroupPlugin);

        //Set the name and description of the User.
        boNewUserGroup.setTitle("New User Group");
        boNewUserGroup.setDescription("A new user group created by AddUserGroup.jsp");

        //cast the InfoObject as an IUserGroup to retrieve the Set object
        boUserGroupPluginInfo = (IUserGroup) boNewUserGroup;
        boUserList = boUserGroupPluginInfo.getUsers();

        //retrieve the SI_ID of the user we wish to add to the group
        //assign this ID value to an Integer object
        boExistingUser = (IInfoObject)boInfoStore.query("SELECT SI_ID From CI_SYSTEMOBJECTS Where SI_PROGID='CrystalEnterprise.User' and SI_NAME = 'Guest'").get(0);
     Integer userID = new Integer(boExistingUser.properties().getProperty("SI_ID").toString());
       
        //add the Integer object to the Set object returend above
        boUserList.add(userID);

        //Commit the changes to the InfoStore.
        boInfoStore.commit(boNewInfoObjects);
        out.println("The New User Group has been created!");
     }
    catch(SDKException e)
    {
        out.println(e.getMessage());
    }
    finally
    {
     boEnterpriseSession.logoff();
    }
%>

</body>
</html>


Viewing all articles
Browse latest Browse all 10473

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>