Exemplo n.º 1
0
  public IUser getSingleUser() {
    if (localUser == null) {
      class LocalPerson implements IPerson {
        public String getEmail() {
          return "";
        }

        public String getFirstName() {
          return "";
        }

        public String getLastName() {
          return "";
        }

        public String getUserID() {
          return IDavinciServerConstants.LOCAL_INSTALL_USER;
        }
      }

      IStorage userDir = this.baseDirectory;
      userDir.mkdir();

      localUser = new User(new LocalPerson(), userDir);
      IStorage settingsDir =
          this.baseDirectory.newInstance(userDir, IDavinciServerConstants.SETTINGS_DIRECTORY_NAME);
      if (!settingsDir.exists()) {
        settingsDir.mkdir();
        IVResource project = localUser.createProject(IDavinciServerConstants.DEFAULT_PROJECT);
      }
    }
    return localUser;
  }
Exemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see org.davinci.server.user.impl.UserManager#addUser(java.lang.String,
   * java.lang.String, java.lang.String)
   */
  public IUser addUser(String userName, String password, String email) throws UserException {

    if (checkUserExists(userName)) {
      throw new UserException(UserException.ALREADY_EXISTS);
    }

    if (this.maxUsers > 0 && this.usersCount >= this.maxUsers) {
      throw new UserException(UserException.MAX_USERS);
    }
    IPerson person = this.personManager.addPerson(userName, password, email);
    if (person != null) {

      IUser user = newUser(person, this.baseDirectory.newInstance(this.baseDirectory, userName));
      //  users.put(userName, user);
      // File userDir = user.getUserDirectory();
      // userDir.mkdir();
      // File settingsDir = user.getSettingsDirectory();
      // settingsDir.mkdir();
      IVResource project = user.createProject(IDavinciServerConstants.DEFAULT_PROJECT);

      this.usersCount++;
      return user;
    }
    return null;
  }