<commit_before>package scoutmgr.client.security;

import com.gwtplatform.mvp.client.proxy.Gatekeeper;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
import com.gwtplatform.mvp.shared.proxy.PlaceRequest;
import javax.inject.Inject;
import scoutmgr.client.entity.Person;
import scoutmgr.client.ioc.FrontendContext;

public class ScoutViewGatekeeper
  implements Gatekeeper
{
  private static final String[] VIEW_ALL_SCOUT_ROLES = new String[]{ "SITE_ADMIN", "MEMBER_ADMIN" };
  @Inject
  private FrontendContext _frontendContext;
  @Inject
  private PlaceManager _placeManager;

  @Override
  public boolean canReveal()
  {
    if ( !_frontendContext.isLoggedIn() )
    {
      return false;
    }

    // Roles allowed to view all scouts
    if ( PermissionUtil.hasAnyOf( _frontendContext.getUser(),
                                  VIEW_ALL_SCOUT_ROLES ) )
    {
      return true;
    }

    final Person person = _frontendContext.getPerson();
    if ( null == person )
    {
      return false;
    }

    // ID of scout trying to be viewed
    final PlaceRequest currentPlaceRequest = _placeManager.getCurrentPlaceRequest();
    final String scoutID = currentPlaceRequest.getParameter( "ID", null );
    if ( null == scoutID )
    {
      return false;
    }

    // Ability to view yourself
    if ( scoutID.equals(person.getID().toString()))
    {
      return true;
    }

    // Viewing all scouts in your Section
    return false;<commit_msg>ID -> id for parameter name<commit_after>package scoutmgr.client.security;

import com.gwtplatform.mvp.client.proxy.Gatekeeper;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
import com.gwtplatform.mvp.shared.proxy.PlaceRequest;
import javax.inject.Inject;
import scoutmgr.client.entity.Person;
import scoutmgr.client.ioc.FrontendContext;

public class ScoutViewGatekeeper
  implements Gatekeeper
{
  private static final String[] VIEW_ALL_SCOUT_ROLES = new String[]{ "SITE_ADMIN", "MEMBER_ADMIN" };
  @Inject
  private FrontendContext _frontendContext;
  @Inject
  private PlaceManager _placeManager;

  @Override
  public boolean canReveal()
  {
    if ( !_frontendContext.isLoggedIn() )
    {
      return false;
    }

    // Roles allowed to view all scouts
    if ( PermissionUtil.hasAnyOf( _frontendContext.getUser(),
                                  VIEW_ALL_SCOUT_ROLES ) )
    {
      return true;
    }

    final Person person = _frontendContext.getPerson();
    if ( null == person )
    {
      return false;
    }

    // ID of scout trying to be viewed
    final PlaceRequest currentPlaceRequest = _placeManager.getCurrentPlaceRequest();
    final String scoutID = currentPlaceRequest.getParameter( "id", null );
    if ( null == scoutID )
    {
      return false;
    }

    // Ability to view yourself
    if ( scoutID.equals(person.getID().toString()))
    {
      return true;
    }

    // Viewing all scouts in your Section
    return false;
{'fraction_non_alphanumeric': 0.09146757679180888, 'fraction_numerical': 0.0, 'mean_word_length': 3.031636863823934, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '20303', 'n_tokens_mistral': 904, 'n_tokens_neox': 886, 'n_words': 209}