Пример #1
0
  public void deletePolicy(String policy) throws ApiSenderException {
    DebugUtils.Assert(account != null, "please call createAccount() before createPolicy()");
    PolicyInventory p = policies.get(policy);
    DebugUtils.Assert(p != null, String.format("cannot find policy[%s]", policy));

    api.deletePolicy(p.getUuid(), accountSession);
  }
Пример #2
0
 public void detachPolicyFromGroup(String group, String policy) throws ApiSenderException {
   DebugUtils.Assert(account != null, "please call createAccount() before createPolicy()");
   PolicyInventory p = policies.get(policy);
   DebugUtils.Assert(p != null, String.format("cannot find policy[%s]", policy));
   UserGroupInventory g = groups.get(group);
   DebugUtils.Assert(g != null, String.format("cannot find group[%s]", group));
   api.detachPolicyFromGroup(g.getUuid(), p.getUuid(), accountSession);
 }
Пример #3
0
 public void detachPolicyFromUser(String user, String policy) throws ApiSenderException {
   DebugUtils.Assert(account != null, "please call createAccount() before createPolicy()");
   UserInventory u = users.get(user);
   DebugUtils.Assert(u != null, String.format("cannot find user[%s]", user));
   PolicyInventory p = policies.get(policy);
   DebugUtils.Assert(p != null, String.format("cannot find policy[%s]", policy));
   api.detachPolicyFromUser(u.getUuid(), p.getUuid(), accountSession);
 }
Пример #4
0
 public PolicyInventory createPolicy(String name, List<Statement> s) throws ApiSenderException {
   DebugUtils.Assert(account != null, "please call createAccount() before createPolicy()");
   PolicyInventory p = api.createPolicy(name, s, accountSession);
   policies.put(p.getName(), p);
   return p;
 }