/*
- * Copyright (c) 2016 Inocybe Technologies. and others. All rights reserved.
+ * Copyright (c) 2016, 2017 Inocybe Technologies. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
-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;
*/
public class RemoveRole extends AaaCliAbstractCommand {
- @Option(name = "-name",
- aliases = { "--roleName" },
- description = "The role name",
- required = true,
- multiValued = false)
- private String roleName = "";
+ private final ClaimCache claimCache;
- public RemoveRole(final IIDMStore identityStore) {
- super(identityStore);
+ @Option(name = "-name", aliases = {
+ "--roleName" }, description = "The role name", required = true, multiValued = false)
+ private String roleName;
+
+ public RemoveRole(final ClaimCache claimCache, final PasswordHashService passwordService) {
+ super(passwordService);
+ this.claimCache = claimCache;
}
@Override
if (roleId == null) {
return "Role does not exist";
}
- if (identityStore.deleteUser(roleId) == null) {
+ if (identityStore.deleteRole(roleId) == null) {
return "Failed to delete role " + roleName;
}
+ claimCache.clear();
return "Role " + roleName + "has been deleted.";
}
}