Check Current user has a custom permission

The custom permission could be assigned via a Permission Set or a Permission Group set.  Sometimes, we need to check the logged in user has custom permission assigned. 

FeatureManagement system method 

salesforce winter 18's release introduced a new system class FeatureManagement. It has a methods checkPermission to check current logged user has specific permissions or not. It will return true or false based on custom permission assignment. It don't required SOQL. 
Boolean isUserHasCP = FeatureManagement.checkPermission('Custom Permission API Name');

Source:
https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_FeatureManagement.htm#apex_System_FeatureManagement_checkPermission

Labels:
Join the conversation