adjust to use password-service
[aaa.git] / aaa-cli / src / main / java / org / opendaylight / aaa / cli / dmstore / RemoveRole.java
index 138dd46dd6bc4ed219efbd2b46c8fcf301d1ca57..5da16d3f3904a459684642a8fd5fad103d1b6c51 100644 (file)
@@ -10,11 +10,11 @@ package org.opendaylight.aaa.cli.dmstore;
 
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
-import org.opendaylight.aaa.api.IIDMStore;
+import org.opendaylight.aaa.api.ClaimCache;
+import org.opendaylight.aaa.api.password.service.PasswordHashService;
 import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
 import org.opendaylight.aaa.cli.utils.CliUtils;
 import org.opendaylight.aaa.cli.utils.DataStoreUtils;
-import org.opendaylight.aaa.impl.shiro.idm.IdmLightProxy;
 
 @Command(name = "remove-role", scope = "aaa", description = "Remove role.")
 
@@ -24,12 +24,15 @@ import org.opendaylight.aaa.impl.shiro.idm.IdmLightProxy;
  */
 public class RemoveRole extends AaaCliAbstractCommand {
 
+    private final ClaimCache claimCache;
+
     @Option(name = "-name", aliases = {
             "--roleName" }, description = "The role name", required = true, multiValued = false)
-    private final String roleName = "";
+    private String roleName;
 
-    public RemoveRole(final IIDMStore identityStore) {
-        super(identityStore);
+    public RemoveRole(final ClaimCache claimCache, final PasswordHashService passwordService) {
+        super(passwordService);
+        this.claimCache = claimCache;
     }
 
     @Override
@@ -44,7 +47,7 @@ public class RemoveRole extends AaaCliAbstractCommand {
         if (identityStore.deleteRole(roleId) == null) {
             return "Failed to delete role " + roleName;
         }
-        IdmLightProxy.clearClaimCache();
+        claimCache.clear();
         return "Role " + roleName + "has been deleted.";
     }
 }