Package edu.stanford.smi.protege.server.metaproject

Examples of edu.stanford.smi.protege.server.metaproject.User


        SessionConstants.removeAttribute(SessionConstants.USER_ID, session);
        SessionConstants.removeAttribute(SessionConstants.OPEN_ID_ACCOUNT, session);
    }

    public boolean changePasswordEncrypted(String userName, String encryptedPassword, String salt) {
        User user = MetaProjectManager.getManager().getMetaProject().getUser(userName);
        if (user == null) {
            return false;
        }
        user.setDigestedPassword(encryptedPassword, salt);
        return true;
    }
View Full Code Here


        String salt = (String) session.getAttribute(AuthenticationConstants.NEW_SALT);
        String emptyPassword = "";

        UserData userData = metaProjectManager.registerUser(name, emailId, emptyPassword);

        User user = metaProjectManager.getMetaProject().getUser(name);
        user.setDigestedPassword(hashedPassword, salt);
        user.setEmail(emailId);

        OWLAPIMetaProjectStore.getStore().saveMetaProject(metaProjectManager);

        return userData;
    }
View Full Code Here

    @Override
    public ResetPasswordResult execute(
            ResetPasswordAction action, ExecutionContext executionContext) {
        final String emailAddress = action.getResetPasswordData().getEmailAddress();
        try {
            User user = metaProjectManager.getUser(emailAddress);
            if(user == null) {
                return new ResetPasswordResult(INVALID_EMAIL_ADDRESS);
            }
            if(user.getEmail() == null) {
                return new ResetPasswordResult(INVALID_EMAIL_ADDRESS);
            }
            if(user.getEmail().compareToIgnoreCase(emailAddress) != 0) {
                return new ResetPasswordResult(INVALID_EMAIL_ADDRESS);
            }
            String pwd = IdUtil.getBase62UUID();
            user.setPassword(pwd);
            mailer.sendEmail(emailAddress, pwd);
            return new ResetPasswordResult(SUCCESS);
        } catch (Exception e) {
            logger.info("Could not reset the user password " +
                                "associated with the email " +
View Full Code Here

        MetaProject metaProject = mpm.getMetaProject();
        ProjectInstance project = metaProject.getProject(projectId.getId());
        if (project == null) {
            return false;
        }
        User owner = project.getOwner();
        return owner != null && userId.getUserName().equals(owner.getName());
    }
View Full Code Here

        if (userId.isGuest()) {
            return false;
        }
        MetaProjectManager mpm = getMetaProjectManager();
        MetaProject metaProject = mpm.getMetaProject();
        User user = metaProject.getUser(userId.getUserName());
        if (user == null) {
            return false;
        }
        for (Group group : user.getGroups()) {
            if (OntologyShareAccessConstants.ADMIN_GROUP.equals(group.getName())) {
                return true;
            }
        }
        return false;
View Full Code Here

        }
        List<String> result = new ArrayList<String>();
        MetaProjectManager mpm = getMetaProjectManager();
        MetaProject mp = mpm.getMetaProject();
        for (ProjectInstance instance : mp.getProjects()) {
            User owner = instance.getOwner();
            if(owner != null && userId.getUserName().equals(owner.getName())) {
                String projectName = instance.getName();
                result.add(projectName);
            }
        }
        return result;
View Full Code Here

        if(userId.isGuest()) {
            userDetails = UserDetails.getGuestUserDetails();
        }
        else {
            final MetaProject metaProject = MetaProjectManager.getManager().getMetaProject();
            User user = metaProject.getUser(userId.getUserName());
            for(Group group : user.getGroups()) {
                groups.add(GroupId.get(group.getName()));
            }
            userDetails = UserDetails.getUserDetails(userId, userId.getUserName(), Optional.fromNullable(user.getEmail()));
        }

        return new GetCurrentUserInSessionResult(userDetails, groups);
    }
View Full Code Here

    private void fireWatch(final Watch<?> watch, final UserId userId, final OWLEntity entity) {

        emailExecutor.submit(new Runnable() {
            @Override
            public void run() {
                final User user = MetaProjectManager.getManager().getMetaProject().getUser(userId.getUserName());
                final String email = user.getEmail();
                if (email == null) {
                    return;
                }

                final String displayName = "watched project";
                final String emailSubject = String.format("Changes made in %s by %s", displayName, user.getName());
                String message = "\nChanges were made to " + entity.getEntityType().getName() + " " + project.getRenderingManager().getBrowserText(entity) + " " + entity.getIRI().toQuotedString();
                message = message + (" on " + new Date() + "\n\n");
                message = message + "You can view this " + entity.getEntityType().getName() + " at the link below:";
                StringBuilder directLinkBuilder = new StringBuilder();
                directLinkBuilder.append("http://");
View Full Code Here

        if (userOpenId == null) {
            return null;
        }

        User user = MetaProjectManager.getManager().getMetaProject().getUser(userName);
        if (user != null) {
            UserData userData = AuthenticationUtil.createUserData(UserId.getUserId(userName));
            userData.setProperty(OpenIdUtil.REGISTRATION_RESULT_PROP, OpenIdConstants.USER_ALREADY_EXISTS);
            return userData;
        }

        UserData userData = MetaProjectManager.getManager().registerUser(userName, emailId, password);
        user = MetaProjectManager.getManager().getMetaProject().getUser(userName);
        user.setEmail(emailId);

        String openIdPropBase = OpenIdConstants.OPENID_PROPERTY_PREFIX;

        for (int index = 1;; index++) {
            String opnId = user.getPropertyValue(openIdPropBase + index + OpenIdConstants.OPENID_PROPERTY_URL_SUFFIX);
            if (opnId == null) {
                user.addPropertyValue(openIdPropBase + index + OpenIdConstants.OPENID_PROPERTY_URL_SUFFIX, userOpenId);
                user.addPropertyValue(openIdPropBase + index + OpenIdConstants.OPENID_PROPERTY_ID_SUFFIX, openIdAccName);
                user.addPropertyValue(openIdPropBase + index + OpenIdConstants.OPENID_PROPERTY_PROVIDER_SUFFIX, openIdProvider);
                break;
            }
        }

        Log.getLogger().info("User " + userName + " created at: " + new Date() + " with OpenId: " + userOpenId);
View Full Code Here

            if (userOpenId == null) {
                return null;
            }

            User user = MetaProjectManager.getManager().getMetaProject().getUser(userName);

            String openIdPropBase = OpenIdConstants.OPENID_PROPERTY_PREFIX;

            for (int index = 1;; index++) {
                String opnId = user.getPropertyValue(openIdPropBase + index + OpenIdConstants.OPENID_PROPERTY_URL_SUFFIX);
                if (opnId == null) {
                    user.addPropertyValue(openIdPropBase + index + OpenIdConstants.OPENID_PROPERTY_URL_SUFFIX, userOpenId);
                    user.addPropertyValue(openIdPropBase + index + OpenIdConstants.OPENID_PROPERTY_ID_SUFFIX, openIdAccName);
                    user.addPropertyValue(openIdPropBase + index + OpenIdConstants.OPENID_PROPERTY_PROVIDER_SUFFIX, openIdProvider);
                    break;
                }
            }

            Log.getLogger().info("User " + userName + " logged in at: " + new Date() + " with OpenId: " + userOpenId);
View Full Code Here

TOP

Related Classes of edu.stanford.smi.protege.server.metaproject.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.