Skip to content

Commit

Permalink
Merge branch 'develop' into FWF-3440-Design-System-OS
Browse files Browse the repository at this point in the history
# Conflicts:
#	forms-flow-web/src/components/Form/List.js
#	forms-flow-web/src/components/Form/constants/FormTable.js
  • Loading branch information
arun-s-aot committed Aug 2, 2024
2 parents 767c491 + bd07536 commit f627c47
Show file tree
Hide file tree
Showing 116 changed files with 3,186 additions and 1,878 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v6.1.0-alpha
v7.0.0-alpha
10 changes: 5 additions & 5 deletions deployment/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:

forms-flow-forms:
container_name: forms-flow-forms
image: formsflow/forms-flow-forms:v6.1.0-alpha
image: formsflow/forms-flow-forms:v7.0.0-alpha

# The app will restart until Mongo is listening
restart: always
Expand Down Expand Up @@ -137,10 +137,10 @@ services:
context: ./../../forms-flow-web-root-config/
dockerfile: Dockerfile
args:
- MF_FORMSFLOW_WEB_URL=${MF_FORMSFLOW_WEB_URL:-https://forms-flow-microfrontends.aot-technologies.com/forms-flow-web@v6.1.0-alpha/forms-flow-web.gz.js}
- MF_FORMSFLOW_NAV_URL=${MF_FORMSFLOW_NAV_URL:-https://forms-flow-microfrontends.aot-technologies.com/forms-flow-nav@v6.1.0-alpha/forms-flow-nav.gz.js}
- MF_FORMSFLOW_SERVICE_URL=${MF_FORMSFLOW_SERVICE_URL:-https://forms-flow-microfrontends.aot-technologies.com/forms-flow-service@v6.1.0-alpha/forms-flow-service.gz.js}
- MF_FORMSFLOW_ADMIN_URL=${MF_FORMSFLOW_ADMIN_URL:-https://forms-flow-microfrontends.aot-technologies.com/forms-flow-admin@v6.1.0-alpha/forms-flow-admin.gz.js}
- MF_FORMSFLOW_WEB_URL=${MF_FORMSFLOW_WEB_URL:-https://forms-flow-microfrontends.aot-technologies.com/forms-flow-web@v7.0.0-alpha/forms-flow-web.gz.js}
- MF_FORMSFLOW_NAV_URL=${MF_FORMSFLOW_NAV_URL:-https://forms-flow-microfrontends.aot-technologies.com/forms-flow-nav@v7.0.0-alpha/forms-flow-nav.gz.js}
- MF_FORMSFLOW_SERVICE_URL=${MF_FORMSFLOW_SERVICE_URL:-https://forms-flow-microfrontends.aot-technologies.com/forms-flow-service@v7.0.0-alpha/forms-flow-service.gz.js}
- MF_FORMSFLOW_ADMIN_URL=${MF_FORMSFLOW_ADMIN_URL:-https://forms-flow-microfrontends.aot-technologies.com/forms-flow-admin@v7.0.0-alpha/forms-flow-admin.gz.js}
- NODE_ENV=${NODE_ENV:-production}
entrypoint: /bin/sh -c "/usr/share/nginx/html/config/env.sh && nginx -g 'daemon off;'"
environment:
Expand Down
8 changes: 4 additions & 4 deletions deployment/docker/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ CUSTOM_SUBMISSION_URL=http://{your-ip-address}:{port}
#The MF Variables below are used to get MicroFrontend Components Created

##For running locally or if have custom changes then change the url to the one forms-flow-web folder content is running
#MF_FORMSFLOW_WEB_URL=https://forms-flow-microfrontends.aot-technologies.com/forms-flow-web@v6.1.0-alpha/forms-flow-web.gz.js
#MF_FORMSFLOW_WEB_URL=https://forms-flow-microfrontends.aot-technologies.com/forms-flow-web@v7.0.0-alpha/forms-flow-web.gz.js

## Refer Github Repo https://github.com/AOT-Technologies/forms-flow-ai-micro-front-ends and update to your own custom implementation for the Components here
#MF_FORMSFLOW_NAV_URL=https://forms-flow-microfrontends.aot-technologies.com/forms-flow-nav@v6.1.0-alpha/forms-flow-nav.gz.js
#MF_FORMSFLOW_SERVICE_URL=https://forms-flow-microfrontends.aot-technologies.com/forms-flow-service@v6.1.0-alpha/forms-flow-service.gz.js
#MF_FORMSFLOW_ADMIN_URL=https://forms-flow-microfrontends.aot-technologies.com/forms-flow-admin@v6.1.0-alpha/forms-flow-admin.gz.js
#MF_FORMSFLOW_NAV_URL=https://forms-flow-microfrontends.aot-technologies.com/forms-flow-nav@v7.0.0-alpha/forms-flow-nav.gz.js
#MF_FORMSFLOW_SERVICE_URL=https://forms-flow-microfrontends.aot-technologies.com/forms-flow-service@v7.0.0-alpha/forms-flow-service.gz.js
#MF_FORMSFLOW_ADMIN_URL=https://forms-flow-microfrontends.aot-technologies.com/forms-flow-admin@v7.0.0-alpha/forms-flow-admin.gz.js

#++++++++++++++++--- formsflow.ai Web Microfrontend components ENV Variables - STOP ---+++++++++++++++++++++++++#

Expand Down
2 changes: 1 addition & 1 deletion forms-flow-api-utils/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def read_requirements(filename):

setuptools.setup(
name='formsflow_api_utils',
version='6.1.0',
version='7.0.0',
author='AOT Technologies',
description='Formsflow api related libraries.',
long_description=read("README.md"),
Expand Down
19 changes: 18 additions & 1 deletion forms-flow-api-utils/src/formsflow_api_utils/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,26 @@
NEW_APPLICATION_STATUS,
REVIEWER_GROUP,
HTTP_TIMEOUT,
PERMISSIONS
)
from .enums import ApplicationSortingParameters
from .permisions import (
PERMISSION_DETAILS ,
CREATE_DESIGNS,
VIEW_DESIGNS,
CREATE_SUBMISSIONS,
VIEW_SUBMISSIONS,
VIEW_DASHBOARDS,
VIEW_TASKS,
MANAGE_TASKS,
MANAGE_ALL_FILTERS,
CREATE_FILTERS,
VIEW_FILTERS,
MANAGE_INTEGRATIONS,
MANAGE_DASHBOARD_AUTHORIZATIONS,
MANAGE_USERS,
MANAGE_ROLES,
ADMIN,
)
from .file_log_handler import CustomTimedRotatingFileHandler, register_log_handlers
from .format import CustomFormatter
from .logging import setup_logging, log_bpm_error
Expand Down
7 changes: 6 additions & 1 deletion forms-flow-api-utils/src/formsflow_api_utils/utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ def wrapper(*args, **kwargs):
def has_role(cls, role):
"""Method to validate the role."""
return jwt.validate_roles(role)

@classmethod
def has_any_role(cls, role):
"""Method to validate the role."""
return jwt.contains_role(role)

@classmethod
def require_custom(cls, f):
Expand All @@ -80,4 +85,4 @@ def decorated(*args, **kwargs):

auth = (
Auth()
) # pylint: disable=invalid-name; lower case name as used by convention in most Flask apps
) # pylint: disable=invalid-name; lower case name as used by convention in most Flask apps
73 changes: 1 addition & 72 deletions forms-flow-api-utils/src/formsflow_api_utils/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,75 +46,4 @@

DEFAULT_PROCESS_KEY = "Defaultflow"
DEFAULT_PROCESS_NAME = "Default Flow"
HTTP_TIMEOUT = 30

PERMISSIONS = [{
"name": "create_designs",
"description": "Create Form, workflow designs",
"depends_on": ["view_designs"]
},
{
"name": "view_designs",
"description": "Access to design",
"depends_on": []
},
{
"name": "create_submissions",
"description": "Create submissions",
"depends_on": []
},
{
"name": "view_submissions",
"description": "Access to submissions",
"depends_on": []
},
{
"name": "view_dashboards",
"description": "Access to dashboards",
"depends_on": []
},
{
"name": "view_tasks",
"description": "Access to tasks",
"depends_on": []
},
{
"name": "manage_tasks",
"description": "Can claim and work on tasks",
"depends_on": ["view_tasks"]
},{
"name": "manage_all_filters",
"description": "Manage all filters",
"depends_on": ["view_filters","create_filters"]
},
{
"name": "create_filters",
"description": "Access to create filters",
"depends_on": ["view_filters"]
},
{
"name": "view_filters",
"description": "Access to view filters",
"depends_on": []
},
{
"name": "manage_integrations",
"description": "Access to Integrations",
"depends_on": []
},
{
"name": "manage_dashboard_authorizations",
"description": "Manage Dashboard Authorization",
"depends_on": ["view_dashboards"]
},
{
"name": "manage_users",
"description": "Manage Users",
"depends_on": []
},
{
"name": "manage_roles",
"description": "Manage Roles",
"depends_on": ["manage_users"]
}
]
HTTP_TIMEOUT = 30
46 changes: 46 additions & 0 deletions forms-flow-api-utils/src/formsflow_api_utils/utils/permisions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""Permission definitions."""

CREATE_DESIGNS = "create_designs"
VIEW_DESIGNS = "view_designs"
CREATE_SUBMISSIONS = "create_submissions"
VIEW_SUBMISSIONS = "view_submissions"
VIEW_DASHBOARDS = "view_dashboards"
VIEW_TASKS = "view_tasks"
MANAGE_TASKS = "manage_tasks"
MANAGE_ALL_FILTERS = "manage_all_filters"
CREATE_FILTERS = "create_filters"
VIEW_FILTERS = "view_filters"
MANAGE_INTEGRATIONS = "manage_integrations"
MANAGE_DASHBOARD_AUTHORIZATIONS = "manage_dashboard_authorizations"
MANAGE_USERS = "manage_users"
MANAGE_ROLES = "manage_roles"
ADMIN= "admin"

PERMISSION_DETAILS = [
{"name": CREATE_DESIGNS , "description": "Create Form, workflow designs", "depends_on": [ VIEW_DESIGNS ]},
{"name": VIEW_DESIGNS , "description": "Access to design", "depends_on": []},
{"name": CREATE_SUBMISSIONS , "description": "Create submissions", "depends_on": []},
{"name": VIEW_SUBMISSIONS , "description": "Access to submissions", "depends_on": []},
{"name": VIEW_DASHBOARDS , "description": "Access to dashboards", "depends_on": []},
{"name": VIEW_TASKS , "description": "Access to tasks", "depends_on": []},
{"name": MANAGE_TASKS , "description": "Can claim and work on tasks", "depends_on": [ VIEW_TASKS ]},
{"name": MANAGE_ALL_FILTERS , "description": "Manage all filters", "depends_on": [ VIEW_FILTERS , CREATE_FILTERS ]},
{"name": CREATE_FILTERS , "description": "Access to create filters", "depends_on": [ VIEW_FILTERS ]},
{"name": VIEW_FILTERS , "description": "Access to view filters", "depends_on": []},
{"name": MANAGE_INTEGRATIONS , "description": "Access to Integrations", "depends_on": []},
{"name": MANAGE_DASHBOARD_AUTHORIZATIONS , "description": "Manage Dashboard Authorization", "depends_on": [ VIEW_DASHBOARDS ]},
{"name": MANAGE_USERS , "description": "Manage Users", "depends_on": []},
{"name": MANAGE_ROLES , "description": "Manage Roles", "depends_on": [ MANAGE_USERS ]},
{"name": ADMIN , "description": "Administrator Role", "depends_on": [ MANAGE_ROLES , MANAGE_USERS ]},
]


def build_permission_dict():
"""
Builds a dictionary of permissions where the key is the permission name and
the value is the permission detail.
Returns:
dict: A dictionary of permission details.
"""
return {permission["name"]: permission for permission in PERMISSION_DETAILS}
9 changes: 0 additions & 9 deletions forms-flow-api-utils/src/formsflow_api_utils/utils/roles.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ def email(self) -> str:
def roles(self) -> List[str]:
"""Return the roles."""
return self._roles

@property
def groups(self) -> List[str]:
"""Return the roles."""
return self._groups

@property
def group_or_roles(self) -> List[str]:
Expand Down
18 changes: 11 additions & 7 deletions forms-flow-api-utils/src/formsflow_api_utils/utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

from .constants import (
ALLOW_ALL_ORIGINS,
CLIENT_GROUP,
DESIGNER_GROUP,
REVIEWER_GROUP,
)
from .enums import (
ApplicationSortingParameters,
Expand All @@ -23,7 +20,14 @@
ProcessSortingParameters,
)
from .translations.translations import translations

from .permisions import (
CREATE_DESIGNS,
VIEW_DESIGNS,
MANAGE_TASKS,
VIEW_TASKS,
CREATE_SUBMISSIONS,
VIEW_SUBMISSIONS,
)

def cors_preflight(methods: str = "GET"):
"""Render an option method on the class."""
Expand Down Expand Up @@ -108,11 +112,11 @@ def get_role_ids_from_user_groups(role_ids, user_role):
if role_ids is None or user_role is None:
return None

if DESIGNER_GROUP in user_role:
if any(permission in user_role for permission in [ CREATE_DESIGNS, VIEW_DESIGNS]):
return role_ids
if REVIEWER_GROUP in user_role:
if any(permission in user_role for permission in [ MANAGE_TASKS, VIEW_TASKS]):
return filter_list_by_user_role(FormioRoles.REVIEWER.name, role_ids)
if CLIENT_GROUP in user_role:
if any(permission in user_role for permission in [ CREATE_SUBMISSIONS, VIEW_SUBMISSIONS]):
return filter_list_by_user_role(FormioRoles.CLIENT.name, role_ids)
return None

Expand Down
2 changes: 1 addition & 1 deletion forms-flow-api/requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ sqlalchemy_utils
markupsafe
PyJWT
redis
git+https://github.com/AOT-Technologies/forms-flow-ai.git@develop#egg=formsflow_api_utils&subdirectory=forms-flow-api-utils
git+https://github.com/AOT-Technologies/forms-flow-ai.git@develop#subdirectory=forms-flow-api-utils
2 changes: 1 addition & 1 deletion forms-flow-api/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = formsflow_api
version = 6.1.0
version = 7.0.0
author = aot-technologies
classifiers =
Development Status :: Production
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-api/src/formsflow_api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def create_app(
when=os.getenv("API_LOG_ROTATION_WHEN", "d"),
interval=int(os.getenv("API_LOG_ROTATION_INTERVAL", "1")),
backupCount=int(os.getenv("API_LOG_BACKUP_COUNT", "7")),
configure_log_file=app.config["CONFIGURE_LOGS"]
configure_log_file=app.config["CONFIGURE_LOGS"],
)

app.logger.propagate = False
Expand Down
4 changes: 3 additions & 1 deletion forms-flow-api/src/formsflow_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ class _Config: # pylint: disable=too-few-public-methods
# Keycloak Admin Service
KEYCLOAK_URL = os.getenv("KEYCLOAK_URL")
KEYCLOAK_URL_REALM = os.getenv("KEYCLOAK_URL_REALM")
KEYCLOAK_URL_HTTP_RELATIVE_PATH = os.getenv("KEYCLOAK_URL_HTTP_RELATIVE_PATH", "/auth")
KEYCLOAK_URL_HTTP_RELATIVE_PATH = os.getenv(
"KEYCLOAK_URL_HTTP_RELATIVE_PATH", "/auth"
)

# Web url
WEB_BASE_URL = os.getenv("WEB_BASE_URL")
Expand Down
5 changes: 5 additions & 0 deletions forms-flow-api/src/formsflow_api/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class BusinessErrorCode(ErrorCodeMixin, Enum):
HTTPStatus.BAD_REQUEST,
)
PROCESS_DEF_NOT_FOUND = "Process definition does not exist", HTTPStatus.BAD_REQUEST
DECISION_DEF_NOT_FOUND = (
"Decision definition does not exist",
HTTPStatus.BAD_REQUEST,
)
INVALID_AUTH_RESOURCE_ID = (
"Invalid authorization resource ID",
HTTPStatus.BAD_REQUEST,
Expand Down Expand Up @@ -61,6 +65,7 @@ class BusinessErrorCode(ErrorCodeMixin, Enum):
)
THEME_NOT_FOUND = "The specified theme not exist", HTTPStatus.BAD_REQUEST
THEME_EXIST = "The specified theme already exist", HTTPStatus.BAD_REQUEST
ROLE_MAPPING_FAILED = "Role mapping failed", HTTPStatus.BAD_REQUEST

def __new__(cls, message, status_code):
"""Constructor."""
Expand Down
Loading

0 comments on commit f627c47

Please sign in to comment.