Any code behind in SharePoint defaults to run as the current logged on user on the site. However this can become an issue if you want to programmatically update/access content that the user does not have permission to. For instance on the code behind of a layout page or workflow.
To get around this you need to run the code under ‘elevated privileges‘ following the example below:
using (SPSite site = new SPSite(web.Site.ID))
// write your code here