Answers.Body: <p>I don't think you can do this in a platform-independent way since &quot;admin role&quot; means different things in different CMS's. What you can do that is platform-independent is check specific CiviCRM permissions, e.g. <code>CRM_Core_Permission::check('administer CiviCRM', $contact_id)</code></p>
  <p>You can leave out $contact_id to check for the currently logged-in user.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-28T16:19:04.457Z
Answers.LastActivityDate: 2020-11-28T16:19:04.457Z
Answers.UserDisplayName: Demerit
Body: <p>I need to write a code to identify if a contact id is associated with an administrator role in my civiCRM extension and it needs to be platform independent.
  How can I achieve it ?</p>
  
Tags: <contacts><roles>
Title: How to identify if a contact id is associated with an administrator role?
ThreadText: # How to identify if a contact id is associated with an administrator role?
  
  (Asked by: username_0 on 2020-11-28)
  
  I need to write a code to identify if a contact id is associated with an administrator role in my civiCRM extension and it needs to be platform independent.
  How can I achieve it ?
  
  **Tags:** contacts, roles
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-11-28. Score: 2 | Accepted answer
  
  I don't think you can do this in a platform-independent way since "admin role" means different things in different CMS's. What you can do that is platform-independent is check specific CiviCRM permissions, e.g. `CRM_Core_Permission::check('administer CiviCRM', $contact_id)`
  
  You can leave out $contact\_id to check for the currently logged-in user.
  
  
  ---
  
  