sakai创建、删除用户的方法

创建用户:
      try {
       User newUser = UserDirectoryService.addUser("8f78f1b7-fa6c-4207-b521-064567f9e32X", "akk", "firstName",
         "lastName", "[email protected]", "pw", "registered", null);
      } catch (UserIdInvalidException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
      } catch (UserAlreadyDefinedException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
      } catch (UserPermissionException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
      }

删除用户:
      UserEdit user = null;
      try {
       user = userDirectoryService.editUser("8f78f1b7-fa6c-4207-b521-064567f9e32X");
      } catch (UserNotDefinedException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
      } catch (UserPermissionException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
      } catch (UserLockedException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
      }
      if (user != null){
       try {
        userDirectoryService.removeUser(user);
       } catch (UserPermissionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
       }
      }

你可能感兴趣的:(用户)