Tabnine Logo
Username.getUsername
Code IndexAdd Tabnine to your IDE (free)

How to use
getUsername
method
in
com.thoughtworks.go.server.domain.Username

Best Java code snippets using com.thoughtworks.go.server.domain.Username.getUsername (Showing top 20 results out of 315)

origin: gocd/gocd

private String calcEtag(Username username, List<GoDashboardPipelineGroup> pipelineGroups, List<GoDashboardEnvironment> environments) {
  final String pipelineSegment = pipelineGroups.stream().
      map(GoDashboardPipelineGroup::etag).collect(Collectors.joining(SEP_CHAR));
  final String environmentSegment = environments.stream().
      map(GoDashboardEnvironment::etag).collect(Collectors.joining(SEP_CHAR));
  return DigestUtils.md5Hex(StringUtils.joinWith(SEP_CHAR, username.getUsername(), pipelineSegment, environmentSegment));
}
origin: gocd/gocd

  private String calcPipelinesDataEtag(Username username, List<PipelineConfigs> pipelineConfigs) {
    final HashMap<String, List<CaseInsensitiveString>> pipelinesDataSegment = new HashMap<>();
    for (PipelineConfigs group : pipelineConfigs) {
      final List<PipelineConfig> pipelines = group.getPipelines();
      if (!pipelines.isEmpty()) {
        List<CaseInsensitiveString> pipelineNames = pipelines.stream().map(PipelineConfig::name).collect(Collectors.toList());
        pipelinesDataSegment.put(group.getGroup(), pipelineNames);
      }
    }
    return DigestUtils.md5Hex(StringUtils.joinWith("/", username.getUsername(), pipelinesDataSegment));
  }
}
origin: gocd/gocd

public boolean hasAdminPermissionsForPipeline(Username username, CaseInsensitiveString pipelineName) {
  String groupName = goConfigService.findGroupNameByPipeline(pipelineName);
  if (groupName == null) {
    return true;
  }
  return isUserAdminOfGroup(username.getUsername(), groupName);
}
origin: gocd/gocd

public List<PipelineConfig> getAllPipelineConfigsForEditForUser(Username username) {
  ArrayList<PipelineConfig> pipelineConfigs = new ArrayList<>();
  List<String> groupsForUser = getConfigForEditing().getGroupsForUser(username.getUsername(), rolesForUser(username.getUsername()));
  for (String groupName : groupsForUser) {
    pipelineConfigs.addAll(getAllPipelinesForEditInGroup(groupName).getPipelines());
  }
  return pipelineConfigs;
}
origin: gocd/gocd

public List<CaseInsensitiveString> viewablePipelinesFor(Username username) {
  List<CaseInsensitiveString> pipelines = new ArrayList<>();
  for (String group : goConfigService.allGroups()) {
    if (hasViewPermissionForGroup(CaseInsensitiveString.str(username.getUsername()), group)) {
      pipelines.addAll(goConfigService.pipelines(group));
    }
  }
  return pipelines;
}
origin: gocd/gocd

public static BuildCause createManualForced(MaterialRevisions materialRevisions, Username username) {
  if (username == null) {
    throw new IllegalArgumentException("Username cannot be null");
  }
  String message = String.format("Forced by %s", username.getDisplayName());
  return new BuildCause(materialRevisions, BuildTrigger.forForced(message), CaseInsensitiveString.str(username.getUsername()));
}
origin: gocd/gocd

public static void toJSON(OutputWriter writer, UserToRepresent user) {
  writer.addLinks(linksWriter -> linksWriter
      .addLink("self", String.format("%s/%s", Routes.Users.BASE, user.getUsername().getUsername().toString()))
      .addLink("find", String.format("%s%s", Routes.Users.BASE, Routes.Users.USER_NAME))
      .addAbsoluteLink("doc", Routes.Users.DOC));
  represent(writer, user);
}
origin: gocd/gocd

  private boolean userDoesNotHaveViewPermission(Username user, LocalizedOperationResult operationResult) {
    if (!securityService.hasViewPermissionForPipeline(user, pipelineName)) {
      operationResult.forbidden("User '" + CaseInsensitiveString.str(user.getUsername()) + "' does not have view permission on pipeline '" + pipelineName + "'", forbiddenForPipeline(pipelineName));
      return true;
    }
    return false;
  }
}
origin: gocd/gocd

private boolean isAuthorized() {
  if (goConfigService.isAdministrator(username.getUsername())) {
    return true;
  }
  result.forbidden(forbiddenToEdit(), forbidden());
  return false;
}
origin: gocd/gocd

  private boolean isAuthorized() {
    if (!(goConfigService.isUserAdmin(username) || goConfigService.isGroupAdministrator(username.getUsername()))) {
      result.forbidden(forbiddenToEdit(), forbidden());
      return false;
    }
    return true;
  }
}
origin: gocd/gocd

@Override
public boolean canContinue(CruiseConfig cruiseConfig) {
  if (!goConfigService.isAdministrator(username.getUsername())) {
    result.forbidden(LocalizedMessage.forbiddenToEditResource("environment", environmentConfig.name(), username.getDisplayName()), HealthStateType.forbidden());
    return false;
  }
  return true;
}
origin: gocd/gocd

public boolean canEditPipeline(String pipelineName, Username username) {
  PipelineConfig pipelineConfig;
  try {
    pipelineConfig = pipelineConfigNamed(new CaseInsensitiveString(pipelineName));
  } catch (PipelineNotFoundException e) {
    return false;
  }
  return pipelineConfig != null && pipelineConfig.isLocal() && isUserAdminOfGroup(username.getUsername(), findGroupNameByPipeline(pipelineConfig.name()));
}
origin: gocd/gocd

public void checkPermission(CruiseConfig cruiseConfig, LocalizedOperationResult result) {
  String groupName = cruiseConfig.getGroups().findGroupNameByPipeline(new CaseInsensitiveString(pipeline));
  if (!securityService.isUserAdminOfGroup(username.getUsername(), groupName)) {
    result.forbidden(LocalizedMessage.forbiddenToEdit(), null);
  }
}
origin: gocd/gocd

private void populateStageOperatePermission(PipelineInstanceModel pipelineInstanceModel, Username username) {
  for (StageInstanceModel stage : pipelineInstanceModel.getStageHistory()) {
    stage.setOperatePermission(securityService.hasOperatePermissionForStage(pipelineInstanceModel.getName(), stage.getName(), CaseInsensitiveString.str(username.getUsername())));
  }
}
origin: gocd/gocd

  @Override
  public boolean canContinue(CruiseConfig cruiseConfig) {
    if (goConfigService.groups().hasGroup(groupName) && !goConfigService.isUserAdminOfGroup(currentUser.getUsername(), groupName)) {
      result.forbidden(forbiddenToEditGroup(groupName), forbidden());
      return false;
    }
    return true;
  }
}
origin: gocd/gocd

private GoDashboardEnvironment dashboardEnvironmentFor(EnvironmentConfig environment, DashboardFilter filter, Username user, Users allowedUsers, GoDashboardPipelines allPipelines) {
  GoDashboardEnvironment env = new GoDashboardEnvironment(environment.name().toString(), allowedUsers);
  environment.getPipelineNames().forEach(pipelineName -> {
    GoDashboardPipeline pipeline = allPipelines.find(pipelineName);
    if (null != pipeline && pipeline.canBeViewedBy(user.getUsername().toString()) &&
        filter.isPipelineVisible(pipelineName)) {
      env.addPipeline(pipeline);
    }
  });
  return env;
}
origin: gocd/gocd

public void updateComment(String pipelineName, int pipelineCounter, String comment, Username username, HttpLocalizedOperationResult result) {
  if (!Toggles.isToggleOn(Toggles.PIPELINE_COMMENT_FEATURE_TOGGLE_KEY)) {
    result.notImplemented("'Pipeline Comment' feature is turned off. Please turn it on to use it.");
    return;
  }
  if (securityService.hasOperatePermissionForPipeline(username.getUsername(), pipelineName)) {
    pipelineDao.updateComment(pipelineName, pipelineCounter, comment);
  } else {
    result.forbidden("You do not have operate permissions for pipeline '" + pipelineName + "'.", HealthStateType.general(HealthStateScope.forPipeline(pipelineName)));
  }
}
origin: gocd/gocd

  @Override
  public boolean canContinue(CruiseConfig cruiseConfig) {
    String groupName = goConfigService.findGroupNameByPipeline(pipelineConfig.name());
    if (goConfigService.groups().hasGroup(groupName) && !goConfigService.isUserAdminOfGroup(currentUser.getUsername(), groupName)) {
      result.forbidden(LocalizedMessage.forbiddenToDelete("Pipeline", pipelineConfig.getName()), HealthStateType.forbidden());
      return false;
    }
    return true;
  }
}
origin: gocd/gocd

private void populateCanRunStatus(Username username, PipelineInstanceModel pipelineInstanceModel) {
  for (StageInstanceModel stageHistoryItem : pipelineInstanceModel.getStageHistory()) {
    boolean canRun = scheduleService.canRun(
        pipelineInstanceModel.getPipelineIdentifier(), stageHistoryItem.getName(),
        CaseInsensitiveString.str(username.getUsername()), pipelineInstanceModel.hasPreviousStageBeenScheduled(
            stageHistoryItem.getName()));
    stageHistoryItem.setCanRun(canRun);
  }
  populatePipelineCanRunStatus(username, pipelineInstanceModel);
}
origin: gocd/gocd

public static void represent(OutputWriter childWriter, UserToRepresent user) {
  childWriter.add("login_name", user.getUsername().getUsername().toString())
      .add("display_name", user.getDisplayName())
      .add("enabled", user.isEnabled())
      .add("email", user.getEmail())
      .add("email_me", user.isEmailMe())
      .add("is_admin", user.isAdmin())
      .addChildList("roles", listWriter -> user.getRoles().forEach(role -> listWriter.addChild(propertyWriter -> RoleRepresenter.toJSON(propertyWriter, role))))
      .addChildList("checkin_aliases", user.getMatchers());
}
com.thoughtworks.go.server.domainUsernamegetUsername

Popular methods of Username

  • <init>
  • equals
  • getDisplayName
  • isAnonymous
  • valueOf
  • hashCode
  • isGoAgentUser

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSharedPreferences (Context)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • String (java.lang)
  • Path (java.nio.file)
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now