/**
  * Registers permissions available for setting for this module
  * @param int $module_id
  * @param array $perms
  * @return array
  */
 public static function register_perms($module_id, $perms)
 {
     $mod = new Modules($module_id);
     if ($mod->id == null || $mod->id == '') {
         throw new Exception('Module does not exist');
     }
     $perm_ids = array();
     foreach ($perms as $p) {
         $perm = new Perms();
         $perm->permission = $p;
         $perm->module = $module_id;
         $perm_ids[] = $perm->create();
     }
     return $perm_ids;
 }