Package org.zanata.model

Examples of org.zanata.model.HAccount


     * implementations simply authenticates the user locally.
     */
    @Override
    public void afterOpenIdAuth(OpenIdAuthenticationResult result) {
        if (result.isAuthenticated()) {
            HAccount authenticatedAccount =
                    accountDAO.getByCredentialsId(result.getAuthenticatedId());

            identity.setPreAuthenticated(true);

            if (authenticatedAccount != null
                    && authenticatedAccount.isEnabled()) {
                credentials.setUsername(authenticatedAccount.getUsername());
                Identity.instance().acceptExternallyAuthenticatedPrincipal(
                        (new OpenIdPrincipal(result.getAuthenticatedId())));
                this.loginImmediate();
            }
            // If the user hasn't been registered yet
View Full Code Here


     * @return The currently authenticated account username, or null if the
     *         session is not authenticated.
     */
    @Nullable
    public String getAccountUsername() {
        HAccount authenticatedAccount =
                ServiceLocator.instance().getInstance(
                        JpaIdentityStore.AUTHENTICATED_USER, HAccount.class);
        if (authenticatedAccount != null) {
            return authenticatedAccount.getUsername();
        }
        return null;
    }
View Full Code Here

        identity.setPreAuthenticated(true);
        if (isExternalLogin() && !isNewUser() && isAccountEnabledAndActivated()) {
            applyAuthentication();
        }
        // Get the authenticated account and credentials
        HAccount authenticatedAccount = null;
        HCredentials authenticatedCredentials = null;

        String username = credentials.getUsername();

        if (authType == AuthenticationType.OPENID) {
View Full Code Here

                    authenticatedCredentials, authType.name());
        }
    }

    public boolean isAccountWaitingForActivation(String username) {
        HAccount account = accountDAO.getByUsername(username);
        if (account != null && account.getAccountActivationKey() != null) {
            return true;
        }
        return false;
    }
View Full Code Here

        return createUser(authenticatedAccount);
    }

    @Override
    public Response getUserInfo(String username) {
        HAccount account = accountDAO.getByUsername(username);
        return createUser(account);
    }
View Full Code Here

    public String getUserFullName() {
        return authenticatedAccount.getPerson().getName();
    }

    public String getUserLanguageTeams() {
        HAccount account = accountDAO.findById(authenticatedAccount.getId());
        return StringUtils.join(
                Collections2.transform(account.getPerson()
                .getLanguageMemberships(),
                 new Function<HLocale, Object>() {
                    @Nullable
                    @Override
                    public Object apply(@NonNull HLocale locale) {
View Full Code Here

        protected List<HProject> fetchRecords(int start, int max,
                String filter) {
            ServiceLocator serviceLocator = ServiceLocator.instance();
            ProjectDAO projectDAO =
                    serviceLocator.getInstance(ProjectDAO.class);
            HAccount authenticatedAccount =
                    serviceLocator
                            .getInstance(JpaIdentityStore.AUTHENTICATED_USER,
                                    HAccount.class);
            return projectDAO.getProjectsForMaintainer(
                    authenticatedAccount.getPerson(), filter, start, max);
        }
View Full Code Here

        @Override
        protected long fetchTotalRecords(String filter) {
            ServiceLocator serviceLocator = ServiceLocator.instance();
            ProjectDAO projectDAO =
                    serviceLocator.getInstance(ProjectDAO.class);
            HAccount authenticatedAccount =
                    serviceLocator
                            .getInstance(JpaIdentityStore.AUTHENTICATED_USER,
                                    HAccount.class);
            return projectDAO.getMaintainedProjectCount(
                    authenticatedAccount.getPerson(), filter);
        }
View Full Code Here

    @Override
    public LoadOptionsResult execute(LoadOptionsAction action,
            ExecutionContext context) throws ActionException {
        UserConfigHolder configHolder = new UserConfigHolder();
        HAccount account =
                accountDAO.findById(authenticatedAccount.getId(), true);
        Map<String, HAccountOption> options = account.getEditorOptions();
        HashMap<String, HAccountOption> filteredOptions =
                new HashMap<String, HAccountOption>();

        for (Entry<String, HAccountOption> entry : options.entrySet()) {
            // filter config according to prefix
View Full Code Here

    private Session session;

    @Override
    public Response get() {
        log.debug("HTTP GET {}", request.getRequestURL());
        HAccount hAccount = accountDAO.getByUsername(username);
        if (hAccount == null) {
            return Response.status(Status.NOT_FOUND)
                    .entity("Username not found").build();
        }
        Account result = new Account();
View Full Code Here

TOP

Related Classes of org.zanata.model.HAccount

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.