use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class PopupMenuItemContextDataDriven method reCreateSubMenu.
protected void reCreateSubMenu(SiteNode sn) {
final List<JMenuItem> mainPopupMenuItems = View.getSingleton().getPopupList();
for (ExtensionPopupMenuItem menu : subMenus) {
mainPopupMenuItems.remove(menu);
}
subMenus.clear();
Session session = Model.getSingleton().getSession();
List<Context> contexts = session.getContexts();
for (Context context : contexts) {
if (context.isIncluded(sn)) {
ExtensionPopupMenuItem piicm = createPopupDataDrivenNodeMenu(context);
piicm.setMenuIndex(this.getMenuIndex());
mainPopupMenuItems.add(piicm);
this.subMenus.add(piicm);
}
}
}
use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class PopupMenuItemContextExclude method reCreateSubMenu.
protected void reCreateSubMenu() {
final List<JMenuItem> mainPopupMenuItems = View.getSingleton().getPopupList();
for (ExtensionPopupMenuItem menu : subMenus) {
mainPopupMenuItems.remove(menu);
}
subMenus.clear();
Session session = Model.getSingleton().getSession();
List<Context> contexts = session.getContexts();
for (Context context : contexts) {
ExtensionPopupMenuItem piicm = createPopupExcludeFromContextMenu(context);
piicm.setMenuIndex(this.getMenuIndex());
mainPopupMenuItems.add(piicm);
this.subMenus.add(piicm);
}
}
use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class SessionDialog method recreateUISharedContexts.
/**
* Reset the UI shared Context copies. The effect is that previous copies are discarded and new
* copies are created.
*
* @param session the session
*/
public void recreateUISharedContexts(Session session) {
uiContexts.clear();
for (Context context : session.getContexts()) {
Context uiContext = context.duplicate();
uiContexts.put(context.getIndex(), uiContext);
}
}
use of org.zaproxy.zap.model.Context in project zaproxy by zaproxy.
the class ForcedUserAPI method handleApiView.
@Override
public ApiResponse handleApiView(String name, JSONObject params) throws ApiException {
log.debug("handleApiView " + name + " " + params.toString());
switch(name) {
case VIEW_GET_FORCED_USER:
Context context = ApiUtils.getContextByParamId(params, PARAM_CONTEXT_ID);
User forcedUser = extension.getForcedUser(context.getIndex());
if (forcedUser != null)
return new ApiResponseElement("forcedUserId", Integer.toString(forcedUser.getId()));
else
return new ApiResponseElement("forcedUserId", "");
case VIEW_IS_FORCED_USER_MODE_ENABLED:
return new ApiResponseElement("forcedModeEnabled", Boolean.toString(extension.isForcedUserModeEnabled()));
default:
throw new ApiException(Type.BAD_VIEW);
}
}
Aggregations