We have moved to Github. Please open tickets there.

Opened 18 months ago

Closed 17 months ago

Last modified 11 months ago

#4168 closed Defect (fixed)

Admin notices are not correctly created if a user is not logged into the site

Reported by: richardloxley Owned by:
Priority: normal Milestone: Elgg 1.8.3
Component: Core Version: 1.8.1
Severity: minor Keywords: admin notice
Cc: brett@… Difficulty:

Description (last modified by cash)

To reproduce this:

  • Log out of the site
  • Remove one of the plugin directories
  • Visit the Elgg login page

Now when you log into the site as an admin, and visit the admin page, there will be an empty box where the admin notices should be. The actual notice (plugin cannot be enabled) is not displayed.

Debugging shows that elgg_load_plugins() correctly constructs an error message and passes it to elgg_add_admin_notice().

In elgg_add_admin_notice(), an ElggObject is created, with metadata for the ID and a description for the error message.

Looking in the database, the object is created in the table elgg_entities, the ID is created as metadata in table elgg_metadata, but there is no entry in table elgg_objects_entity which should contain the description.

I suspect that perhaps the creation of the row in elgg_objects_entity is failing because there is no logged in user - however I have not been able to narrow this down. There may be another reason.

Change History (7)

comment:1 Changed 18 months ago by cash

I can confirm this. The function elgg_add_admin_notice() assumes an admin is logged in when an admin notice is created.

We probably want to break that restriction. The admin notice could be owned by the site or no one. It also needs a permissions override to so that the object can be saved when no one is logged in (or actually, why can't we create an entity when no one is logged in if it is not owned by anyone?).

comment:2 Changed 17 months ago by cash

  • Milestone changed from Needs Review to Elgg 1.8.3

comment:3 Changed 17 months ago by Cash Costello

  • Resolution set to fixed
  • Status changed from new to closed

Fixes #4168 ignoring access when saving an admin notice

Changeset: 96e403d69956434aadd588fcfb08fb6f0a329d9c

comment:4 Changed 16 months ago by Cash Costello

Fixes #4168 ignoring access when saving an admin notice

Changeset: 96e403d69956434aadd588fcfb08fb6f0a329d9c

comment:5 Changed 11 months ago by Cash Costello

Fixes #4168 returning default value from elgg_extract if non-array passed - not removing type hint since we downgraded it from an error to a warning

Changeset: 8fd511bcd35646c64658f63cfd35f4b0fb3541a8

comment:6 Changed 11 months ago by cash

  • Description modified (diff)

Oops - ignore that last commit - for another ticket

comment:7 Changed 11 months ago by Cash Costello

Fixes #4168 returning default value from elgg_extract if non-array passed - not removing type hint since we downgraded it from an error to a warning

Changeset: 8fd511bcd35646c64658f63cfd35f4b0fb3541a8

Note: See TracTickets for help on using tickets.