当前位置: 首页>>代码示例>>Java>>正文


Java Security.signedInOperator方法代码示例

本文整理汇总了Java中org.easyrec.util.core.Security.signedInOperator方法的典型用法代码示例。如果您正苦于以下问题:Java Security.signedInOperator方法的具体用法?Java Security.signedInOperator怎么用?Java Security.signedInOperator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.easyrec.util.core.Security的用法示例。


在下文中一共展示了Security.signedInOperator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: typemanager

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView typemanager(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    ModelAndView mav = new ModelAndView("page");
    mav.addObject("page", "easyrec/typemanager");
    mav.addObject("menubar", "itemtypes");
    mav.addObject("selectedMenu", "myEasyrec");

    Operator signedInOperator = Security.signedInOperator(request);
    RemoteTenant remoteTenant = viewInitializationService.initializeView(request, mav);

    if (signedInOperator != null) {
        mav.addObject("apiKey", signedInOperator.getApiKey());
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(remoteTenant.getOperatorId()));
    }

    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:17,代码来源:TypeManagerController.java

示例2: security

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
private ModelAndView security(HttpServletRequest request) {

        ModelAndView mav = new ModelAndView("page");

        String apiKey = Operator.DEFAULT_API_KEY;
        String tenantId = RemoteTenant.DEFAULT_TENANT_ID;

        Operator signedInOperator = Security.signedInOperator(request);
        if (signedInOperator != null) {
            apiKey = signedInOperator.getApiKey();
        }

        mav.addObject("apiKey", apiKey);
        mav.addObject("tenant", tenantId);
        mav.addObject("selectedMenu", "api");
        mav.addObject("signedIn", Security.isSignedIn(request));

        return mav;
    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:20,代码来源:ApiJSController.java

示例3: initMav

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView initMav(HttpServletRequest request, String title, String itemId, String description,
                            String image) {

    ModelAndView mav = new ModelAndView("page");
    Operator operator = Security.signedInOperator(request);

    mav.addObject("title", title);
    mav.addObject("apikey", (operator == null) ? Operator.DEFAULT_API_KEY : operator.getApiKey());
    mav.addObject("page", "demo");
    mav.addObject("itemId", itemId);
    mav.addObject("description", description);
    mav.addObject("image", image);
    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:15,代码来源:DemoController.java

示例4: itemtypes

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView itemtypes(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    ModelAndView mav = new ModelAndView("easyrec/itemtypes");

    Operator signedInOperator = Security.signedInOperator(request);
    RemoteTenant remoteTenant = viewInitializationService.initializeView(request, mav);

    String itemTypeName = ServletUtils.getSafeParameter(request, "itemTypeName", "").toUpperCase();

    if (signedInOperator != null) {

        if (!"".equals(itemTypeName)) {
            //create a new item type if the itemTypeName parameter is set

            String error = tenantService.isValidItemTypeName(itemTypeName);

            if ("".equals(error)) {
                tenantService.insertItemTypeForTenant(remoteTenant.getId(), itemTypeName, true);
            } else {
                mav.addObject("error", error);
            }
        }

        mav.addObject("apiKey", signedInOperator.getApiKey());
        mav.addObject("itemTypes", itemTypeDAO.getTypes(remoteTenant.getId(), true));
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(remoteTenant.getOperatorId()));
    }


    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:31,代码来源:ItemTypeController.java

示例5: assoctypes

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView assoctypes(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    ModelAndView mav = new ModelAndView("easyrec/assoctypes");

    Operator signedInOperator = Security.signedInOperator(request);
    RemoteTenant remoteTenant = viewInitializationService.initializeView(request, mav);

    String assocTypeName = ServletUtils.getSafeParameter(request, "assocTypeName", "").toUpperCase();

    if (signedInOperator != null) {

        if (!"".equals(assocTypeName)) {
            //create a new item type if the itemTypeName parameter is set

            String error = isValidAssocTypeName(assocTypeName);

            if ("".equals(error)) {
                tenantService.insertAssocTypeForTenant(remoteTenant.getId(), assocTypeName, true);
            } else {
                mav.addObject("error", error);
            }
        }

        mav.addObject("apiKey", signedInOperator.getApiKey());
        mav.addObject("assocTypes", assocTypeDAO.getTypes(remoteTenant.getId(), true));
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(remoteTenant.getOperatorId()));
    }


    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:31,代码来源:AssocTypeController.java

示例6: refreshstatistics

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView refreshstatistics(HttpServletRequest request, HttpServletResponse response) {

        ModelAndView mav = new ModelAndView();
        List<Message> messages = new ArrayList<>();

        String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
        String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
        String url = ServletUtils.getSafeParameter(request, "url", "");
        String description = ServletUtils.getSafeParameter(request, "description", "");

        String signedInOperatorId = Security.signedInOperatorId(request);
        Operator signedInOperator = Security.signedInOperator(request);
        RemoteTenant remoteTenant = null;

        remoteTenant = initializeView(request, mav, operatorId, tenantId, url, description, signedInOperatorId,
                signedInOperator, remoteTenant);

        if (!Security.isSignedIn(request)) {
            messages.add(MSG.NOT_SIGNED_IN);
            return MessageBlock.create(mav, messages, REFRESH_STATISTICS, MSG.ERROR);
        }

        if (!operatorDAO.exists(operatorId)) {
            messages.add(MSG.NO_VALID_OPERATOR);
        }

        if (remoteTenant != null) {
            remoteTenantService.updateTenantStatistics(remoteTenant.getId());
        }
        return MessageBlock.createSingle(mav, MSG.OPERATION_SUCCESSFUL, REFRESH_STATISTICS, MSG.SUCCESS);
    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:32,代码来源:RemoteTenantController.java

示例7: create

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView create(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = new ModelAndView("page");
    String operatorId = Security.signedInOperatorId(request);
    Operator operator = Security.signedInOperator(request);
    String operatorIdPar = request.getParameter("operatorId");

    if (Security.isDeveloper(request) || !Strings.isNullOrEmpty(operatorId))
        mav.addObject("operatorId", operatorIdPar);
    else
        mav.addObject("operatorId", operatorId);

    if (operator != null)
        mav.addObject("apiKey", operator.getApiKey());

    if (Security.isSignedIn(request)) {
        mav.addObject("title", "easyrec :: create tenant");
        mav.addObject("page", "easyrec/create");
        mav.addObject("create", true);
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(operatorId));

        Security.setAttribute(request, "tenantId", null);
        mav.addObject("tenantId", (String) Security.getAttribute(request, "tenantId"));
    } else {
        mav.addObject("page", "home");
    }


    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:30,代码来源:EasyRecController.java

示例8: initializeView

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
/**
 * This function initializes the Easyrec Web applictaion variables for specific views.
 * Depending whenever the signed in user is a developer or not, this function allows the operator to impersonate
 * another operator and returns the corresponding remote tenant.
 *
 * This function was created due historical circumstances. The code was extracted from the Remote Tenant controller where
 * this code is used very often. Look into this controller tro understand the usage better - sorry
 * @param request
 * @param mav
 *
 */
public RemoteTenant initializeView(HttpServletRequest request, ModelAndView mav) {
    RemoteTenant remoteTenant = null;

    String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
    String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");

    String signedInOperatorId = Security.signedInOperatorId(request);
    Operator signedInOperator = Security.signedInOperator(request);

    if (signedInOperator != null) {
        if (Security.isDeveloper(request) && !Strings.isNullOrEmpty(operatorId))
            remoteTenant = remoteTenantDAO.get(operatorId, tenantId);
        else
            remoteTenant = remoteTenantDAO.get(signedInOperator.getOperatorId(), tenantId);

        if (remoteTenant != null)
            mav.addObject("remoteTenant", remoteTenant);
        mav.addObject("apikey", signedInOperator.getApiKey());
    }

    if (Security.isDeveloper(request) && !Strings.isNullOrEmpty(operatorId))
        mav.addObject("operatorId", operatorId);
    else
        mav.addObject("operatorId", signedInOperatorId);

    mav.addObject("tenantId", tenantId);



    return remoteTenant;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:43,代码来源:ViewInitializationService.java

示例9: create

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView create(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = new ModelAndView("page");
    String operatorId = Security.signedInOperatorId(request);
    Operator operator = Security.signedInOperator(request);
    String operatorIdPar = request.getParameter("operatorId");

    if (Security.isDeveloper(request) || !Strings.isNullOrEmpty(operatorId))
        mav.addObject("operatorId", operatorIdPar);
    else
        mav.addObject("operatorId", operatorId);

    if (operator != null)
        mav.addObject("apiKey", operator.getApiKey());

    if (Security.isSignedIn(request)) {
        mav.addObject("title", "easyrec :: create tenant");
        mav.addObject("page", "easyrec/create");
        mav.addObject("create", true);
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(operatorId));

        Security.setAttribute(request, "tenantId", null);
    } else {
        mav.addObject("page", "home");
    }


    return mav;
}
 
开发者ID:ferronrsmith,项目名称:easyrec,代码行数:29,代码来源:EasyRecController.java

示例10: itemtypes

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView itemtypes(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    ModelAndView mav = new ModelAndView("easyrec/itemtypes");

    Operator signedInOperator = Security.signedInOperator(request);
    RemoteTenant remoteTenant = viewInitializationService.initializeView(request, mav);

    String itemTypeName = ServletUtils.getSafeParameter(request, "itemTypeName", "").toUpperCase();

    if (signedInOperator != null) {

        if (!"".equals(itemTypeName)) {
            //create a new item type if the itemTypeName parameter is set

            String error = isValidItemTypeName(itemTypeName);

            if ("".equals(error)) {
                tenantService.insertItemTypeForTenant(remoteTenant.getId(), itemTypeName, true);
            } else {
                mav.addObject("error", error);
            }
        }

        mav.addObject("apiKey", signedInOperator.getApiKey());
        mav.addObject("itemTypes", itemTypeDAO.getTypes(remoteTenant.getId(), true));
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(remoteTenant.getOperatorId()));
    }


    return mav;
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:31,代码来源:ItemTypeController.java

示例11: refreshstatistics

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView refreshstatistics(HttpServletRequest request, HttpServletResponse response) {

        ModelAndView mav = new ModelAndView();
        List<Message> messages = new ArrayList<Message>();

        String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
        String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
        String url = ServletUtils.getSafeParameter(request, "url", "");
        String description = ServletUtils.getSafeParameter(request, "description", "");

        String signedInOperatorId = Security.signedInOperatorId(request);
        Operator signedInOperator = Security.signedInOperator(request);
        RemoteTenant remoteTenant = null;

        remoteTenant = initializeView(request, mav, operatorId, tenantId, url, description, signedInOperatorId,
                signedInOperator, remoteTenant);

        if (!Security.isSignedIn(request)) {
            messages.add(MSG.NOT_SIGNED_IN);
            return MessageBlock.create(mav, messages, REFRESH_STATISTICS, MSG.ERROR);
        }

        if (!operatorDAO.exists(operatorId)) {
            messages.add(MSG.NO_VALID_OPERATOR);
        }

        if (remoteTenant != null) {
            remoteTenantService.updateTenantStatistics(remoteTenant.getId());
        }
        return MessageBlock.createSingle(mav, MSG.OPERATION_SUCCESSFUL, REFRESH_STATISTICS, MSG.SUCCESS);
    }
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:32,代码来源:RemoteTenantController.java

示例12: initializeView

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
/**
 * This function initializes the Easyrec Web applictaion variables for specific views.
 * Depending whenever the signed in user is a developer or not, this function allows the operator to impersonate
 * another operator and returns the corresponding remote tenant.
 *
 * This function was created due historical circumstances. The code was extracted from the Remote Tenant controller where
 * this code is used very often. Look into this controller tro understand the usage better - sorry
 * @param request
 * @param mav
 * @return
 */
public RemoteTenant initializeView(HttpServletRequest request, ModelAndView mav) {
    RemoteTenant remoteTenant = null;

    String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
    String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");

    String signedInOperatorId = Security.signedInOperatorId(request);
    Operator signedInOperator = Security.signedInOperator(request);

    if (signedInOperator != null) {
        if (Security.isDeveloper(request) && !Strings.isNullOrEmpty(operatorId))
            remoteTenant = remoteTenantDAO.get(operatorId, tenantId);
        else
            remoteTenant = remoteTenantDAO.get(signedInOperator.getOperatorId(), tenantId);

        if (remoteTenant != null)
            mav.addObject("remoteTenant", remoteTenant);
    }

    if (Security.isDeveloper(request) && !Strings.isNullOrEmpty(operatorId))
        mav.addObject("operatorId", operatorId);
    else
        mav.addObject("operatorId", signedInOperatorId);

    mav.addObject("tenantId", tenantId);



    return remoteTenant;
}
 
开发者ID:customertimes,项目名称:easyrec-PoC,代码行数:42,代码来源:ViewInitializationService.java

示例13: actiontypes

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView actiontypes(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    ModelAndView mav = new ModelAndView("easyrec/actiontypes");

    Operator signedInOperator = Security.signedInOperator(request);
    RemoteTenant remoteTenant = viewInitializationService.initializeView(request, mav);

    String actionTypeName = ServletUtils.getSafeParameter(request, "actionTypeName", "").toUpperCase();
    boolean actionTypeHasValue = ServletUtils.getSafeParameter(request, "actionTypeHasValue", "false").equals("true");

    if (signedInOperator != null) {

        if (!"".equals(actionTypeName)) {
            //create a new item type if the itemTypeName parameter is set

            String error = isValidActionTypeName(actionTypeName);

            if ("".equals(error)) {
                actionTypeDAO.insertOrUpdate(remoteTenant.getId(), actionTypeName, actionTypeHasValue);
            } else {
                mav.addObject("error", error);
            }
        }

        Set<String> actionTypes = actionTypeDAO.getTypes(remoteTenant.getId());
        Map<String,Boolean> valueMap = new HashMap<String,Boolean>();

        for (String actionType : actionTypes) {
            boolean hasValue = actionTypeDAO.hasValue(remoteTenant.getId(), actionType);
            valueMap.put(actionType,hasValue);
        }

        mav.addObject("apiKey", signedInOperator.getApiKey());
        mav.addObject("itemTypes", actionTypeDAO.getTypes(remoteTenant.getId()));
        mav.addObject("valueMap",valueMap);
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(remoteTenant.getOperatorId()));
    }


    return mav;
}
 
开发者ID:ferronrsmith,项目名称:easyrec,代码行数:41,代码来源:ActionTypeController.java

示例14: apitest

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView apitest(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = new ModelAndView("apitest/apitest");
    RemoteTenant remoteTenant = viewInitializationService.initializeView(request, mav);
    Operator operator = Security.signedInOperator(request);
    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:7,代码来源:HomeController.java

示例15: update

import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView update(HttpServletRequest request, HttpServletResponse response) {

        ModelAndView mav = new ModelAndView();
        List<Message> messages = new ArrayList<Message>();

        String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
        String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
        String url = ServletUtils.getSafeParameter(request, "url", "");
        String description = ServletUtils.getSafeParameter(request, "description", "");


        String signedInOperatorId = Security.signedInOperatorId(request);
        Operator signedInOperator = Security.signedInOperator(request);
        RemoteTenant remoteTenant = null;

        remoteTenant = initializeView(request, mav, operatorId, tenantId, url, description, signedInOperatorId,
                signedInOperator, remoteTenant);

        if (!Security.isSignedIn(request)) {
            messages.add(MSG.NOT_SIGNED_IN);
            return MessageBlock.create(mav, messages, UPDATE_TENANT, MSG.ERROR);
        }

        if (!operatorDAO.exists(operatorId)) {
            messages.add(MSG.NO_VALID_OPERATOR);
        }


        if (remoteTenant == null) {
            messages.add(MSG.TENANT_NOT_EXISTS);
        }

        if (!Web.isValidUrl(url) || url.equalsIgnoreCase("http://localhost/")) {
            messages.add(MSG.NO_VALID_URL);
        }

        if (messages.size() > 0) {
            return MessageBlock.create(mav, messages, UPDATE_TENANT, MSG.ERROR);
        } else {
            remoteTenantDAO.update(operatorId, remoteTenant.getId(), url, description);

            itemDAO.emptyCache();

            return MessageBlock.createSingle(mav, MSG.TENANT_UPDATED, UPDATE_TENANT, MSG.SUCCESS);

        }
    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:48,代码来源:RemoteTenantController.java


注:本文中的org.easyrec.util.core.Security.signedInOperator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。