Is there any restrictions to have a world where humans gain energy by photosynthesis?
You would need to make it worth their while. Photosynthesis is not all that powerful. It's roughly 3-6% efficient. The human skin is roughly 2 square meters in area. If we pretend that all of it is covering the ground like a solar panel, we could pretend we could consume the energy from 2 square meters of area (obviously this is a massive overestimation). Each square meter of the Earth near the equator receives 1.4kW of sunlight. Combining those numbers, photosynthesis could produce 84-168W. Assuming roughly 6 hours of peak sunlight (this is the estimation they use when specing solar panels to a house's consumption), that's on the order of 2000kJ.
Humans consume 2000 Calories a day, which is 8368kJ. That means our photosynthesis could produce 25% of our energy intake. And that was with terribly aggressive overestimates on how much production we could make. You'll never get all 2 square meters perfectly lit by the sun.
So how could we make this work? Well, we could give them a brighter star. Let's say there's roughly 2x higher solar constant: 3.0kW/m^2. And instead of using photosynthesis, at its 3-6% efficiency, let's use the latest and greatest residential photovoltaic cells at 22%. 8368kJ/day is roughly 1400kJ/peak hour, or 388W. With 22% efficient cells and 3.0kW/m^2 solar flux, that would take about half a square meter of surface area. That's starting to get manageable.
Sea Slugs borrow genes from the algae that they eat through horizontal genetic transfer, and incorporate them into their own cells. These cells are so efficient that the sea slug can live up to 9 months without eating.
The Spotted Salamander has a symbiotic relationship with algae cells. The chloroplasts were found near the mitochondria within the salamander’s cells, meaning that the mitochondria were likely directly consuming the oxygen and carbohydrates that are created through photosynthesis.
The Oriental Hornet works a little differently. Instead of chloroplasts, its yellow band contains xanthoperin, which absorbs sunlight and builds up an electric charge that could be conducted through the cuticle of its exoskeleton, as well as through silk surrounding the hornet pupae and the colony’s comb walls. This voltage is released as current when the hornet is in darkness, and seems to be important for the development of the hornet pupae.
The Pea Aphid uses carotenoids instead of chloroplasts. Darker aphids had more carotenoids, and higher levels of adenosine triphosphate (ATP, or energy) than lighter aphids. While more research is necessary to be sure that aphids really have photosynthetic abilities, it is clear that carotenoids can absorb light and pass that energy on to the aphids.
Now for the main question, could this ability be given to a human? Since it is known that the spotted salamander is able to maintain a symbiotic relationship with algae and is able to get energy from it, it's not out of the question that CRISPR or something similar could be used to make sure that the body doesn't attack the algae cells, or even integrate the specific DNA directly like the sea slug. It would mainly be useful in the skin cells, as that's the part of the body that receives light.
If carotenoids are used instead of chloroplasts then you could end up with skin that is white and orange along with green, though the darker colors give more energy.
You couldn't live on it solely, but it could help supplement the energy received from food.
Assuming plants maintain their relative levels of efficiency in photosynthesis, a human, as noted, simply does not have the surface area to support enough photosynthesis to really matter. Needing @ an acre of surface area to support a single human is somewhat impractical, unless we change venues:
A human/plant symbiont with an acre of surface area could exist in free fall. The plant part would absorb sunlight and the waste products of the human part, and the human part would receive sugars, starches and O2 in return, essentially creating a small closed ecosystem.
Hyperplant/human organism in orbit
The plant would have to be drastically modified, needing some sort of waxy coating to seal in the water and gasses from the vacuum, and likely light and dark surfaces to act as solar sails, as well as some sort of musculature to orient the "leaves". the human part would have the roots of the plant embedded in most of the body, with some of the roots absorbing the waste products while others deliver the plant's "waste" products.
Like everything else, there would be evolutionary adaptations (much larger, more elaborate plants in deep space where sunlight is more limited, for example), and the organism would have to land on NEO's or asteroids from time to time in order to "top up" water and elements which have been lost due to inefficiencies of the system.
So using photosynthesis with a human is possible, so long as you change the parameters to make it fit the environment.
There is nothing that expressly prevents this in biology, save efficiency. While green Photosynthesis is 5% efficient, Black is 12%. On the other hand, Photovoltaics produce closer to 23%.
Skin with chlorophyll will be significantly stiffer than normal, but the same is true with scales, so if you want to use plant-people they need to map the stiffness based on necessary flexibility (not the inside of the elbow etc.)
Photovoltaics don't arise naturally, however, it is biocompatible, and doesn't need to be ex-macana added. There arises a need for an engineer for that.
THIS WILL BE SUPPLEMENTAL and not be your primary diet. Those you use this method may be nocturnal and lock into position to sleep (this is very prevalent in the animal kingdom)
This could also be a mechanism to directly supply O2 and cellulose sugar into the bloodstream, allowing for a solution to a host of blood-oxygen and blood-sugar related problems; These being everything from Type 1 diabetes to altitude sickness and co2 poisoning (a MAJOR barrier to space travel, Morso than heat and oxygen supply)
At 100% the Photovoltaic skin could produce 0.6 watts per inch. at that rate fruits and small organisms could supplement the body completely. (mostly for the vitamins and minerals, not energy) Humans do not need or generate much power. If a person consumes 2000 calories in a day; And every calorie from food defined as 4200 joules of energy. Used over the course of a day (86,400 seconds), this person uses an average of 97.2 joules a second, meaning they have an average power of 97.2 watts.
Thus needing less than a square foot of skin to use this method.
Directly yes, we don't photosynthesise, so they wouldn't be human if they did.
Indirectly, no, we already derive energy from it we're at the top of a food chain where the bottom photosynthesises.
We've been getting energy from photosynthesis for millennia. We call it farming.
Almost every form of energy, from fossil fuels to hydroelectric has, at its source, the Sun. The only methods that don't rely on the sun are geothermal and fission.