added codebase, project rules and sec audit

This commit is contained in:
2026-11-08 19:03:59 -05:00
parent 4816038d49
commit bcd424f91a
1798 changed files with 801283 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
Application Programming Interface
#################################
Api Specific Information
========================
For all documentation on API Points and Schema shapes, please visit our Swagger documentation - https://swagger.nearbeach.org

View File

@@ -0,0 +1,36 @@
First Time Setup for NearBeach
##############################
.. warning::
For first time login - log into NearBeach normally, NOT through the administration portal
First Login
===========
1. Use the login page to log into NearBeach
2. The NearBeach dashboard will load - the administration permissions and groups will be applied to this user and only
this user.
Complete your profile
=====================
The code ``python3 ./manage.py createsuperuser`` does not gather all the information required to create a superuser, i.e. First and Last name. You will need to update this data yourself.
Under the "User" option in the navbar, click on the option "My Profile". This will take you to your profile. Edit your profile appropriately.
Setup User Infrastructure
=========================
.. note:: Users will need to be connected to both a Group and Permission set before being able to log in.
To setup new users in NearBeach, please follow the following process;
1. Create the required permission sets - please see :ref:`manage-permission-sets`.
2. Create the required groups - please see :ref:`manage-groups`.
3. Finally create the new users and assign them the correct permission sets and groups. Please see :ref:`manage-users`

View File

@@ -0,0 +1,29 @@
.. _manage-groups:
Managing Groups
###############
Create User Groups
==================
.. note::
Each group will require a unique name.
.. note::
Users can be in multiple groups, with different permissions to each group
.. note::
Permission sets can be stacked for users within that group. i.e. Read Only user can have extra permissions stacked on top.
1. Log into NearBeach as an administrator
2. Choose the "Administration" option in the menu and select the "Groups"
3. The "Group List" page will load
4. Click the "Create a new Group" to start creating a new permission list
Once the group has been created, you will be able to add permission sets + users. User's have to be connected to a permission set.
.. note::
At least one user in the group should be tagged as group leader.

View File

@@ -0,0 +1,37 @@
.. _manage-permission-sets:
Managing Permissions Sets
#########################
Setup of Permission Sets
========================
.. note::
Permission Sets in NearBeach give you the ability to classify how much access a particular user can have to certain objecst, i.e. Projects and Tasks. The permission sets can be stacked on top of each other.
Users can also have different permissions between each group. For example, a user might have basic user access to group_A, however only have read only access to group_B.
1. Log into NearBeach as an administrator
2. Choose the "Administration" option in the menu and select the "Permission Sets"
3. The "Permission Set List" page will load
4. Click the "Create a new Permission Set" to start creating a new permission list
.. note::
There are 4 different levels of permissions;
- 'No Permission' - the user will not have any permissions
- 'Read Only' - the user will only have read only access
- 'Edit Only' - user will be able to edit already existing objects, i.e. Projects
- 'Add and Edit' - user will be able to create objects, i.e. New Projects
- 'Full Permission' - users will be able to do the above permissions and delete objects.
.. note::
The permissions are broken up into three sections;
- 'Administration Permissions' - This contains any administration permissions. It is not recommended granting these to any basic users.
- 'Normal Permissions' - Are used to determine a user's permission to objects and different modules within said objects.
- 'Addon Permissions' - These are extra permissions designed for read only users.

View File

@@ -0,0 +1,77 @@
.. _manage-users:
Managing Users
##############
Create New Users
================
1. Log into NearBeach as an administrator
2. Choose the "Administration" option in the menu and select the "Users"
3. The "User List" page will load
4. Click the "Create a new User" to start creating a new user
Assigning Permissions and Groups to Users
=========================================
1. Log into NearBeach as an administrator
2. Choose the "Administration" option in the menu and select the "Users"
3. The "User List" page will load
4. Search for the user
5. Click on the appropriate user
6. User information page will load
7. Scroll to the "User List" section
8. Click on the "Add User" button
9. A permission modal will appear. Select the correct permission set and group. Click "Add user" to add the permission sets and groups to the user
.. note::
To annotate that the user is a team leader for that group - tick the checkbox for that group
Removing User from system
=========================
1. Log into NearBeach as an administrator
2. Choose the "Administration" option in the menu and select the "Users"
3. The "User List" page will load
4. Search for the user
5. Click on the appropriate user
6. User information page will load
7. Scroll to the "User List" section
8. Remove all groups and permissions the user has. This will effectively remove them from the system. They will not be able to log into NearBeach
9. Un-tick the "User Active" tick box and then save
NearBeach does not recommend deleting users. As a delete command will cause a cascade of deletes, and will delete any object that has been modified by the user, or created by them. This will result in data loss.
If the user will need to go through a deletion process, brought on by GDPR (General Data Protection Regulation), we are currently writing functionality to tackle this. The functionality will;
#. Rename the user - and remove any credentials, and reset user's password.
#. Profile pictures will be delete from the blob storage
#. The system will remove any object assignments to the user
#. The system will migrate any "Change User" or "Creation user" records to a user id of choice.
The user is essentially dead information at this point, without the need of a destructive delete.

View File

@@ -0,0 +1,355 @@
.. _system-variables:
System Variables
################
The following django system variables are required by NearBeach;
* SECRET_KEY
* ALLOWED_HOSTS
* CSRF_TRUSTED_URLS
* DB_DATABASE
* DB_ENGINE
* DB_HOST
* DB_PASSWORD
* DB_PORT
* DB_USER
Blob Storage
============
Azure
-----
AZURE_STORAGE_CONNECTION_STRING
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`Please refer to the Microsoft Azure documentation for setting up and obtaining the connection string.`_
Example:
* `AZURE_STORAGE_CONNECTION_STRING=defaultendpointsprotocol=https;accountname=accountname;accountkey=accountkey;endpointsuffix=core.windows.net/`
AZURE_STORAGE_CONTAINER_NAME
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The name of the Azure Blob storage
Example:
* `AZURE_STORAGE_CONTAINER_NAME=blobstorage`
S3/Minio
--------
`For setup of AWS S3 connections, please refer to the AWS IAMS documentation`_
`For setup of Minio connections, please refer to the Minio Access Control documentation`_
`For any Boto3 information, please refer to the Boto3 documentation`_
AWS_ACCESS_KEY_ID
^^^^^^^^^^^^^^^^^
This references the Access Key Id
Example:
* `AWS_ACCESS_KEY_ID=hfOlT4DrY9VkyiMLCKn9`
AWS_SECRET_ACCESS_KEY
^^^^^^^^^^^^^^^^^^^^^
This references the Secret Access Key
Example:
* `AWS_SECRET_ACCESS_KEY=sET3GI24o3sn3mFiFbIMUGyz9CrgdqIOot011THy`
AWS_STORAGE_BUCKET_NAME
^^^^^^^^^^^^^^^^^^^^^^^
This references the S3 Bucket name
Example:
* `AWS_STORAGE_BUCKET_NAME=NearBeachBucket`
AWS_S3_ENDPOINT_URL
^^^^^^^^^^^^^^^^^^^
This references the S3 Endpoint url
Example:
* `AWS_S3_ENDPOINT_URL=http://localhost:9000`
* `AWS_S3_ENDPOINT_URL=https://s3.bucket.nearbeach.cloudstorage.com`
Database
========
DB_DATABASE
-----------
`More information on Django Databases can be found on their documentation.`_ This represent the name of the database.
No default is set, user will need to set.
Example:
* `DB_DATABASE=nearbeach_db`
DB_ENGINE
---------
`More information on Django Databases can be found on their documentation.`_ This represent the database engine.
No default is set, user wil need to set.
Example:
* `DB_ENGINE=postgresql` <- Connects to a Postgres Database
* `DB_ENGINE=mysql` <- Connects to either a MySQL or MariaDb database
* `DB_ENGINE=` <- Connects to a Postgres Database
* `DB_ENGINE=oracle` <- Connects to an Oracle Database
DB_HOST
-------
`More information on Django Databases can be found on their documentation.`_ This represents the location of the database.
No default is set, user wil need to set.
Example:
* `DB_HOST=127.0.0.1` <- Connects to a database at localhost
* `DB_HOST=nearbeach-db.cloudservices.hosting` <- Connects to a database at nearbeach-db.cloudservices.hosting
DB_PASSWORD
-----------
`More information on Django Databases can be found on their documentation.`_ This is the password for the database.
No default is set, user wil need to set.
Example:
* `DB_PASSWORD=mysecretpassword`
DB_PORT
-------
`More information on Django Databases can be found on their documentation.`_ This represent the port for the database.
No default is set, user wil need to set.
Example:
* `DB_PORT=3306`
* `DB_PORT=5432`
DB_USER
-------
`More information on Django Databases can be found on their documentation.`_ This is the username for the database.
No default is set, user wil need to set.
Example:
* `DB_USER=nearbeach_db_user`
Django System Variables
=======================
SECRET_KEY
----------
`More information can be located on the Django Documentation.`_ We recommend setting up this variable using the `following information from this Humberto's blog`_
ALLOWED_HOSTS
-------------
`More information can be located on the Django Documentation.`_
Allowed Hosts should reference which URLs will be connected to the NearBeach system. If there are multiple URLs, each
url can be separated by a commar. Do not include the http or port number
Default will allow ALL hosts - we do not recomment
Example:
* `- ALLOWED_HOST=demo.nearbeach.org`
* `- ALLOWED_HOST=demo.nearbeach.org,test.nearbeach.org`
* `- ALLOWED_HOST=localhost,127.0.0.1`
CSRF_TRUSTED_URLS
-----------------
`More information can be located on the Django Documentation.`_
Csrf trusted urls should reference the exact urls form submissions will be coming from. If there are multiple URLs, each
url can be separated by a commar. Please include the http/https and, if required, port number.
Default will allow ALL hosts - we do not recommend.
Example:
* `CSRF_TRUSTED_URLS=https://demo.nearbeach.org`
* `CSRF_TRUSTED_URLS=https://demo.nearbeach.org,https://test.nearbeach.org:8080`
* `CSRF_TRUSTED_URLS=http://localhost:8000,http://127.0.0.1:8000`
DEBUG
-----
Default will be false. Only use this on production to debug an issue.
DOCUMENTATION_CLEAN_UP
----------------------
Used to notify the system to run periodic checks to clean up the Blob storage from any documenation that does not current
have a link to any object within NearBeach. It is designed so that old documentation that has been removed, is cleaned
from the BLOB storage.
Default will be false.
Example:
* `DOCUMENTATION_CLEAN_UP=True`
* `DOCUMENTATION_CLEAN_UP=False`
DOCUMENTATION_CLEAN_AFTER_DAYS
------------------------------
Used to notify the system the PERIOD on which to run the document clean up process.
Default will be 90 days
Example:
* `DOCUMENTATION_CLEAN_AFTER_DAYS=120` <- cleaned up every 120 days
* `DOCUMENTATION_CLEAN_AFTER_DAYS=365` <- cleaned up once a year
* `DOCUMENTATION_CLEAN_AFTER_DAYS=7` <- cleaned up each week
MAX_FILE_SIZE_UPLOAD
--------------------
The maximum size for a file to be uploaded in bytes.
Default will be 104857600 bytes (104mb)
Example:
* `MAX_FILE_SIZE_UPLOAD=1048` <- 1kb
* `MAX_FILE_SIZE_UPLOAD=1048000` <- 1mb
* `MAX_FILE_SIZE_UPLOAD=1048000000` <- 1Gb
+----------------------+-----------------+---------------+
| Human Readable Value | MAX_FILE_UPLOAD | Notes |
+======================+=================+===============+
| 100MB | 104857600 | Default Value |
+----------------------+-----------------+---------------+
| 10MB | 10485760 | |
+----------------------+-----------------+---------------+
| 1GB | 1048576000 | |
+----------------------+-----------------+---------------+
SESSION_COOKIE_AGE
------------------
`More information can be located on the Django Documentation.`_
Used to define how long a session cookie will last.
Default: 1209600 seconds (2 weeks)
Example:
* `SESSION_COOKIE_AGE=1209600` <- 2 weeks
* `SESSION_COOKIE_AGE=3360` <- 24 hours
+----------------------+-----------------+-------------------+
| Human Readable Value | MAX_FILE_UPLOAD | Notes |
+======================+=================+===================+
| 2 weeks | 1209600 | Default Value |
+----------------------+-----------------+-------------------+
| 1 hour | 3600 | Recommended Value |
+----------------------+-----------------+-------------------+
| 30 min | 1800 | |
+----------------------+-----------------+-------------------+
SESSION_SAVE_EVERY_REQUEST
--------------------------
`More information can be located on the Django Documentation.`_
Default will be false.
Example:
* `DOCUMENTATION_CLEAN_UP=True`
* `DOCUMENTATION_CLEAN_UP=False`
Email/SMTP
==========
`More information on Django SMTP can be found on their documentation`_
SMTP_EMAIL_HOST
---------------
The SMTP host
Example:
* `SMTP_EMAIL_HOST=email-smtp.us-east-2.amazonaws.com`
* `SMTP_EMAIL_HOST=smtp.gmail.com`
SMTP_EMAIL_PORT
---------------
SMTP Email Port
Example:
* `SMTP_EMAIL_PORT=465`
SMTP_EMAIL_HOST_USER
--------------------
SMTP Email host user
Example:
* `SMTP_EMAIL_USER=smtpuser`
SMTP_EMAIL_HOST_PASSWORD
------------------------
SMTP Email Host password
Example:
* `SMTP_EMAIL_PASSWORD=secretPassword`
.. _More Information can be located on the Django Documentation.: https://docs.djangoproject.com/en/dev/ref/settings/
.. _following information from this Humberto's blog: https://humberto.io/blog/tldr-generate-django-secret-key/
.. _More information on Django Databases can be found on their documentation.: https://docs.djangoproject.com/en/dev/ref/databases/
.. _Please refer to the Microsoft Azure documentation for setting up and obtaining the connection string.: https://learn.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal
.. _For setup of AWS S3 connections, please refer to the AWS IAMS documentation: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html#id_users_create_console
.. _For setup of Minio connections, please refer to the Minio Access Control documentation: https://docs.min.io/enterprise/aistor-object-store/administration/iam/access/
.. _For any Boto3 information, please refer to the Boto3 documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html#configuration
.. _More information on Django SMTP can be found on their documentation: https://docs.djangoproject.com/en/5.2/ref/settings/