How does with and without sharing work in regards to Community users and DML in LWC Apex controllers. Testing without sharing on a community user that does not have CRUD access on the object throws an internal server error. Does with or without sharing not have any effect on DML in LWC controllers for Community users?
Apex class
public without sharing class myClass{
@AuraEnabled
public static void myMethod(Application__c application) {
try {
insert application;
} catch (Exception e) {
throw new AuraHandledException(e.getMessage());
}
}
}
LWC method
handleSubmit() {
processApplication({ application: this.application})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.log(error);
});
}