You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/05/08 12:42:07 UTC
[GitHub] rafaelweingartner closed pull request #2619: Remove
"self-injection" of AccountManagerImpl
rafaelweingartner closed pull request #2619: Remove "self-injection" of AccountManagerImpl
URL: https://github.com/apache/cloudstack/pull/2619
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/server/src/main/java/com/cloud/user/AccountManagerImpl.java b/server/src/main/java/com/cloud/user/AccountManagerImpl.java
index b44e2803df6..e9762b1ceaf 100644
--- a/server/src/main/java/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/main/java/com/cloud/user/AccountManagerImpl.java
@@ -123,13 +123,13 @@
import com.cloud.projects.ProjectVO;
import com.cloud.projects.dao.ProjectAccountDao;
import com.cloud.projects.dao.ProjectDao;
+import com.cloud.region.ha.GlobalLoadBalancingRulesService;
import com.cloud.server.auth.UserAuthenticator;
import com.cloud.server.auth.UserAuthenticator.ActionOnFailedAuthentication;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.Volume;
import com.cloud.storage.VolumeApiService;
import com.cloud.storage.VolumeVO;
-import com.cloud.storage.dao.SnapshotDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.storage.snapshot.SnapshotManager;
@@ -180,9 +180,7 @@
@Inject
private AccountDao _accountDao;
@Inject
- private AccountManager _accountMgr;
- @Inject
- ConfigurationDao _configDao;
+ private ConfigurationDao _configDao;
@Inject
private ResourceCountDao _resourceCountDao;
@Inject
@@ -204,10 +202,6 @@
@Inject
private VMInstanceDao _vmDao;
@Inject
- protected SnapshotDao _snapshotDao;
- @Inject
- protected VMTemplateDao _vmTemplateDao;
- @Inject
private SecurityGroupManager _networkGroupMgr;
@Inject
private NetworkOrchestrationService _networkMgr;
@@ -250,11 +244,11 @@
@Inject
private VpcManager _vpcMgr;
@Inject
- Site2SiteVpnManager _vpnMgr;
+ private Site2SiteVpnManager _vpnMgr;
@Inject
private AutoScaleManager _autoscaleMgr;
@Inject
- VolumeApiService volumeService;
+ private VolumeApiService volumeService;
@Inject
private AffinityGroupDao _affinityGroupDao;
@Inject
@@ -272,29 +266,29 @@
@Inject
private SSHKeyPairDao _sshKeyPairDao;
- List<QuerySelector> _querySelectors;
+ private List<QuerySelector> _querySelectors;
@Inject
- MessageBus _messageBus;
+ private MessageBus _messageBus;
@Inject
- public com.cloud.region.ha.GlobalLoadBalancingRulesService _gslbService;
+ private GlobalLoadBalancingRulesService _gslbService;
private List<UserAuthenticator> _userAuthenticators;
- List<UserAuthenticator> _userPasswordEncoders;
+ protected List<UserAuthenticator> _userPasswordEncoders;
@Inject
- protected IpAddressManager _ipAddrMgr;
+ private IpAddressManager _ipAddrMgr;
private final ScheduledExecutorService _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AccountChecker"));
- int _allowedLoginAttempts;
+ private int _allowedLoginAttempts;
- UserVO _systemUser;
- AccountVO _systemAccount;
+ private UserVO _systemUser;
+ private AccountVO _systemAccount;
- List<SecurityChecker> _securityCheckers;
- int _cleanupInterval;
+ private List<SecurityChecker> _securityCheckers;
+ private int _cleanupInterval;
public List<UserAuthenticator> getUserAuthenticators() {
return _userAuthenticators;
@@ -493,8 +487,6 @@ public void checkAccess(Account caller, Domain domain) throws PermissionDeniedEx
return;
}
}
-
- assert false : "How can all of the security checkers pass on checking this caller?";
throw new PermissionDeniedException("There's no way to confirm " + caller + " has access to " + domain);
}
@@ -2292,8 +2284,8 @@ public UserAccount authenticateUser(final String username, final String password
}
// We authenticated successfully by now, let's check if we are allowed to login from the ip address the reqest comes from
- final Account account = _accountMgr.getAccount(user.getAccountId());
- final DomainVO domain = (DomainVO)_domainMgr.getDomain(account.getDomainId());
+ final Account account = getAccount(user.getAccountId());
+ final DomainVO domain = (DomainVO) _domainMgr.getDomain(account.getDomainId());
// Get the CIDRs from where this account is allowed to make calls
final String accessAllowedCidrs = ApiServiceConfiguration.ApiAllowedSourceCidrList.valueIn(account.getId()).replaceAll("\\s", "");
@@ -2858,4 +2850,4 @@ public String getConfigComponentName() {
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {UseSecretKeyInResponse};
}
-}
+}
\ No newline at end of file
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services