Java 类com.vmware.vim25.Permission 实例源码

项目:vijava    文件:CreateRole.java   
static void printPermissions(Permission[] ps)
{
  for(int i=0; ps!=null && i< ps.length; i++)
  {
    System.out.println("\nEntity:" 
        + ps[i].getEntity().getType() + ":" 
        + ps[i].getEntity().get_value());
    System.out.println("IsGroup:" + ps[i].isGroup());
    System.out.println("Principal:" + ps[i].getPrincipal());
    System.out.println("Propogated:" + ps[i].isPropagate());
    System.out.println("RoleId:" + ps[i].getRoleId());
  }
}
项目:vijava    文件:ManagedEntity.java   
public Permission[] getPermission()
{
    return (Permission[]) getCurrentProperty("permission");
}
项目:vijava    文件:CreateRole.java   
public static void main(String[] args) throws Exception
{
  if(args.length != 3)
  {
    System.out.println("Usage: java CreateRole <url>" 
      + " <username> <password>");
    return;
  }

  ServiceInstance si = new ServiceInstance(
      new URL(args[0]), args[1], args[2], true);

  AuthorizationManager am = si.getAuthorizationManager();

  int roleId = am.addAuthorizationRole("master1", 
      new String[] { "System.View", "System.Read", 
      "System.Anonymous", "Global.LogEvent" } );

  //even if you just want to rename the role, you 
  // still need to provide full list of privileges
  am.updateAuthorizationRole(roleId, "master", 
      new String[] { "System.View", "System.Read", 
      "System.Anonymous", "Global.LogEvent",
      "Global.Diagnostics", "Folder.Create"} );

  System.out.println("The new role ID: " + roleId);

  Permission perm = new Permission();
  perm.setGroup(false); // false for user, true for group
  perm.setPrincipal("vimaster"); // the vimaster must exist
  perm.setPropagate(true); // propagate down the hierarchy
  perm.setRoleId(roleId);

  am.setEntityPermissions( si.getRootFolder(), 
      new Permission[] {perm} );

  Permission[] ps = am.retrieveEntityPermissions(
      si.getRootFolder(), false);

  System.out.println("print the permissions on root:");
  printPermissions(ps);

  si.getServerConnection().logout();
}
项目:jcloud-vsphere    文件:AuthorizationManagerApi.java   
void resetEntityPermissions(ManagedEntity entity, List<Permission> permission) throws AuthMinimumAdminPermission, NotFound, UserNotFound, RuntimeFault, RemoteException;
项目:jcloud-vsphere    文件:AuthorizationManagerApi.java   
List<Permission> retrieveEntityPermissions(ManagedEntity entity, boolean inherited) throws RuntimeFault, RemoteException;
项目:jcloud-vsphere    文件:AuthorizationManagerApi.java   
List<Permission> retrieveAllPermissions() throws RuntimeFault, RemoteException;
项目:jcloud-vsphere    文件:AuthorizationManagerApi.java   
List<Permission> retrieveRolePermissions(int roleId) throws NotFound, RuntimeFault, RemoteException;
项目:jcloud-vsphere    文件:AuthorizationManagerApi.java   
void setEntityPermissions(ManagedEntity entity, List<Permission> permission) throws AuthMinimumAdminPermission, NotFound, UserNotFound, RuntimeFault, RemoteException;