You can write a quick Execute Anonymous script. Note that this obviously needs to run as administrator.
String permissionSetName = 'Test'; // Change me
Set<String> objectNames = Schema.getGlobalDescribe().keySet().clone();
PermissionSet ps = [SELECT Id FROM PermissionSet WHERE Name = :permissionSetName];
ObjectPermissions[] permissions = [SELECT sObjectType, PermissionsRead, PermissionsEdit FROM ObjectPermissions WHERE ParentId = :ps.Id];
for(ObjectPermissions permission: permissions) {
permission.PermissionsRead = true;
permission.PermissionsEdit = false;
permission.PermissionsModifyAllRecords = false;
objectNames.remove(permission.sObjectType);
}
for(String theType: objectNames) {
permissions.add(
new ObjectPermissions(
ParentId = ps.Id,
sObjectType = theType,
PermissionsCreate = true,
PermissionsRead = true
)
);
}
permissions.sort();
Database.upsert(permissions, false);
The allOrNone
parameter is used to avoid describe calls you'd need to make to figure out which objects to update. This should work even in very large orgs with thousands of objects, but you should limit this to one or two permission sets at a time.