8 Replies Latest reply on Feb 22, 2013 7:38 AM by 965440

    List of all roles a user belong

      I want to get a list of all roles a user belongs to using OIM 11g API.

      A sample code will be highly helpful.

        • 1. Re: List of all roles a user belong
          Nishith Nayan
          One I remember in 10g

          tcUserOperationIntf.getGroups(long plUserKey)

          try same one if it works.
          I will look at 11gAPI and let you know
          1 person found this helpful
          • 2. Re: List of all roles a user belong
            Nishith Nayan
            find the 11g API


            verify below code:

            import oracle.adf.share.logging.ADFLogger;

            import oracle.iam.identity.exception.NoSuchRoleGrantException;
            import oracle.iam.identity.exception.RoleGrantLookupException;
            import oracle.iam.identity.exception.UserMembershipException;
            import oracle.iam.identity.rolemgmt.api.RoleCategoryManager;
            import oracle.iam.identity.rolemgmt.api.RoleManager;
            import oracle.iam.identity.rolemgmt.api.RoleManagerConstants;
            import oracle.iam.identity.rolemgmt.vo.Role;
            import oracle.iam.identity.usermgmt.vo.User;
            import static oracle.iam.identity.utils.Constants.SEARCH_ENDROW;
            import static oracle.iam.identity.utils.Constants.SEARCH_STARTROW;
            import oracle.iam.platform.entitymgr.vo.SearchCriteria;
            import oracle.iam.platform.entitymgr.vo.SearchCriteria.Operator;
            import oracle.iam.ui.platform.model.config.ConstantsDefinition;

            public static final String ROLE_NAME = RoleManagerConstants.ROLE_NAME;
            public static final String ROLE_KEY = RoleManagerConstants.ROLE_KEY;

            private List<Role> getRoles(String userKey) {
            SearchCriteria criteria =
            new SearchCriteria(ROLE_NAME, ConstantsDefinition.WILDCARD, Operator.EQUAL);
            HashMap<String, Object> configParams = new HashMap<String, Object>();
            configParams.put(SEARCH_STARTROW, 0);
            configParams.put(SEARCH_ENDROW, 200);

            List<Role> roles = new ArrayList<Role>();

            try {
                      RoleManager roleMgr=Platform.service(RoleManager.class);
            criteria, null,
            configParams, true));

            } catch (Exception eUserMembershipException e) {
            return roles;
            1 person found this helpful
            • 3. Re: List of all roles a user belong

              Which jar contains the below class


              • 4. Re: List of all roles a user belong
                Karthik Perath
                If you are using JDeveloper IDE to develop this program you can get these libraries in <OIM_HOME>/jdev.lib.

                This particular import is available in OIM Model Shared Library.library in jdev.lib folder. Add these librares to classpath of your project.
                1 person found this helpful
                • 5. Re: List of all roles a user belong
                  Thanks Karthik.
                  Can you please tell me how can I add these in Eclipse.
                  • 6. Re: List of all roles a user belong
                    Nishith Nayan
                    for the time use "*" instead of ConstantsDefinition.WILDCARD and move ahead
                    • 7. Re: List of all roles a user belong
                      Thanks a Lot Nishith..
                      • 8. Re: List of all roles a user belong
                        Hi karthik,

                        I also wanted to kow the list of roles a user belongs to.

                        I am using Jdev.

                        I am unable to find Oracle Model Shared Library.

                        Can you please specify from where can I get this libraray.