Here is a code fragment in Drupal 7 that implements a callback with the aim of facilitating two actions according to the action that you want to carry out.
In this snippet we will mark the obligatory fields present as non-obligatory, and it will be under the condition that the user actually has the role of administrator.