Search in sources :

Example 1 with UserStoreProviderWithAddGroup

use of com.tremolosecurity.provisioning.core.UserStoreProviderWithAddGroup in project OpenUnison by TremoloSecurity.

the class DoesGroupExist method doTask.

@Override
public boolean doTask(User user, Map<String, Object> request) throws ProvisioningException {
    String localGroupName = task.renderTemplate(groupName, request);
    UserStoreProviderWithAddGroup provTarget = (UserStoreProviderWithAddGroup) GlobalEntries.getGlobalEntries().getConfigManager().getProvisioningEngine().getTarget(this.target).getProvider();
    if (provTarget.isGroupExists(localGroupName, user, request)) {
        user.getAttribs().put(this.attributeName, new Attribute(this.attributeName, "true"));
    } else {
        user.getAttribs().put(this.attributeName, new Attribute(this.attributeName, "false"));
    }
    return true;
}
Also used : Attribute(com.tremolosecurity.saml.Attribute) UserStoreProviderWithAddGroup(com.tremolosecurity.provisioning.core.UserStoreProviderWithAddGroup)

Example 2 with UserStoreProviderWithAddGroup

use of com.tremolosecurity.provisioning.core.UserStoreProviderWithAddGroup in project OpenUnison by TremoloSecurity.

the class AddGroupToStore method doTask.

@Override
public boolean doTask(User user, Map<String, Object> request) throws ProvisioningException {
    UserStoreProvider target = task.getConfigManager().getProvisioningEngine().getTarget(this.target).getProvider();
    if (target instanceof UserStoreProviderWithAddGroup) {
        request.put("WORKFLOW", this.task.getWorkflow());
        Map<String, String> localAttrs = new HashMap<String, String>();
        localAttrs.putAll(attributes);
        for (String key : localAttrs.keySet()) {
            localAttrs.put(key, task.renderTemplate(localAttrs.get(key), request));
        }
        for (String name : names) {
            if (!((UserStoreProviderWithAddGroup) target).isGroupExists(task.renderTemplate(name, request), user, request)) {
                ((UserStoreProviderWithAddGroup) target).addGroup(task.renderTemplate(name, request), localAttrs, user, request);
            }
        }
    } else {
        logger.warn("Target '" + this.target + "' can not add groups");
    }
    return true;
}
Also used : HashMap(java.util.HashMap) UserStoreProviderWithAddGroup(com.tremolosecurity.provisioning.core.UserStoreProviderWithAddGroup) UserStoreProvider(com.tremolosecurity.provisioning.core.UserStoreProvider)

Example 3 with UserStoreProviderWithAddGroup

use of com.tremolosecurity.provisioning.core.UserStoreProviderWithAddGroup in project OpenUnison by TremoloSecurity.

the class DoesGroupExist method doTask.

@Override
public boolean doTask(User user, Map<String, Object> request) throws ProvisioningException {
    String localGroupName = task.renderTemplate(groupName, request);
    UserStoreProviderWithAddGroup provTarget = (UserStoreProviderWithAddGroup) GlobalEntries.getGlobalEntries().getConfigManager().getProvisioningEngine().getTarget(this.target).getProvider();
    if (provTarget.isGroupExists(localGroupName, user, request)) {
        user.getAttribs().put(this.attributeName, new Attribute(this.attributeName, "true"));
    } else {
        user.getAttribs().put(this.attributeName, new Attribute(this.attributeName, "false"));
    }
    return true;
}
Also used : Attribute(com.tremolosecurity.saml.Attribute) UserStoreProviderWithAddGroup(com.tremolosecurity.provisioning.core.UserStoreProviderWithAddGroup)

Aggregations

UserStoreProviderWithAddGroup (com.tremolosecurity.provisioning.core.UserStoreProviderWithAddGroup)3 Attribute (com.tremolosecurity.saml.Attribute)2 UserStoreProvider (com.tremolosecurity.provisioning.core.UserStoreProvider)1 HashMap (java.util.HashMap)1