Bienvenue, Invité
Nom d'utilisateur : Mot de passe :
Whilst small files can be uploaded to forum posts, if you have a custom theme or module to contribute please add it on the "Add-ons" page.
  • Page :
  • 1

SUJET :

Why getAnniversaryEvents is empty for anonymous? il y a 4 ans 2 mois #1

  • UksusoFF
  • Portrait de UksusoFF Auteur du sujet
  • Hors Ligne
  • Membre junior
  • Membre junior
  • Messages : 187
Is there way to get anniversary events in module action if user not logged in?

Connexion ou Créer un compte pour participer à la conversation.

Dernière édition: par UksusoFF.

Why FunctionsDb::getAnniversaryEvents is empty for il y a 4 ans 2 mois #2

  • fisharebest
  • Portrait de fisharebest
  • Hors Ligne
  • Administrateur
  • Administrateur
  • Messages : 14715
This function will return all data that you are allowed to see.

If this data is private, and you are not logged in, then you cannot see it.
Greg Roach - Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser. - fisharebest.webtrees.net

Connexion ou Créer un compte pour participer à la conversation.

Why FunctionsDb::getAnniversaryEvents is empty for il y a 4 ans 2 mois #3

  • UksusoFF
  • Portrait de UksusoFF Auteur du sujet
  • Hors Ligne
  • Membre junior
  • Membre junior
  • Messages : 187
Is there way to get this data for anonymous user? Without copy db query to own module?

And i can't find where access check in this function. Can you tell me string number where this done?

Connexion ou Créer un compte pour participer à la conversation.

Dernière édition: par UksusoFF.

Why FunctionsDb::getAnniversaryEvents is empty for il y a 4 ans 2 mois #4

  • ToyGuy
  • Portrait de ToyGuy
  • Hors Ligne
  • Modérateur
  • Modérateur
  • Live like it's Christmas every day - Santa Stephen
  • Messages : 4926
Assuming there was anonymous access, it would only return the already public information on the site. If set as default,webtrees would show anniversary dates for deceased persons only and while, on occasion that might be nice, it doesn't help with providing living persons' birthdays or anniversaries, and, without exposing critical private data, never could do more.
Santa Stephen the Fabled Santa
Latest webtrees at MyArnolds.com
Hosted by webtreesonline.com , a division of GeneHosts LLC
MacOS 10.6.8, Apache 2.2+, PHP 5.4.16, MySQL 5.5.28

Connexion ou Créer un compte pour participer à la conversation.

Why FunctionsDb::getAnniversaryEvents is empty for il y a 4 ans 2 mois #5

  • fisharebest
  • Portrait de fisharebest
  • Hors Ligne
  • Administrateur
  • Administrateur
  • Messages : 14715
> Is there way to get this data for anonymous user?

The privacy functions are handled at a very low level. In the "Individual" and "Fact" objects.

If you want to write code that bypasses the privacy, you will need to create a fake session/user.
Perhaps create a dummy user object, and pass it to Auth::login()
Greg Roach - Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser. - fisharebest.webtrees.net

Connexion ou Créer un compte pour participer à la conversation.

Why FunctionsDb::getAnniversaryEvents is empty for il y a 4 ans 2 mois #6

  • UksusoFF
  • Portrait de UksusoFF Auteur du sujet
  • Hors Ligne
  • Membre junior
  • Membre junior
  • Messages : 187

Assuming there was anonymous access, it would only return the already public information on the site. If set as default,webtrees would show anniversary dates for deceased persons only and while, on occasion that might be nice, it doesn't help with providing living persons' birthdays or anniversaries, and, without exposing critical private data, never could do more.

> Is there way to get this data for anonymous user?

The privacy functions are handled at a very low level. In the "Individual" and "Fact" objects.

If you want to write code that bypasses the privacy, you will need to create a fake session/user.
Perhaps create a dummy user object, and pass it to Auth::login()


Thanks. I will try this.

But can you explain why in autocomplete have additional check for this. Why not returns only values which can be viewed?

For eg: github.com/fisharebest/webtrees/blob/mas...autocomplete.php#L56

Connexion ou Créer un compte pour participer à la conversation.

Dernière édition: par UksusoFF.

Why FunctionsDb::getAnniversaryEvents is empty for il y a 4 ans 2 mois #7

  • bertkoor
  • Portrait de bertkoor
  • Hors Ligne
  • Membre platinium
  • Membre platinium
  • Greetings from Utrecht, Holland
  • Messages : 2360

Why not returns only values which can be viewed?

For eg: github.com/fisharebest/webtrees/blob/mas...autocomplete.php#L56


I guess because $something->canShow() is rather hard to implement directly as a SQL query, but very easy to implement as a function on the PHP object. If this was implemented as a SQL query, the queries would get extremely complicated and harder to optimise.

Whether an object can be shown depends on a lot of factors, so better hide that away in the object itself. Also when the implementation needs to be changed, it can be done at one place only, and not in the hundreds or thousands SQL queries present in the application.
stamboom.BertKoor.nl runs on webtrees v1.7.13

Connexion ou Créer un compte pour participer à la conversation.

Dernière édition: par bertkoor.

Why FunctionsDb::getAnniversaryEvents is empty for il y a 4 ans 2 mois #8

  • fisharebest
  • Portrait de fisharebest
  • Hors Ligne
  • Administrateur
  • Administrateur
  • Messages : 14715
We use SQL to find the records (very fast).
We then use PHP to apply the privacy rules (slower).

I looked again at the code.

The function Individual::getFacts() has a parameter "override" which ignores the privacy. We use this to set a different privacy level when downloading GEDCOM files. You might be able to use this?
Greg Roach - Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser. - fisharebest.webtrees.net

Connexion ou Créer un compte pour participer à la conversation.

Avez-vous besoin d'une solution d'hébergement web pour votre site webtrees ?
Si vous préférez un hébergeur spécialisé de webtrees, la page suivante en liste quelques-uns capables de vous offrir ce type de service :

Why FunctionsDb::getAnniversaryEvents is empty for il y a 4 ans 2 mois #9

  • UksusoFF
  • Portrait de UksusoFF Auteur du sujet
  • Hors Ligne
  • Membre junior
  • Membre junior
  • Messages : 187

I guess because $something->canShow() is rather hard to implement directly as a SQL query, but very easy to implement as a function on the PHP object. If this was implemented as a SQL query, the queries would get extremely complicated and harder to optimise.

Whether an object can be shown depends on a lot of factors, so better hide that away in the object itself. Also when the implementation needs to be changed, it can be done at one place only, and not in the hundreds or thousands SQL queries present in the application.

Yep, I understand this.

We use SQL to find the records (very fast).
We then use PHP to apply the privacy rules (slower).

I looked again at the code.

The function Individual::getFacts() has a parameter "override" which ignores the privacy. We use this to set a different privacy level when downloading GEDCOM files. You might be able to use this?

As I can see Individual::getFacts() can't accept julian day or something other way to filter by day.

Looks like Auth::login() works fine. But I think that have performance issues on large databases with many users and my implementation.

Connexion ou Créer un compte pour participer à la conversation.

Why FunctionsDb::getAnniversaryEvents is empty for il y a 4 ans 1 mois #10

  • UksusoFF
  • Portrait de UksusoFF Auteur du sujet
  • Hors Ligne
  • Membre junior
  • Membre junior
  • Messages : 187

Looks like Auth::login() works fine. But I think that have performance issues on large databases with many users and my implementation.

Ouch, it's work only with public trees.

Why this:
$user = User::findByIdentifier('admin@email.com');
Auth::login($user);
Tree::getAll()
Auth::logout();
return only public trees?

Connexion ou Créer un compte pour participer à la conversation.

Why FunctionsDb::getAnniversaryEvents is empty for il y a 1 an 6 mois #11

  • UksusoFF
  • Portrait de UksusoFF Auteur du sujet
  • Hors Ligne
  • Membre junior
  • Membre junior
  • Messages : 187
Seems it's works as expected in 2.0

Connexion ou Créer un compte pour participer à la conversation.

[SOLVED] Why getAnniversaryEvents is empty for anonymous? il y a 1 an 6 mois #12

  • UksusoFF
  • Portrait de UksusoFF Auteur du sujet
  • Hors Ligne
  • Membre junior
  • Membre junior
  • Messages : 187
Problem solved.

Connexion ou Créer un compte pour participer à la conversation.

  • Page :
  • 1
Propulsé par Kunena