function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfadm sfdevsfadm sfdev 

Get currently logged user from apex

Hello,

I need to take programmatically the currently logged user via apex source code to change the permissions of that user.
Here is my code:
public with sharing class UnlockRecordDuringApprovalController {
 
Opportunity objOpportunity;
 
public UnlockRecordDuringApprovalController(ApexPages.StandardController controller) { 
objOpportunity = (Opportunity)controller.getRecord(); 
}
 
public void processRecord() {
 
}
 
}


Please advise or give example(s) how this can be achieved in Salesforce?
Thank you