Skip to main content

Posts

Showing posts with the label Active Directory

How to retrieve Attributes (fields) in Active Directory using jaggery?

We can get user attributes in Active Directory using jaggery and need to follow the steps which were provided in the previous blog . <% var carbon = require('carbon'); var tenantId = -1234; var url = 'https://localhost:9443/admin/services/'; var server = new carbon.server.Server(url); var userManager = new carbon.user.UserManager(server, tenantId); var result = userManager.getClaims("WSO2USERSTORE/testuser", "default"); for(i =0; i<result.length; i++){ print(result[i].getClaimUri() + " ==> " +result[i].getValue()); print('<br>'); } %> Here, getClaims(username String, profile String) method is used to get all claim values of the user in the profile and it returns a JSON object with all claims that user has and their values.

How to list all users belongs to particular user store using jaggery?

We can list all users belongs to particular user store using jaggery. To achieve this, create a directory(ListUser) inside "<BPS>/repository/deployment/server/jaggeryapps" and then create a jaggery file(listUser.jag) inside a newly created folder. In this example, I used WSO2 BPS to test this sample. Add the following content into listUser.jag file. <% var carbon = require('carbon'); var tenantId = -1234; var url = 'https://<HOSTNAME>:9443/admin/services/'; var server = new carbon.server.Server(url); var userManager = new carbon.user.UserManager(server, tenantId); print(userManager.getUserListOfRole("ROLE")); %> Here, you need to change the "HOSTNAME" and "ROLE" according to your config. Please find the sample listUser.jag blow, where my "HOSTNAME" is localhost and user "ROLE" is WSO2USERSTORE/clerk. <% var carbon = require('carbon'); var tenantId = -1234; var url = 'http...