本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}