Search in sources :

Example 41 with User

use of sqlite.kripton209.model1.User in project camel by apache.

the class UserProducer method doGet.

private void doGet(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(KeystoneConstants.USER_ID, String.class), String.class);
    ObjectHelper.notEmpty(id, "User ID");
    final User result = osV3Client.identity().users().get(id);
    msg.setBody(result);
}
Also used : User(org.openstack4j.model.identity.v3.User) Message(org.apache.camel.Message)

Example 42 with User

use of sqlite.kripton209.model1.User in project camel by apache.

the class UserProducer method doCreate.

private void doCreate(Exchange exchange) {
    final User in = messageToUser(exchange.getIn());
    final User out = osV3Client.identity().users().create(in);
    exchange.getIn().setBody(out);
}
Also used : User(org.openstack4j.model.identity.v3.User)

Example 43 with User

use of sqlite.kripton209.model1.User in project oxTrust by GluuFederation.

the class UserCoreLoadingStrategy method createDummyUser.

private User createDummyUser() {
    User user = new User();
    org.gluu.oxtrust.model.scim2.Name name = new org.gluu.oxtrust.model.scim2.Name();
    name.setGivenName("");
    name.setMiddleName("");
    name.setFamilyName("");
    name.setHonorificPrefix("");
    name.setHonorificSuffix("");
    user.setName(name);
    user.setActive(false);
    user.setId("");
    user.setExternalId("");
    user.setUserName("");
    user.setPassword("");
    user.setDisplayName("");
    user.setNickName("");
    user.setProfileUrl("");
    user.setLocale("");
    user.setPreferredLanguage("");
    user.setTimezone("");
    user.setTitle("");
    List<GroupRef> groups = new ArrayList<GroupRef>();
    GroupRef groupRef = new GroupRef();
    groupRef.setOperation("");
    groupRef.setPrimary(false);
    groupRef.setValue("test");
    groupRef.setDisplay("");
    groupRef.setType(GroupRef.Type.DIRECT);
    groupRef.setReference("");
    groups.add(groupRef);
    user.setGroups(groups);
    List<Email> emails = new ArrayList<Email>();
    Email email = new Email();
    email.setOperation("");
    email.setPrimary(false);
    email.setValue("a@b.com");
    email.setDisplay("");
    email.setType(Email.Type.WORK);
    email.setReference("");
    emails.add(email);
    user.setEmails(emails);
    List<PhoneNumber> phoneNumbers = new ArrayList<PhoneNumber>();
    PhoneNumber phoneNumber = new PhoneNumber();
    phoneNumber.setOperation("");
    phoneNumber.setPrimary(false);
    phoneNumber.setValue("123-456-7890");
    phoneNumber.setDisplay("");
    phoneNumber.setType(PhoneNumber.Type.WORK);
    phoneNumber.setReference("");
    phoneNumbers.add(phoneNumber);
    user.setPhoneNumbers(phoneNumbers);
    List<Im> ims = new ArrayList<Im>();
    Im im = new Im();
    im.setOperation("");
    im.setPrimary(false);
    im.setValue("test");
    im.setDisplay("");
    im.setType(Im.Type.SKYPE);
    im.setReference("");
    ims.add(im);
    user.setIms(ims);
    List<Photo> photos = new ArrayList<Photo>();
    Photo photo = new Photo();
    photo.setOperation("");
    photo.setPrimary(false);
    photo.setValue("data:image/jpg;charset=utf-8;base64,dGVzdA==");
    photo.setDisplay("");
    photo.setType(Photo.Type.PHOTO);
    photo.setReference("");
    photos.add(photo);
    user.setPhotos(photos);
    List<Address> addresses = new ArrayList<Address>();
    Address address = new Address();
    address.setOperation("");
    address.setPrimary(false);
    address.setValue("test");
    address.setDisplay("");
    address.setType(Address.Type.WORK);
    address.setReference("");
    address.setStreetAddress("");
    address.setLocality("");
    address.setPostalCode("");
    address.setRegion("");
    address.setCountry("");
    address.setFormatted("");
    addresses.add(address);
    user.setAddresses(addresses);
    List<Entitlement> entitlements = new ArrayList<Entitlement>();
    Entitlement entitlement = new Entitlement();
    entitlement.setOperation("");
    entitlement.setPrimary(false);
    entitlement.setValue("test");
    entitlement.setDisplay("");
    entitlement.setType(new Entitlement.Type("test"));
    entitlement.setReference("");
    entitlements.add(entitlement);
    user.setEntitlements(entitlements);
    List<Role> roles = new ArrayList<Role>();
    Role role = new Role();
    role.setOperation("");
    role.setPrimary(false);
    role.setValue("test");
    role.setDisplay("");
    role.setType(new Role.Type("test"));
    role.setReference("");
    roles.add(role);
    user.setRoles(roles);
    List<X509Certificate> x509Certificates = new ArrayList<X509Certificate>();
    X509Certificate x509Certificate = new X509Certificate();
    x509Certificate.setOperation("");
    x509Certificate.setPrimary(false);
    x509Certificate.setValue("test");
    x509Certificate.setDisplay("");
    x509Certificate.setType(new X509Certificate.Type("test"));
    x509Certificate.setReference("");
    x509Certificates.add(x509Certificate);
    user.setX509Certificates(x509Certificates);
    return user;
}
Also used : User(org.gluu.oxtrust.model.scim2.User) Email(org.gluu.oxtrust.model.scim2.Email) Im(org.gluu.oxtrust.model.scim2.Im) Address(org.gluu.oxtrust.model.scim2.Address) ArrayList(java.util.ArrayList) Photo(org.gluu.oxtrust.model.scim2.Photo) X509Certificate(org.gluu.oxtrust.model.scim2.X509Certificate) Role(org.gluu.oxtrust.model.scim2.Role) PhoneNumber(org.gluu.oxtrust.model.scim2.PhoneNumber) GroupRef(org.gluu.oxtrust.model.scim2.GroupRef) Entitlement(org.gluu.oxtrust.model.scim2.Entitlement)

Example 44 with User

use of sqlite.kripton209.model1.User in project oxTrust by GluuFederation.

the class Scim2UserService method createUser.

public User createUser(User user) throws Exception {
    log.debug(" copying gluuperson ");
    GluuCustomPerson gluuPerson = copyUtils2.copy(user, null, false);
    if (gluuPerson == null) {
        throw new Exception("Scim2UserService.createUser(): Failed to create user; GluuCustomPerson is null");
    }
    log.debug(" generating inum ");
    // inumService.generateInums(Configuration.INUM_TYPE_PEOPLE_SLUG);
    String inum = personService.generateInumForNewPerson();
    // //personService.generateInumForNewPerson();
    log.debug(" getting DN ");
    String dn = personService.getDnForPerson(inum);
    log.debug(" getting iname ");
    String iname = personService.generateInameForNewPerson(user.getUserName());
    log.debug(" setting dn ");
    gluuPerson.setDn(dn);
    log.debug(" setting inum ");
    gluuPerson.setInum(inum);
    log.debug(" setting iname ");
    gluuPerson.setIname(iname);
    log.debug(" setting commonName ");
    gluuPerson.setCommonName(gluuPerson.getGivenName() + " " + gluuPerson.getSurname());
    log.info("gluuPerson.getMemberOf().size() : " + gluuPerson.getMemberOf().size());
    if (user.getGroups().size() > 0) {
        log.info(" jumping to groupMembersAdder ");
        log.info("gluuPerson.getDn() : " + gluuPerson.getDn());
        serviceUtil.groupMembersAdder(gluuPerson, gluuPerson.getDn());
    }
    // As per spec, the SP must be the one to assign the meta attributes
    log.info(" Setting meta: create user ");
    // Date should be in UTC format
    DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateTime().withZoneUTC();
    Date dateCreated = DateTime.now().toDate();
    String relativeLocation = "/scim/v2/Users/" + inum;
    gluuPerson.setAttribute("oxTrustMetaCreated", dateTimeFormatter.print(dateCreated.getTime()));
    gluuPerson.setAttribute("oxTrustMetaLastModified", dateTimeFormatter.print(dateCreated.getTime()));
    gluuPerson.setAttribute("oxTrustMetaLocation", relativeLocation);
    // Sync email, forward ("oxTrustEmail" -> "mail")
    gluuPerson = serviceUtil.syncEmailForward(gluuPerson, true);
    // For custom script: create user
    if (externalScimService.isEnabled()) {
        externalScimService.executeScimCreateUserMethods(gluuPerson);
    }
    log.debug("adding new GluuPerson");
    personService.addPerson(gluuPerson);
    User createdUser = copyUtils2.copy(gluuPerson, null);
    return createdUser;
}
Also used : GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson) User(org.gluu.oxtrust.model.scim2.User) ScimPatchUser(org.gluu.oxtrust.model.scim2.ScimPatchUser) DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DuplicateEntryException(org.gluu.site.ldap.exception.DuplicateEntryException) EntryPersistenceException(org.gluu.site.ldap.persistence.exception.EntryPersistenceException) Date(java.util.Date)

Example 45 with User

use of sqlite.kripton209.model1.User in project oxTrust by GluuFederation.

the class Scim2UserService method addUserPatch.

private void addUserPatch(Operation operation, String id) throws Exception {
    User user = operation.getValue();
    GluuCustomPerson updatedGluuPerson = patchUtil.addPatch(user, validUsernameByInum(user, id));
    log.info(" Setting meta: addUserPatch update user ");
    setMeta(updatedGluuPerson);
}
Also used : GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson) User(org.gluu.oxtrust.model.scim2.User) ScimPatchUser(org.gluu.oxtrust.model.scim2.ScimPatchUser)

Aggregations

User (pl.plajer.villagedefense3.User)30 Player (org.bukkit.entity.Player)18 User (org.gluu.oxtrust.model.scim2.User)17 EventHandler (org.bukkit.event.EventHandler)11 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)10 ScimPatchUser (org.gluu.oxtrust.model.scim2.ScimPatchUser)10 User (org.openstack4j.model.identity.v3.User)10 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)8 Arena (pl.plajer.villagedefense3.arena.Arena)8 ArrayList (java.util.ArrayList)7 EntryPersistenceException (org.gluu.site.ldap.persistence.exception.EntryPersistenceException)7 Date (java.util.Date)6 SimpleUser (me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser)6 User (me.zhanghai.android.douya.network.api.info.apiv2.User)6 ItemStack (org.bukkit.inventory.ItemStack)5 PersonRequiredFieldsException (org.gluu.oxtrust.exception.PersonRequiredFieldsException)5 Test (org.junit.Test)5 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)4 BigDecimal (java.math.BigDecimal)4 URI (java.net.URI)4