Skip to content

Commit fc92f04

Browse files
committed
ApiDispatcher: Remove unused methods which were for acl processing
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent 765504c commit fc92f04

1 file changed

Lines changed: 5 additions & 28 deletions

File tree

‎server/src/com/cloud/api/ApiDispatcher.java‎

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -149,31 +149,9 @@ public void dispatchCreateCmd(BaseAsyncCreateCmd cmd, Map<String, String> params
149149
}
150150
}
151151

152-
private void checkACLOnCommand(BaseCmd cmd) {
153-
// TODO Auto-generated method stub
154-
//need to write an commandACLChecker adapter framework to check ACL on commands - default one will use the static roles by referring to commands.properties.
155-
//one can write another commandACLChecker to check access via custom roles.
156-
}
157-
158-
private List<Role> determineRole(Account caller) {
159-
// TODO Auto-generated method stub
160-
List<Role> effectiveRoles = new ArrayList<Role>();
161-
return effectiveRoles;
162-
163-
}
164-
165152
private void doAccessChecks(BaseCmd cmd, List<Object> entitiesToAccess) {
166-
//owner
167-
Account caller = UserContext.current().getCaller();
168-
Account owner = _accountMgr.getActiveAccountById(cmd.getEntityOwnerId());
169-
170-
// REMOVE ME:
171-
// List<Role> callerRoles = determineRole(caller);
172-
// List<Role> ownerRoles = determineRole(owner);
173-
// check permission to call this command for the caller
174-
// this needs checking of static roles of the caller
175-
// Role based acl is done in ApiServer before api gets to ApiDispatcher
176-
// checkACLOnCommand(cmd);
153+
Account caller = UserContext.current().getCaller();
154+
Account owner = _accountMgr.getActiveAccountById(cmd.getEntityOwnerId());
177155

178156
if(cmd instanceof BaseAsyncCreateCmd) {
179157
//check that caller can access the owner account.
@@ -188,13 +166,13 @@ private void doAccessChecks(BaseCmd cmd, List<Object> entitiesToAccess) {
188166
_accountMgr.checkAccess(caller, null, true, (ControlledEntity) entity);
189167
}
190168
else if (entity instanceof InfrastructureEntity) {
191-
//do something here:D
169+
//FIXME: Move this code in adapter, remove code from Account manager
192170
}
193171
}
194172
}
195-
}
173+
}
196174

197-
public void dispatch(BaseCmd cmd, Map<String, String> params) {
175+
public void dispatch(BaseCmd cmd, Map<String, String> params) {
198176
try {
199177
processParameters(cmd, params);
200178
UserContext ctx = UserContext.current();
@@ -524,7 +502,6 @@ private static Long translateUuidToInternalId(String uuid, Parameter annotation)
524502
}
525503
Long internalId = null;
526504
// If annotation's empty, the cmd existed before 3.x try conversion to long
527-
// FIXME: Fails if someone adds since field for any pre 3.x apis
528505
boolean isPre3x = annotation.since().isEmpty();
529506
// Match against Java's UUID regex to check if input is uuid string
530507
boolean isUuid = uuid.matches("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$");

0 commit comments

Comments
 (0)