Admin CRUD "sub-site" for the Yesod web framework.
CRUD means Create, Read, Update, Delete. This module provides access to the site's database for an admin user.
Instructions of how to add the sub-site to Yesod's scaffolded website:
/admin AdminR Admin getAdmin
Create separate module for "foundation type".
The site's foundation type needs to be moved out of
Foundation.hs as it will be needed by
Not moving the type to separate module will cause an import cycle.
Create the YesodAdmin instance
share [mkPersist sqlSettings, mkMigrate "migrateAll"] $(persistFile "config/models")
share [mkPersist sqlSettings, mkMigrate "migrateAll", mkYesodAdmin ''SoundRadix] $(persistFile "config/models")
, mkYesodAdmin ''SoundRadix)
Create YesodAdminUser instance
instance YesodAdminUser SoundRadix where isAdminUser = return True
- You will probably want to change the code of
isAdminUserto determine whether the logged-in user is an administrator user or not.
YesodAdminUseris exported by
The changes describe above require several imports and language extensions. These should be simple to solve.
- Make it look nicer.
- Selecting which part of the table to see if it has many rows.