• Amrita Priyadarshini Panda 2
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Apex class :-

    global class BlockIEPolicyCondition implements TxnSecurity.PolicyCondition {
     public boolean evaluate(TxnSecurity.Event e) {
      List<User> users = [SELECT ProfileId FROM User WHERE Id = :e.UserId];
            String profileId = (String)users.get(0).get('ProfileId');
            List<Profile> profiles = [SELECT Name FROM Profile WHERE Id = :profileId];
            String profileName = (String)profiles.get(0).get('Name');
            LoginHistory eObj = [SELECT Browser FROM LoginHistory WHERE Id = :e.data.get('LoginHistoryId')];
            string profileName1 = '"' +profileName + '"';
            String P=system.label.BlockIEPolicyProfile;
    Boolean ismatch = p.contains(profileName1);
    if(ismatch){
      if(eObj.Browser == 'IE 11' || eObj.Browser == 'IE 10' || eObj.Browser == 'IE 9' || eObj.Browser == 'IE 8') {
       return true;
     }
     }
    
     return false; 
    }
     }
Apex class :-

    global class BlockIEPolicyCondition implements TxnSecurity.PolicyCondition {
     public boolean evaluate(TxnSecurity.Event e) {
      List<User> users = [SELECT ProfileId FROM User WHERE Id = :e.UserId];
            String profileId = (String)users.get(0).get('ProfileId');
            List<Profile> profiles = [SELECT Name FROM Profile WHERE Id = :profileId];
            String profileName = (String)profiles.get(0).get('Name');
            LoginHistory eObj = [SELECT Browser FROM LoginHistory WHERE Id = :e.data.get('LoginHistoryId')];
            string profileName1 = '"' +profileName + '"';
            String P=system.label.BlockIEPolicyProfile;
    Boolean ismatch = p.contains(profileName1);
    if(ismatch){
      if(eObj.Browser == 'IE 11' || eObj.Browser == 'IE 10' || eObj.Browser == 'IE 9' || eObj.Browser == 'IE 8') {
       return true;
     }
     }
    
     return false; 
    }
     }