Package net.webpasswordsafe.common.model

Examples of net.webpasswordsafe.common.model.Template


   
    private void doAddTemplate()
    {
        if (clientSessionUtil.isAuthorized(Function.ADD_TEMPLATE))
        {
            displayTemplateDialog(new Template());
        }
        else
        {
            MessageBox.alert(textMessages.error(), textMessages.notAuthorized(), null);
        }
View Full Code Here


    {
        LOG.debug("updating template");
        Date now = new Date();
        String action = "update template";
        User loggedInUser = getLoggedInUser();
        Template template = templateDAO.findUpdatableTemplateById(updateTemplate.getId(), loggedInUser);
        if (template != null)
        {
            String templateMessage = (updateTemplate.getName().equals(template.getName())) ? "" : ("was: "+templateTarget(template));
            // update simple fields
            template.setName(updateTemplate.getName());
            // only change sharing status if original owner is updating or special bypass authz
            if ((template.getUser().getId() == loggedInUser.getId()) ||
                authorizer.isAuthorized(loggedInUser, Function.BYPASS_TEMPLATE_SHARING.name()))
            {
                template.setShared(updateTemplate.isShared());
            }
           
            // update details
            // keep the permissions that haven't changed
            template.getTemplateDetails().retainAll(updateTemplate.getTemplateDetails());
            // add the permissions that have changed
            for (TemplateDetail templateDetail : updateTemplate.getTemplateDetails())
            {
                if (templateDetail.getId() == 0)
                {
                    template.addDetail(templateDetail);
                }
            }
            auditLogger.log(now, loggedInUser.getUsername(), ServerSessionUtil.getIP(), action, templateTarget(updateTemplate), true, templateMessage);
        }
        else
View Full Code Here

    {
        LOG.debug("deleting template");
        Date now = new Date();
        String action = "delete template";
        User loggedInUser = getLoggedInUser();
        Template template = templateDAO.findUpdatableTemplateById(updateTemplate.getId(), loggedInUser);
        if (template != null)
        {
            // only allow delete if original owner or special bypass authz
            if ((template.getUser().getId() == loggedInUser.getId()) ||
                authorizer.isAuthorized(loggedInUser, Function.BYPASS_TEMPLATE_SHARING.name()))
            {
                templateDAO.makeTransient(template);
                auditLogger.log(now, loggedInUser.getUsername(), ServerSessionUtil.getIP(), action, templateTarget(template), true, "");
            }
View Full Code Here

    @Override
    @Transactional(propagation=Propagation.REQUIRED, readOnly=true)
    public Template getTemplateWithDetails(long templateId)
    {
        Template template = templateDAO.findById(templateId);
        if (template != null)
        {
            template.getTemplateDetails().size();
        }
        return template;
    }
View Full Code Here

    @Override
    @Transactional(propagation=Propagation.REQUIRED, readOnly=true)
    public boolean isTemplateTaken(String templateName, long ignoreTemplateId)
    {
        boolean isTemplateTaken = false;
        Template template = templateDAO.findTemplateByName(templateName);
        if (template != null)
        {
            if (template.getId() != ignoreTemplateId)
            {
                isTemplateTaken = true;
            }
        }
        return isTemplateTaken;
View Full Code Here

TOP

Related Classes of net.webpasswordsafe.common.model.Template

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.