Skip to content

6. Settings & Management

Faisal Ramdan edited this page May 28, 2021 · 1 revision

Admin Account Setting

You can set a user to admin by updating user document of Firestore directly. Admin property is protected by Firestore security rules and cannot be edited by client app.

  • Do User Email And Password Registration and register with a user as [email protected].

    • You may add a user manually by entering email and password under Users in Firebase Authentication. But we recommend you to create a user account through the app after coding registration page.
  • Open Firebase => Authentication => Users

  • Open Firebase => Firestore

    • Set {isAdmin: true} on user document which is at /users/{uid}. Follow the steps below to edit the document.
      • You will see users collection under data tab. Click users
      • Search the User UID of [email protected]
        • And click the User UID.
      • Click + Add field.
      • Input isAdmin in Field.
      • Select boolean in Type.
      • Select true as Value.
      • Click Add
    • If ever, user document does not exist, you can create it.
      • If a user is created by firebase console, or if a user registers in admin site, the user document may not exists.
  • Now the user is an admin.

App Management

  • The app management here is based on the sample code and app.
  • GetxFire is a flutter package to build social apps and is fully customizable. When you may build your own customized app, we recommend to use our sample codes.

App Settings

  • Developers can set default settings on GetxFire.init().
  • Admin can overwrite all the settings by .updating Firestore settings docuemnts.

Internalization (Localization)

  • Menus and page contents can be translated depending on user's device. Or developer can put a menu to let users to choose their languages.

  • When admin update the translation text in Firestore translations collectin, the will get the update in real time. The app, should update the screen.

  • The localization is managed by GetX package that is used for routing and state management on the sample code.

Forum Management

Forum Category Management

Forum category is a list(or a collection) of posts to differentiate from each kind. Category ID is a word(or words with dash separated) like reminder, qna, discussion, public-photos or whatever you want.

  • Post can be created only under an existing category.

  • You can create forum categories editing categories collection in Firestore

    • Or if there is an admin screen, admin may do so in admin screen.
  • Category can have any number of extra fields and data but id is a mandatory. And title, description are reserved field name that should hold title and description respectively.

To create a creategory,

  • Open Cloud Firestore
  • Create the categories collection if it is not present( by clicking + Start collection)
  • Then click add a document.
    • Put category(for instance, qna) id in Document ID and this should not be changed after.
    • And put id in Field column and the same category(for instance, qna) id in Value column.
    • You may optionally add more Field with title and description.