Check if a user is a member of a specific group in AD

Hello guys,
I'm working on a c# webpart which alows users to sign in for lunch.  
Basically i want to find if the current logged in user is in a specific group in AD, and then insert that group name into a list.  could anyone give me any pointers?!  Many thanks!
Matt

public class ADGroupMembership : WebPart
protected override void CreateChildControls()
if (!this.Visible) return;
foreach (string str in GetCurrentUserGroups())
if (string.Compare(str, "Everyone") == 0)
// allow logic
LiteralControl ctrl = new LiteralControl("User is OK");
this.Controls.Add(ctrl);
break;
base.CreateChildControls();
public List<string> GetCurrentUserGroups()
List<string> groups = new List<string>();
foreach (System.Security.Principal.IdentityReference group in System.Web.HttpContext.Current.Request.LogonUserIdentity.Groups)
groups.Add(group.Translate(typeof(System.Security.Principal.NTAccount)).ToString());
return groups;
Source:
http://www.codeproject.com/KB/system/everythingInAD.aspx

Similar Messages

  • Active Directory users not made member of Local Network group

    Hi all,
    I've just done a clean install from 10.6 Server to 10.8.4.
    The issue I seem to be having is a mismatch between what Groups in Server.app is reporting as members (who happen to be users or groups from our Active Directory domains) of a Local Network group and what dseditgroup reports as members of the same network.
    The Setup:
    In Groups in Server.app under Local Network Group I have created a group call "AccessServer"
    Members in that group are:
         - AD-Domain User Group (so should be all users in the domain)
         - MacOS X "netaccounts" group (again, should capture all users that connect through the network I've used this in the past/10.6 very handy)
         - AD User 1
         - AD User 2
         - AD User 3
    The Server is bound to the AD Domain, All-Domains is not selected and a Search Path is added for each Domain needed and set at the top of the search order.
    The Behaviour:
    AD User 1 can access AFP and other services as expected.
    AD User 2 and 3 cannot.
    Another user within AD-Domain User Group or netaccounts can access AFP and other services as expected
    Yet other users within AD-Domain User Group or netaccounts cannot
    Furthermore: 
    If I REMOVE AD User 1 (a working user) *and* the AD Domain Group and netaccounts Group.  I can still login with that account!
    Diagnosis:
    I tried checking group membership with dseditgroup, the results match the behaviour, not the setup.
    >dseditgroup -o checkmember -m ADUser1 accessserver
    yes ADUser1 is a member of accessserver
    >dseditgroup -o checkmember -m ADUser2 accessserver
    no ADUser2 is NOT member of accessserver
    >dseditgroup -o checkmember -m ADDomainUser/netacc accessserver
    yes ADDomainUser/netacc is a member of accessserver
    >dseditgroup -o checkmember -m n accessserver
    no ADUser2 is NOT member of accessserver
    When non-member users try to connect I get a message in the logs of (IP/DNS values anonymized):
    2013-06-25 3:04:36.794 PM sshd[5217]: error: PAM: authentication error for illegal user ----- from ----.mala.bc.ca via x.x.
    I get the same results even after removing the user from the Groups screen!
    Failed Solutions
    - As we are a large AD I've tried specifying specific Active Direcotry servers that might better be able to find the users in question and authenticate.
    - I've let the system just sit, in hopes delayed replication would solve the problem overnight.
    - I've deleted and recreated the groups.

    Upon further investigation we have discovered:
    a) the main behaviour that is causing the problem is best described as AD users that are added to a Local or Network OS X group... either individually or through a Domain group.... are not actually recognized as members of that OS X group even though the GUI or CLI tool have added them and acknowledge them as being in the list.
    b)  This is NOT limited only to MacOS X Server 10.8.  The same behaviour is occuring on a long-running 10.6 server as well.
    c) The problem remains whether we nest AD groups to capture a large bunch of users, or add users individually.  If the user is part of the mysteriously denied set, how they are added to the OD or local group is irrelevant, including if added from the command line.
    d) Which users are allowed and which are not is unclear and appears generally random.  We have found 3 'classes' of users:    
              1 - those that are successfully becoming members every time.
              2 - those that are intermittent members.  Members on one server or another, or in one case even go from being reported as a member (by dseditgroup), to not being a member, to being a member again within the span of only a minute or two.
              3 - those that are never successfully admitted as a member.
    So the problem is both Apple's and Windows in that:
    Apple: Is allowing a group and/or user to be added and implying then membership in the group even though that membership is not being honoured in some way and there is no feedback or communication of that fact aside from generic 'denied' or 'illegal user' errors.
    Windows:  Is passing along membership through its groups and users, but not completely, for reasons that are, at this point, a mystery.
    Really hoping people have some ideas on this.  This system of nested groups or individual user access is something we have of course being using for many years.  So this is a major setback.

  • Not a member of the Administrators group

    My wife wants to use my iMac to do office work for her employer at home. 
    To do this, she has to install some employer software on my iMac.  But when she tries to install her employers Mac software, she get the message "Hardware installation cannot start with this user account.  Make sure that the user is a member of the Administrators group on the computer."
    To make her a User/Admistrator, do I do the following:
    1)  Go into System Preferences and clicked on Users & Groups. 
    2)  With the Current User as Admin checked, clicked on the padlock to unlock it and type in my password.
    3)  With the padlock unlocked, under Login Options, do I click on the + to establish a new user account for her?
    4)  Then, highlight the new account and click on the box "Allow user to administer this computer" and relock the padlock?
    5)  When the computer reboots, will it reboot with her as Administrator so she can load her employers software?
    Once I have done this, in the future when she wants to use her new account, does she go into System Preferences - Users & Groups, unlock the padlock, click on her account to highlight it, relock the padlock and reboot the computer.
    Thanks,
    jzach52

    Yes to 1 thru 5
    To access the account it is faster just to logout and login rather than rebooting.

  • What's the best way to check whether a user is logged in or not?

    I have a question about basic session handling.
    I'm running Tomcat 5.0.30 and have a web application where users can register with a username and password, and then log into a "member site".
    What is the best way of making sure that a user actually has logged in or not?
    What I've done in previous applications I've made is that I've just put a simple variable into the users session after he has successfully entered his password (i.e. Boolean loggedIn=true). Then I just test if this flag is true to grant him access to the member site. Is that a smart way of doing it?
    Are there any libraries I can use which handles sessions for me in a secure way?
    All comments and suggestions are appreciated!

    Maintain a flag using session attributes it to one when the user is logs in set it to value.... and change set it zero or invalidate that session... when the user is logged out...
    use something like this while user had logged in
    session.setAttribute("flag",<unique_number>);
    for checking whether the user had logged in or not...
    if(Integer.parseInt(session.getAttribute("flag").toString())=!<unique_number>){
    out.println("The session had expired");
    out.close();
    }

  • Script to find users that are a member of more than one of a list of specific groups

    Hi,
    I need to generate a list of users that are members in more than one group, out of a list of specific security groups.  Here's the situation:
    1) We have about 1100 users, all nested under a specific OU called CompanyUsers.  There are sub-OUs under CompanyUsers that users may actually be in.
    2) We have about 75 groups, all directly under a specific OU called AppGroups.  These groups correspond to a user's role within an internal line of business application.  All these groups start with a specific character prefix "xyz", so the group
    name is actually "xyz-approle".
    I want to write a script that tells me if a user from point 1) is a member in more than one group in point 2).  So far, I've come up with a way to enumerate the users to an array:
    $userlist = get-qaduser -searchroot 'dq.ad/dqusers/doral/remote' | select samaccountname |Format-Table -HideTableHeaders
    I also have a way to enumerate all the groups that start with xyz that the user is a member of:
    get-QADMemberOf -identity <username> -name xyz* -Indirect
    I figure I can use the first code line to start a foreach loop that uses the 2nd code line, outputting to CSV format for easy to see manual verification.  But I'm having two problems:
    1) How to get the output to a CSV file in the format <username>,groupa,groupb,etc.
    2) Is there any easier way to do this, say just outputting the users in more than one group?
    Any help/ideas are welcome.
    Thanks in advance!
    John

    Here is a PowerShell script solution. I can't think of way to make this more efficient. You could search for all groups in the specfied OU that start with "xyz", then filter on all users that are members of at least one of these groups. However, I suspect
    that most (if not all) users in the OU are members of at least one such group, and there is no way to filter on users that are members of more than one. This solution returns all users and their direct group memberships, then checks each membership to
    see if it meets the conditions. It outputs the DN of any user that is a member of more than one specfied group:
    # Search CompanyUsers OU.
    strUsersOU = "ou=CompanyUsers,ou=West,dc=MyDomain,dc=com"
    $UsersOU = New-Object System.DirectoryServices.DirectoryEntry $strUsersOU
    # Use the DirectorySearcher class.
    $Searcher = New-Object System.DirectoryServices.DirectorySearcher
    $Searcher.SearchRoot = $UsersOU
    $Searcher.PageSize = 200
    $Searcher.SearchScope = "subtree"
    $Searcher.PropertiesToLoad.Add("distinguishedName") > $Null
    $Searcher.PropertiesToLoad.Add("memberOf") > $Null
    # Filter on all users in the base.
    $Searcher.Filter = "(&(objectCategory=person)(objectClass=user))"
    $Results = $Searcher.FindAll()
    # Enumerate users.
    "Users that are members of more than one specified group:"
    ForEach ($User In $Results)
        $UserDN = $User.properties.Item("distinguishedName")
        $Groups = $User.properties.Item("memberOf")
        # Consider users that are members of at least 2 groups.
        If ($Groups.Count -gt 1)
            # Count number of group memberships.
            $Count = 0
            ForEach ($Group In $Groups)
                # Check if group Common Name starts with the string "xyz".
                If ($Group.StartsWith("cn=xyz"))
                    # Make sure group is in specified OU.
                    If ($Group.Contains(",ou=AppsGroup,"))
                        $Count = $Count +1
                        If ($Count -gt 1)
                            # Output users that are members of more than one specified group.
                            $DN
                            # Break out of the ForEach loop.
                            Break
    Richard Mueller - MVP Directory Services

  • Vb scripts to remove the user from the member of perticular group (say from domain admin) from windows servers 2003 and 2008

    Hi,
    I need VB script which to checks the perticular user in AD and if it exists;that user needs to be removed from the member of perticular group
    Ex:- Lets say
    I have a user 783562 , I need to search this user in AD to verify user exists or not. If not then I no need to remove the mebership from perticular group
    Second scenario:-
    If user exists then I need to remove the user membership from the perticular group.I want to do it in automation
    Manual Path:-
    1.Type dsa.msc in run command of IT session(we using it to connect remote desktop).
    2. Select the domain & right click (EX:-corp.ds.xxyyzz.com) and select "Find" to find the user form the domain.
    3. Type the user name in the Name field and click on "Find Now" button user name will be displayed in search result.
    4. Double click on this user ID and select "Member Of" tab.
    5. Select any member of group from the Name section then click on "Remove" button.
    6. Finally click on "Apply" and "OK" button.
    Kindly help me out to do this by using vb script.
    Thanks
    Raja

    Usage: CScript NameOfVBS.vbs //NOLOGO /User:Jane.Doe /GroupDN:CN=Group1,DC=Contoso,DC=com
    Option Explicit
    On Error Resume Next
    Dim str_User
    Dim str_GroupDN
    Dim obj_Connection
    Dim obj_Command
    Dim obj_RootDSE
    Dim str_DNSDomain
    Dim str_Base
    Dim str_Filter
    Dim str_Attributes
    Dim str_Query
    Dim obj_RecordSet
    Dim obj_Group
    Dim str_ADsPath
    Dim obj_User
    str_User = WScript.Arguments.Named("User")
    str_GroupDN = WScript.Arguments.Named("GroupDN")
    If Len(Trim(str_User)) > 0 And Len(Trim(str_GroupDN)) > 0 Then
    Set obj_Connection = CreateObject("ADODB.Connection")
    Set obj_Command = CreateObject("ADODB.Command")
    obj_Connection.Provider = "ADsDSOOBject"
    obj_Connection.Open "Active Directory Provider"
    Set obj_Command.ActiveConnection = obj_Connection
    Set obj_RootDSE = GetObject("LDAP://RootDSE")
    str_DNSDomain = obj_RootDSE.Get("defaultNamingContext")
    str_Base = "<LDAP://" & str_DNSDomain & ">"
    str_Filter = "(&(objectCategory=person)(sAMAccountName=" & str_User & "))"
    str_Attributes = "cn,ADsPath"
    str_Query = str_Base & ";" & str_Filter & ";" & str_Attributes & ";subtree"
    obj_Command.CommandText = str_Query
    obj_Command.Properties("Page Size") = 1000
    obj_Command.Properties("Timeout") = 1
    obj_Command.Properties("Cache Results") = False
    Set obj_RecordSet = obj_Command.Execute
    obj_RecordSet.MoveFirst
    If obj_RecordSet.RecordCount = 0 Then
    WScript.Echo str_User & " was not found"
    Else
    Set obj_Group = GetObject("LDAP://" & str_GroupDN)
    str_ADsPath = obj_RecordSet.Fields("ADsPath")
    Set obj_User = GetObject(str_ADsPath)
    obj_Group.Remove(obj_User.AdsPath)
    If Err.Number = 0 Then
    WScript.Echo str_User & " was removed from group " & str_GroupDN
    ElseIf Err.Number = -2147016651 Then
    WScript.Echo str_User & " not a member of group " & str_GroupDN
    Else
    WScript.Echo str_User & " error removing from group " & str_GroupDN
    End If
    End If
    End If

  • Check if entered employee is member of the service group

    Hello,
    in servicerequest i need to check if the maintained employee is member of the maintained service group.
    Any suggestions for this requirement?
    Is there a function module to check with the employee ID in which groups this employee is assigned?
    Thank you
    Kind regards
    Manfred

    Hi Manfred,
    You can use FM RH_STRUC_GET to achieve that. You can get an example in how to do that using FM CRM_EMPLOYEE_GETORGUNIT and puting an breakpoint at FM RH_STRUC_GET call. The problem with FM CRM_EMPLOYEE_GETORGUNIT is that it only returns one result, so you need to adapt to get multiple assignments.
    If in your scenario, instead of employee ID, you can check with the User ID, you may use static method GET_ASSIGNMENTS_OF_USER of class CL_CRM_PPM_UM_TOOLKIT to get all the information you need.
    Check if it helps you a little more.
    Kind regards,
    Garcia

  • SharePoint 2013 workflow 'If current user is a member of a group'

    I would like my workflow to check if the user who created the current item is a member of a group, preferably an Active Directory group but if not a SharePoint group.
    How can I do this please?
    Thanks
    Julie
    J Sykes

    Hi,
    You need to install the CodePlex solution(UsefulSPDWorkflowActivities_0.5.0.zip) from the following URL to the get custom activities in the SharePoint Designer.
    http://spdactivities.codeplex.com/
    Once you download, you will have setup instructions file, follow these instructions to install the solution (Installguide.txt).
    I would suggest you to use the SharePoint 2013 style workflow, as we need to implement latest one, may be 2010 style workflows will be removed with the latest version of SharePoint later.  And also other thing, you will not have to depend on the other
    solutions such as CodePlex
    Use the "Call Http Web Service" action and use the REST API to check whether the user is in within group.
    http://sharepoint/_api/SP.AppContextSite(@target)/web
    /getbyname('Approvers')/Users?$filter=Id eq " + CurrentItem.CreatedBy.ID + "
    ?@target='http://sharepoint'
    http://msdn.microsoft.com/en-us/library/office/dn531432(v=office.15).aspx
    http://blog.vgrem.com/2014/05/08/consuming-the-sharepoint-2013-rest-service-from-sharepoint-designer/
    Please don't forget to mark it answered, if your problem resolved or helpful.

  • How to check if a user fills a header text in billing invoice

    Hi everybody and thanks in advance.
    My consultant wants to oblige all users to fill a header text when they create the billing invoice (vf01).
    I was looking for several user exits when I can manage this requisite.
    My problem is that when the user creates the invoice and push save button, I try to look for in the table STXH if the user created the header text. But I have not found anything, because the invoice has not created yet.
    Only when the billing invoice has saved, the header text is stored in the table STXH.
    I has been trying to find a structure wich contains the header data like xvbrk contains the data about type of invoice, etc.
    I have studied this user exits:
    userexit_number_range (module pool saplv60A, program rv60afzz)
    userexit_account_prep_komkcv (same module)
    userexit_account_prep_kompcv (same module)
    userexit_fill_vbrk_vbrp (same module)
    v60A0001 (Customer functions in the billing document).
    My question is: In which structure is the header text of billing invoice manage before push the save button?
    If I knew where it is, I could manage the data and check if the user filled the header text.
    Thank you very much, and sorry for my pour English.

    David,
    Place this code into USEREXIT_NUMBER_RANGE:
    DATA: CATALOG LIKE TCATALOG OCCURS 0 WITH HEADER LINE,
          MEMORY_ID(30).
    data: c_MEMORY_ID(30) VALUE 'SAPLSTXD'.
    DATA l_head type THEAD.
    DATA wa_head type THEAD.
    data: l_lines type table of TLine.
    data: l_line type TLine.
    DATA l_CATALOG type TCATALOG.
    IMPORT CATALOG FROM MEMORY ID 'SAPLSTXD'.
    loop at catalog into l_catalog.
       if  l_catalog-IS_REFTEXT is initial
       and l_catalog-keep is initial.
         concatenate c_memory_id l_catalog-id into memory_id.
         import thead to l_head
                tline to l_lines
           from memory id memory_id.
         loop at l_lines into l_line.
           message i000(zz) with l_line-TDLINE.
         endloop.
       endif.
    endloop.
    It will expose the text entered into the text ids in a message box (for now).  You will want to replace the MESSAGE statement with your own logic.
    You may also need to change the message numver/class from ZZ - as seen here "message i000(zz) with l_line-TDLINE."  with an appropriate message on your system.
    DON'T forget those points.

  • Check java on users PC and give message

    The following code has been written with Java 1.4 and works great, but if a user has Java 1.3 they get an error message and if a user has Java 1.2 nothing happens at all. Is there a way to check if the user is using a version older than 1.4 and if so pop up a message telling them they need to download a newer version of Java?
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.List;
    import java.io.*;
    import java.util.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import org.w3c.dom.*;
    public class Sametime extends JFrame implements ActionListener {
        private int indentation = -1;
        JPanel panel = new JPanel();
        JTextArea jta = new JTextArea(
        //Instructions for user
        "For a successful buddy list migration do the following:\n"
        + "1. Save your current Sametime Buddy List to your PC.\n   "
        + "The default location should be: C:/Program Files/Lotus/Sametime Client.\n"
        + "  A. Open the Sametime Client.\n"
        + "  B. Click on People\n"
        + "  C. Click on Save List.\n"
        + "  D. Save as your first.last.dat\n"
        + "     Ex. john.doe.dat\n"
        + "NOTE: If you have AOL contacts in your Sametime buddy list they will not be migrated.\n");
        JButton browse = new JButton("Continue");
        JButton exit = new JButton("Exit");
        public Sametime() {
            super("Sametime Buddy List Migration");
            setSize(610, 245);
            Container c = this.getContentPane();
            c.add(panel);
            browse.addActionListener(this);
            exit.addActionListener(this);
            panel.add(jta);
            panel.add(browse);
            panel.add(exit);
            jta.setEditable(false);
            setLookAndFeel();
            setVisible(true);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        } //end Sametime
        public class DATFilter extends javax.swing.filechooser.FileFilter {
            public boolean accept(File f) {
                //if it is a directory -- we want to show it so return true.
                if (f.isDirectory())
                    return true;
                String extension = getExtension(f);//get the extension of the file
                //check to see if the extension is equal to "dat"
                if ((extension.equals("dat")))
                    return true;
                //default -- fall through. False is return on all
                //occasions except:
                //a) the file is a directory
                //b) the file's extension is what we are looking for.
                return false;
            }//end accept
            public String getDescription() {
                return "dat files";
            }//end getDescription
             * Method to get the extension of the file, in lowercase
            private String getExtension(File f) {
                String s = f.getName();
                int i = s.lastIndexOf('.');
                if (i > 0 &&  i < s.length() - 1)
                    return s.substring(i+1).toLowerCase();
                return "";
            }//end getExtension
        }//end class DATFilter
        public void actionPerformed(ActionEvent e) {
            //Default Location for JFileChooser search
            String error = "The file selected is not a .dat file!\n"
            + "Please select your recently saved .dat file and try again.";
            JFileChooser fc = new JFileChooser("/Program Files/Lotus/Sametime Client");
            fc.setFileFilter(new DATFilter());
            fc.setFileSelectionMode( JFileChooser.FILES_ONLY);
            String user = System.getProperty("user.name");// finds who the current user is
            if (e.getSource() == browse) {
                int returnVal = fc.showSaveDialog(Sametime.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    //if (fc.getSelectedFile().getName().equals(".dat")){
                    if (fc.getSelectedFile().getName().endsWith(".dat")){ // checks to see if selected file is .dat
                    }else{
                        JOptionPane.showMessageDialog(null, error, "Wrong File", JOptionPane.ERROR_MESSAGE);
                        return;
                    }//end else
                    try {
                        String[] contactArray = parseDatFile(fc.getSelectedFile());
                        Document document = createXMLDocument(contactArray);
                        saveToXMLFile(
                        document,
                        new File(
                        "C:/Documents and Settings/" + user +"/My Documents/OLCS/",// looks for directory for list
                        "contacts-list_migration.ctt"));
                    } catch (Exception exc) {
                        File f = new File("C:/Documents and Settings/" + user +"/My Documents/OLCS/");// setting directory for list if not there
                        boolean yes = true;
                        yes = f.mkdir();// creating directory
                        try {
                            String[] contactArray = parseDatFile(fc.getSelectedFile());
                            Document document = createXMLDocument(contactArray);
                            saveToXMLFile(
                            document,
                            new File(
                            "C:/Documents and Settings/" + user +"/My Documents/OLCS/",// used only if the directory didn't exist
                            "contacts-list_migration.ctt"));
                            //exc.printStackTrace();// not sure if this is needed?
                        } catch (Exception exc1) {
                            exc1.printStackTrace();
                        }//end inner catch
                    }// end catch
                }// end if
                if(returnVal==JFileChooser.CANCEL_OPTION){
                    String Warning = "You did not migrate your Sametime buddy list at this time.";
                    JOptionPane.showMessageDialog(null, Warning, "Migration Canceled", JOptionPane.WARNING_MESSAGE);
                    return;
                }else{
                    String thankyou = "Thank You for Migrating your Sametime buddy list to OLCS"
                    + "\nYour new OLCS buddy list has been saved to:"
                    + "\nC:/Documents and Settings/" + user +"/My Documents/OLCS"
                    + "\n as: Contact-List_migration.ctt"
                    + "\n\n To be able to use Contact-List_migration.ctt for Windows Messenger:"
                    + "\n1. Log into Windows Messenger."
                    + "\n2. Click on File"
                    + "\n3. Click on 'Import Contacts from a Saved File...'"
                    + "\n4. Open OLCS in My Documents"
                    + "\n5. Click on 'Contact-list_migration.ctt'"
                    + "\n6. Click Open to import the list."
                    + "\n   A window will pop up confirming that you want to add all of the contacts"
                    + "\n   Click 'yes'"
                    + "\n   Your buddy list is ready to be used.";
                    JOptionPane.showMessageDialog(null, thankyou, "Migration Completed", JOptionPane.INFORMATION_MESSAGE);//Change this when defualt directory is known.
                }//end if else statement
            } //end if
            System.exit( 0 );
            if (e.getSource() == exit) {
                System.exit( 0 );
            } //end if
        } //end actionPerformed
        String[] parseDatFile(File datFile)
        throws Exception    {
            List list = new ArrayList();
            BufferedReader br = new BufferedReader(new FileReader(datFile));
            String line;
            while ((line = br.readLine()) != null) {
                line = line.trim();
                if (line.indexOf("U") != 0)
                    continue;
                int p = line.indexOf("::");
                if (p == -1)
                    continue;
                line = line.substring(p + 2).trim();
                if (line.indexOf("AOL") == 0)
                    continue;
                p = line.indexOf(",");
                if (p != -1)
                    line = line.substring(0, p);
                line = line.trim() + "@mci.com";
                if (list.indexOf(line) == -1)
                    list.add(line);
            }//end while
            br.close();
            String[] contactArray = new String[list.size()];
            list.toArray(contactArray);
            return contactArray;
        }// end String
        // setting up the XML file
        Document createXMLDocument(String[] contactArray) throws Exception {
            DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = dBF.newDocumentBuilder();
            DOMImplementation domImpl = builder.getDOMImplementation();
            Document document = domImpl.createDocument(null, "messenger", null);
            Element root = document.getDocumentElement();
            Element svcElm = document.createElement("service");
            Element clElm = document.createElement("contactlist");
            svcElm.setAttribute("name", "Microsoft RTC Instant Messaging");
            svcElm.appendChild(clElm);
            root.appendChild(svcElm);
            for (int i = 0; i < contactArray.length; i++) {
                Element conElm = document.createElement("contact");
                Text conTxt = document.createTextNode(contactArray);
    conElm.appendChild(conTxt);
    clElm.appendChild(conElm);
    }//end for
    return document;
    }// end Document
    void saveToXMLFile(Document document, File xmlFile) throws Exception {
    OutputStream os =
    new BufferedOutputStream(new FileOutputStream(xmlFile));
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");//puts information on seperate lines
    transformer.setOutputProperty(OutputKeys.METHOD, "xml");
    transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");//gives the XML file indentation
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
    DOMSource source = new DOMSource(document);
    StreamResult result = new StreamResult(os);
    transformer.transform(source, result);
    os.close();
    }//end saveToXMLFile
    public static void main(String[] args) {
    Sametime st = new Sametime();
    ImageIcon picIcon = new ImageIcon(st.getClass().getResource("/ST_Migration/images/mci.gif"));//Change when default is known!
    st.setIconImage(picIcon.getImage());
    } //end main
    private void setLookAndFeel() {
    try {
    UIManager.setLookAndFeel(
    UIManager.getSystemLookAndFeelClassName());
    SwingUtilities.updateComponentTreeUI(this);
    } catch (Exception e) {
    System.err.println("Could not use Look and Feel: " + e);
    } //end catch
    } //end void setLookAndFeel
    } //end public class Sametime

    Well, if you don't want to use Package.isCompatibleWith and the version numbers will always be of the form x.y where y is at most one digit, you can use Double.parseDouble() and then compare the numbers. Otherwise you need to write a method of your own.

  • Where to check whether the user is Admin  or developer?

    how to check whether the user is Admin or developer????? after he sign's in......I want to use role based login!!!!

    Login into a workspace or login into an application?
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How can I check if an user has access to an url within my web app?

    Hi,
    I have a web application where I allow the users to set their startup page by presenting them a list of startup pages. However, some startup pages can accessed only by certain users, so I want to present the user only those pages the user has access to.
    How can I do this with weblogic?
    One way is to read the web.xml file and determine the roles that have access to the page, then check whether the user has any of those roles.
    Is there a better way eventually using some weblogic api?
    Thanks

    Just for the record, I decided to parse the web.xml file and to simulate whatever the container does.

  • How to check if a user session is active in Java application server

    Hi Experts,
          We have a online scenario with a third party system by which a portal user will launch the third party application in a new window from portal. The SSO will work at the third party web application with the dynamic key that is generated by calling a webservice for that user. Now, as the user works on the launched screen, they will have to check whether the user (logged in portal) session is still active. ie., they will be periodically calling a service hosted by SAP java application server to find out whether the corresponding user who launched the session is still logged in or logged out.
    So, my question is, how can i find out programatically whether a user/user's session is still logged in/active in SAP Netweaver Java AS? We are in version 7.3.
    Kindly help me in this regard.
    Regards
    Vijay.K

    Hi Vijay,
    Could you check below links
    Tracing Single User Sessions - Administration - SAP Library
    Display and Manage User Sessions (SAP Library - Tools for Monitoring the System)
    Hope this helps.
    Regards,
    Deepak Kori

  • Is it possible to check if a user has a device font before using it?

    It's all in the title really. I was hoping there might be a way to check if the user had a certain font already installed on there computer to try and save loading the font at runtime when not needed. Is this possible with Flex4 and the new TLF?
    Thanks
    Ollie

    Font.enumerateFonts(true); will give you an array of device and embedded fonts.

  • How to check if a user has SAP_ALL in a program?

    Hi:
    I want to create a program that will check if the user has SAP_ALL. Is there a standard FM or BAPI?. Otherwise, can someone pelase help.
    Thank you.
    Seshagiri Gopi

    Hi,
    Please check the below link:
    http://wiki.sdn.sap.com/wiki/display/BI/AuthorizationinSAPNWBI
    Regards,
    Nilesh.

Maybe you are looking for

  • I'm using Firefox 3.6.23 on my windows 2000 and lately i've been having issues with web pages loading and need help figuring out why.

    Some of the issues : '''1'''. Page loads blank showing web address in tab. Try reloading usually with no results.(problem have the most!) '''2'''. Message appears "problem loading page, server not found" (diff times & diff websites). '''3.''' Pg with

  • Web browsing and file downloads stops

    Hi Guys, I've been looking at a few posts but not seen the answer yet.  I'd be grateful if someone could help me out or point me in the right direction. I had BT Infinity 2 installed with the HH5 on Friday.  I have problems with browsing web pages. 

  • Batch Export to Powerpoint?

    Hello, I'm in a bind, I have to take about 500 .pdf files and export them into Powerpoint. I know how to 'Export File To: Powerpoint Presentation' but I want to create a Batch command to export all of my PDF files to Powerpoint. But this option isn't

  • Flagged photos

    Along with iPhoto crashing, I have about 10 photos that I cannot unflag. They seem to be permanantly stuck in the flagged folder no matter how many different ways I try to get rid of them.

  • User exit for Tcode LI20

    Hi all, I need to find a user exit for T Code LI20, to update the Z tables. Thanks in advance Sree