define({ user, profile }) {
    if (Meteor.isServer) {
      const newUser = {
        username: user.email,
        role: ROLE.ORGANIZATION,
        password: user.password,
      };
      const existingUser = Meteor.users.findOne({ username: user.email });
      if (!existingUser) {
        const userID = Users.define(newUser);
        Roles.createRole(ROLE.ORGANIZATION, { unlessExists: true });
        Roles.addUsersToRoles(userID, ROLE.ORGANIZATION);
      }
      const newProfile = profile;
      newProfile.owner = user.email;
      return this._collection.insert(newProfile);
    }
    return undefined;
  }
/**
   * Defines a new Organization and User.
   * @return {String} the docID of the new document.
   */
Defines a new Organization and User.
@return {String} the docID of the new document.
Defines a new Organization and User . @return { String } the docID of the new document .
define({ user, profile }) {
    if (Meteor.isServer) {
      const newUser = {
        username: user.email,
        role: ROLE.ORGANIZATION,
        password: user.password,
      };
      const existingUser = Meteor.users.findOne({ username: user.email });
      if (!existingUser) {
        const userID = Users.define(newUser);
        Roles.createRole(ROLE.ORGANIZATION, { unlessExists: true });
        Roles.addUsersToRoles(userID, ROLE.ORGANIZATION);
      }
      const newProfile = profile;
      newProfile.owner = user.email;
      return this._collection.insert(newProfile);
    }
    return undefined;
  }
define ( { user , profile } ) { if ( Meteor . isServer ) { const newUser = { username : user . email , role : ROLE . ORGANIZATION , password : user . password , } ; const existingUser = Meteor . users . findOne ( { username : user . email } ) ; if ( ! existingUser ) { const userID = Users . define ( newUser ) ; Roles . createRole ( ROLE . ORGANIZATION , { unlessExists : true } ) ; Roles . addUsersToRoles ( userID , ROLE . ORGANIZATION ) ; } const newProfile = profile ; newProfile . owner = user . email ; return this . _collection . insert ( newProfile ) ; } return undefined ; }
Defines a new Organization and User.
Defines a new Organization and User .