mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
plugin: Remove memory mapping of apiname and class name in StaticRoleBasedAPIAccessChecker
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
parent
65e4f00a10
commit
c5b51b7c39
@ -58,7 +58,6 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
|
||||
private static List<String> s_adminCommands = null;
|
||||
private static List<String> s_resourceDomainAdminCommands = null;
|
||||
private static List<String> s_allCommands = null;
|
||||
private Properties _apiCommands = null;
|
||||
|
||||
protected @Inject AccountManager _accountMgr;
|
||||
|
||||
@ -87,11 +86,6 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
|
||||
return commandExists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Properties getApiCommands() {
|
||||
return _apiCommands;
|
||||
}
|
||||
|
||||
private static boolean isCommandAvailableForAccount(short accountType, String commandName) {
|
||||
boolean isCommandAvailable = false;
|
||||
switch (accountType) {
|
||||
@ -130,9 +124,6 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
|
||||
}
|
||||
|
||||
private void processConfigFiles(List<String> configFiles) {
|
||||
if (_apiCommands == null)
|
||||
_apiCommands = new Properties();
|
||||
|
||||
Properties preProcessedCommands = new Properties();
|
||||
|
||||
for (String configFile : configFiles) {
|
||||
@ -160,12 +151,12 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
|
||||
|
||||
for (Object key : preProcessedCommands.keySet()) {
|
||||
String preProcessedCommand = preProcessedCommands.getProperty((String) key);
|
||||
String[] commandParts = preProcessedCommand.split(";");
|
||||
_apiCommands.setProperty(key.toString(), commandParts[0]);
|
||||
int splitIndex = preProcessedCommand.lastIndexOf(";");
|
||||
// Backward compatible to old style, apiname=pkg;mask
|
||||
String mask = preProcessedCommand.substring(splitIndex+1);
|
||||
|
||||
if (commandParts.length > 1) {
|
||||
try {
|
||||
short cmdPermissions = Short.parseShort(commandParts[1]);
|
||||
short cmdPermissions = Short.parseShort(mask);
|
||||
if ((cmdPermissions & ADMIN_COMMAND) != 0) {
|
||||
s_adminCommands.add((String) key);
|
||||
}
|
||||
@ -187,6 +178,5 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user