本文整理汇总了Java中org.easyrec.util.core.Security.isDeveloper方法的典型用法代码示例。如果您正苦于以下问题:Java Security.isDeveloper方法的具体用法?Java Security.isDeveloper怎么用?Java Security.isDeveloper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.easyrec.util.core.Security
的用法示例。
在下文中一共展示了Security.isDeveloper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: emptypluginlogs
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView emptypluginlogs(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
logEntryDAO.deleteLogEntries();
return MessageBlock.createSingle(mav, MSG.OPERATION_SUCCESSFUL, EMPTY_PLUGIN_LOGS, MSG.SUCCESS);
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, EMPTY_PLUGIN_LOGS, MSG.ERROR);
}
}
示例2: pullusedmem
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView pullusedmem(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
return MessageBlock.createSingle(mav, MSG.OPERATION_SUCCESSFUL,
Long.toString(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / (1000000)),
MSG.SUCCESS);
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, PULL_USED_MEM, MSG.ERROR);
}
}
示例3: jamonreset
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView jamonreset(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
mav.setViewName("dev/page");
mav.addObject("page", "output");
mav.addObject("outstr", "report reset");
MonitorFactory.reset();
return mav;
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, JAMON_RESET, MSG.ERROR);
}
}
示例4: removetenant
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView removetenant(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
RemoteTenant remoteTenant = remoteTenantDAO.get(operatorId, tenantId);
if (remoteTenant != null) {
remoteTenantService.removeTenant(remoteTenant.getId());
Security.setAttribute(request, "tenantId", null);
return MessageBlock.createSingle(mav, MSG.TENANT_REMOVED, REMOVE_TENANT, MSG.SUCCESS);
}
return MessageBlock.createSingle(mav, MSG.TENANT_REMOVE_FAILED, REMOVE_TENANT, MSG.ERROR);
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, REMOVE_TENANT, MSG.ERROR);
}
}
示例5: storesessionmapping
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView storesessionmapping(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
String sessionmapping = ServletUtils.getSafeParameter(request, "sessionmapping", "");
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
RemoteTenant r = remoteTenantDAO.get(operatorId, tenantId);
if (r != null) {
r.setSessionMapping(sessionmapping);
tenantService.storeTenantConfig(r.getId(), r.getTenantConfigProperties());
}
return MessageBlock.createSingle(mav, MSG.SESSIONMAPPING_CONFIG_CHANGED, SESSION_MAPPING, MSG.SUCCESS);
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, SESSION_MAPPING, MSG.ERROR);
}
}
示例6: remove
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView remove(HttpServletRequest request, HttpServletResponse httpServletResponse) {
ModelAndView mav = security(request);
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
if (Security.isDeveloper(request)) {
Operator operator = operatorDAO.get(operatorId);
if (operator != null) {
if (!operator.getOperatorId().equals(Operator.DEFAULT_OPERATORID)) {
List<RemoteTenant> tenants = remoteTenantDAO.getTenantsFromOperator(operatorId);
for (RemoteTenant remoteTenant : tenants) {
remoteTenantService.removeTenant(remoteTenant.getId());
}
operatorDAO.remove(operatorId);
return MessageBlock.createSingle(mav, MSG.OPERATOR_REMOVED, "removeOperator", MSG.SUCCESS);
}
}
}
return MessageBlock.createSingle(mav, MSG.OPERATOR_REMOVE_FAILED, "removeOperator", MSG.ERROR);
}
示例7: pluginupload
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView pluginupload(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
mav.setViewName("dev/page");
mav.addObject("page", "pluginupload");
mav.addObject("tenantId", tenantId);
mav.addObject("operatorId", operatorId);
mav.addObject("signedinOperatorId", Security.signedInOperatorId(request));
return mav;
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, PLUGIN_UPLOAD, MSG.ERROR);
}
}
示例8: storepluginsactive
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView storepluginsactive(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
String pluginsactive = ServletUtils.getSafeParameter(request, "pluginsactive", "");
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
mav.setViewName("dev/page");
RemoteTenant r = remoteTenantDAO.get(operatorId, tenantId);
if (r != null) {
tenantService.updateConfigProperty(r.getId(), PluginRegistry.PLUGINS_ENABLED_PROP, pluginsactive);
r.setPlugins(pluginsactive);
remoteTenantDAO.updateTenantInCache(r);
}
return MessageBlock.createSingle(mav, MSG.OPERATION_SUCCESSFUL, STORE_PLUGINS_ACTIVE, MSG.SUCCESS);
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, STORE_PLUGINS_ACTIVE, MSG.ERROR);
}
}
示例9: viewoperators
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView viewoperators(HttpServletRequest request, HttpServletResponse httpServletResponse) {
PageStringGenerator psg = new PageStringGenerator(
request.getRequestURL() + "?" + request.getQueryString());
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
String searchString = ServletUtils.getSafeParameter(request, "searchString", "");
int siteNumber = ServletUtils.getSafeParameter(request, "siteNumber", 0);
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
mav.addObject("searchString", searchString);
mav.addObject("url", request.getRequestURL());
if (Security.isDeveloper(request)) {
int operatorsTotal = operatorDAO.count(searchString);
mav.addObject("operatorsTotal", operatorsTotal);
mav.addObject("pageMenuString", psg.getPageMenuString(operatorsTotal, siteNumber));
List<Operator> operators = operatorDAO.getOperators(searchString, siteNumber * psg.getNumberOfItemsPerPage(), psg.getNumberOfItemsPerPage());
mav.setViewName("dev/page");
mav.addObject("page", "viewoperators");
mav.addObject("operators", operators);
mav.addObject("dbname", operatorDAO.getDbName());
return mav;
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, VIEW_OPERATORS, MSG.ERROR);
}
}
示例10: 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;
}
示例11: plugininstall
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView plugininstall(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
mav.setViewName("dev/page");
mav.addObject("page", "plugins");
mav.addObject("signedinOperatorId", Security.signedInOperatorId(request));
String pluginId = ServletUtils.getSafeParameter(request, "pluginId", "");
String versionStr = ServletUtils.getSafeParameter(request, "version", "");
Version version = new Version(versionStr);
logger.info("Called plugin install! " + pluginId + ", " + version);
try {
pluginRegistry.installPlugin(new URI(pluginId), version);
} catch (URISyntaxException use) {
// should never happen since the id has been checkec several times before in the workflow
logger.error("PluginId is not a valid URI!");
}
return MessageBlock.createSingle(mav, MSG.PLUGIN_INSTALLED, PLUGIN_INSTALL, MSG.SUCCESS);
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, PLUGIN_INSTALL, MSG.ERROR);
}
}
示例12: pluginchangestate
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView pluginchangestate(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
mav.setViewName("dev/page");
mav.addObject("page", "plugins");
String pluginId = ServletUtils.getSafeParameter(request, "pluginId", "");
String versionStr = ServletUtils.getSafeParameter(request, "version", "");
String checked = ServletUtils.getSafeParameter(request, "checked", ""); // Checkbox checked state
if (checked.equalsIgnoreCase("false")) {
pluginRegistry.deactivatePlugin(URI.create(pluginId), Version.parseVersion(versionStr));
} else {
pluginRegistry.installPlugin(URI.create(pluginId), Version.parseVersion(versionStr));
}
// this call is to refresh all tenant settings in the db
remoteTenantDAO.getAllTenants();
return MessageBlock.createSingle(mav, MSG.OPERATION_SUCCESSFUL, PLUGIN_CHANGESTATE, MSG.SUCCESS, "");
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, PLUGIN_CHANGESTATE, MSG.ERROR);
}
}
示例13: 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;
}
示例14: pluginstop
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView pluginstop(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
String key = ServletUtils.getSafeParameter(request, "key", "");
String value = ServletUtils.getSafeParameter(request, "value", "");
String enabled = ServletUtils.getSafeParameter(request, "enabled", "");
String executiontime = ServletUtils.getSafeParameter(request, "executiontime", "");
String archiving = ServletUtils.getSafeParameter(request, "archiving", "");
String archivingtime = ServletUtils.getSafeParameter(request, "archivingtime", "");
String backtracking = ServletUtils.getSafeParameter(request, "backtracking", "");
String maxactions = ServletUtils.getSafeParameter(request, "maxactions", "");
String pluginsactive = ServletUtils.getSafeParameter(request, "pluginsactive", "");
int siteNumber = ServletUtils.getSafeParameter(request, "siteNumber", 0);
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
mav.setViewName("dev/page");
mav.addObject("page", "plugins");
String pluginId = ServletUtils.getSafeParameter(request, "pluginId", "");
String versionStr = ServletUtils.getSafeParameter(request, "version", "");
PluginId pluginIdToStop = new PluginId(pluginId, versionStr);
Map<PluginId, Generator<GeneratorConfiguration, GeneratorStatistics>> generators = this.pluginRegistry
.getGenerators();
Generator<GeneratorConfiguration, GeneratorStatistics> generator = generators.get(pluginIdToStop);
generator.abort();
return MessageBlock.createSingle(mav, MSG.OPERATION_SUCCESSFUL, "pluginstop", MSG.SUCCESS, "");
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, PLUGIN_STOP, MSG.ERROR);
}
}
示例15: storearchive
import org.easyrec.util.core.Security; //导入方法依赖的package包/类
public ModelAndView storearchive(HttpServletRequest request, HttpServletResponse httpServletResponse) {
String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
String archiving = ServletUtils.getSafeParameter(request, "archiving", "");
String archivingtime = ServletUtils.getSafeParameter(request, "archivingtime", "");
ModelAndView mav = new ModelAndView("page");
mav.addObject("title", "easyrec :: administration");
mav.addObject("operatorId", operatorId);
mav.addObject("tenantId", tenantId);
if (Security.isDeveloper(request)) {
RemoteTenant r = remoteTenantDAO.get(operatorId, tenantId);
if (r != null) {
r.setAutoArchiving(archiving);
if (!Strings.isNullOrEmpty(archivingtime)) {
r.setAutoArchiverTimeRange(archivingtime);
}
tenantService.storeTenantConfig(r.getId(), r.getTenantConfigProperties());
}
return MessageBlock.createSingle(mav, MSG.ARCHIVE_CONFIG_CHANGED, STORE_ARCHIVE, MSG.SUCCESS);
} else {
return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, STORE_ARCHIVE, MSG.ERROR);
}
}