• Madog Williams
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 1
    Replies
In "Keep Data Secure in a Recruiting App" trailhead project, on step "Restrict Data Access with Field-Level Security, Permission Sets, and Sharing Settings", I have got the following error :

Review the instructions for setting the Job Posting status to 'Read/Write'

Did someone faced that and how to fix it ?

There's something weird. on the last screenshot regarding (Sharing settings), I see that Job Posting is "Public read only"
But this object is a junction object and following the steps won't give access to this setting but "Controlled by Parent".

I'm don't understand what "status" is referenced by the error message. There's a status field on Job Posting Site object as well as on Position object but not on Job Posting which contains only 2 master details fields.
Hi folks, 

I'm on the Transaction Security module and attempting the section "Explore Custom Transaction Security Policies". When I paste the test code into my BlockAndroidPolicyCondition Apex Class I'm getting the error below. Any suggestions why?


Error: Compile Error: Missing '<EOF>' at '@' at line 15 column 1

Code:
 
global class BlockAndroidPolicyCondition implements TxnSecurity.PolicyCondition {

 public boolean evaluate(TxnSecurity.Event e) {
LoginHistory eObj = [SELECT Platform FROM LoginHistory WHERE Id = :e.data.get('LoginHistoryId')];
  if (eObj != null) {  // Addition
    if(eObj.Platform.contains('Android') &&
       eObj.Platform.compareTo('Android 5') < 0) {
      return true;
    }
  } // Addition
 return false; 
}
 }
 
@isTest
public class TestBlockAndroid {
  public static testMethod void testIsAndroid() {

    /* Create a history object that has Platform = Android 4. */
    LoginHistory loginHistoryObj = new LoginHistory();
    loginHistoryObj.Platform = 'Android 4';

    /* Create a map for the event we’re going to build. */
    Map<String, String> eventData = new Map<String, String>();

    /* Insert the LoginHistoryId into the event data map. */
    insert loginHistoryObj;
    eventData.put('LoginHistoryId', loginHistoryObj.id);

    /* We’re not going to cause a real event in the org.
       Instead, we’re going to create a Transaction Security
       event object and “feed” it to the Policy Engine. */
    /* You can find more about TxnSecurity.Event in the 
       Apex Developer Guide. */
    TxnSecurity.Event e = new TxnSecurity.Event(
      '00Dxxx123123123', /* organizationId */
      '005xxx123123123', /* userId */
      'AuthSession', /* entityName */
      'Login', /* action */
      'LoginHistory', /* resourceType */
      '01pR00000009D2H', /* entityId */
      Datetime.newInstance(2016, 2, 15), /* timeStamp */
      eventData; ) /* data - Map with info about this event. */
        /* The only info in the map is the login history, and
           the only info in the login history is the Platform. */

    /* We are unit testing a PolicyCondition that triggers
       when a login is from Android OS version 5 or older. */
    BlockAndroidPolicyCondition condition =
      new BlockAndroidPolicyCondition();

    /* Assert that the condition is triggered by evaluating
       the event e. The Transaction Security PolicyCondition
       interface returns True if the policy is triggered. */
    System.assertEquals(true, condition.evaluate(e));
  }
}

@isTest
public class TestBlockAndroid {
  public static testMethod void testIsNotAndroid() {

    /* Create a history object that has Platform = Android 6. */
    LoginHistory loginHistoryObj = new LoginHistory();
    loginHistoryObj.Platform = 'Android 6';

    /* Create a map for the event we’re going to build. */
    Map<String, String> eventData = new Map<String, String>();

    /* Insert the LoginHistoryId into the event data map. */
    insert loginHistoryObj;
    eventData.put('LoginHistoryId', loginHistoryObj.id);

    /* We’re not going to cause a real event in the org.
       Instead, we’re going to create a Transaction Security
       event object and “feed” it to the Policy Engine. */
    /* You can find more about TxnSecurity.Event in the 
       Apex Developer Guide. */
    TxnSecurity.Event e = new TxnSecurity.Event(
      '00Dxxx123123123', /* organizationId */
      '005xxx123123123', /* userId */
      'AuthSession', /* entityName */
      'Login', /* action */
      'LoginHistory', /* resourceName */
      '01pR00000009D2H', /* entityId */
      Datetime.newInstance(2016, 2, 15), /* timeStamp */
      eventData; ) /* data - Map with info about this event. */
        /* The only info in the map is the login history, and
           the only info in the login history is the Platform. */

    /* We are unit testing a PolicyCondition that triggers
       when a login is from an Android OS version newer than 5. */
    BlockAndroidPolicyCondition condition =
      new BlockAndroidPolicyCondition();

    /* Assert that the condition is NOT triggered by evaluating
       the event e. The Transaction Security PolicyCondition
       interface returns False if the policy is not triggered. */
    System.assertEquals(false, condition.evaluate(e));
  }
}

 
  • May 09, 2018
  • Like
  • 1