cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From miguelaferreira <...@git.apache.org>
Subject [GitHub] cloudstack pull request: Map LDAP group to Cloudstack account
Date Mon, 28 Dec 2015 18:35:17 GMT
Github user miguelaferreira commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1285#discussion_r48496732
  
    --- Diff: plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java
---
    @@ -111,19 +114,27 @@ public LdapAuthenticator(final LdapManager ldapManager, final UserAccountDao
use
             return new Pair<Boolean, ActionOnFailedAuthentication>(result, action);
         }
     
    -    private void enableUserInCloudStack(UserAccount user) {
    -        if(user != null && (user.getState().equalsIgnoreCase(Account.State.disabled.toString())))
{
    +    private void enableUserInCloudStack(final UserAccount user) {
    +        if (user != null && user.getState().equalsIgnoreCase(Account.State.disabled.toString()))
{
                 _accountManager.enableUser(user.getId());
             }
         }
     
    -    private void createCloudStackUserAccount(LdapUser user, long domainId, short accountType)
{
    -        String username = user.getUsername();
    -        _accountManager.createUserAccount(username, "", user.getFirstname(), user.getLastname(),
user.getEmail(), null, username, accountType, domainId, username, null,
    -                                          UUID.randomUUID().toString(), UUID.randomUUID().toString(),
User.Source.LDAP);
    +    private void createCloudStackUserAccount(final LdapUser user, final long domainId,
final short accountType) {
    +        final String username = user.getUsername();
    +        final Account account = _accountManager.getActiveAccountByName(ldapGroupName,
domainId);
    +        if (account == null) {
    +            s_logger.info("Account (" + ldapGroupName + ") for LDAP group does not exist.
Creating account and user (" + username + ").");
    +            _accountManager.createUserAccount(username, "", user.getFirstname(), user.getLastname(),
user.getEmail(), null, ldapGroupName, accountType, domainId,
    +                            username, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(),
User.Source.LDAP);
    +        } else {
    +            s_logger.debug("Account (" + ldapGroupName + ") for LDAP group already exists
not exist. Creating user (" + username + ").");
    --- End diff --
    
    That's a copy & paste mistake. I'll fix it. Thanks for bringing it up


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message