...

Text file src/edge-infra.dev/cmd/sds/emergencyaccess/userservice/README.md

Documentation: edge-infra.dev/cmd/sds/emergencyaccess/userservice

     1# Userservice
     2
     3The userservice is a component within the emergency access solution. 
     4It's purpose is to resolve roles for users of the emenrgencyaccess service
     5
     6# Table of Contents
     7- [Userservice](#userservice)
     8- [Table of Contents](#table-of-contents)
     9- [Configuration](#configuration)
    10- [API](#api)
    11  - [Get ea Roles](#get-ea-roles)
    12- [Source code](#source-code)
    13
    14# Configuration
    15
    16The Userservice is currently configured through a database.
    17The standard set of connection details are required to run userservice.
    18
    19```env
    20APP_ENV=local-dev
    21PORT=9093
    22GIN_MODE=debug
    23# DATABASE_CONNECTION_NAME=
    24DATABASE_HOST=
    25DATABASE_PORT=
    26DATABASE_NAME=
    27DATABASE_USERNAME=
    28PGAPPNAME=
    29DATABASE_PASSWORD=
    30```
    31
    32To configure userservice the `oi_role_privileges` and `ea_rules_privileges` tables must be populated, e.g. 
    33
    34```sql
    35
    36INSERT INTO ea_rules_privileges (privilege_id, name)
    37VALUES
    38    ('a7c379ea-6e34-4017-8e86-eb545d7856a3', 'ea-read'),
    39    ('caedabee-ea7a-4421-a608-ec04106e61da', 'ea-write'),
    40    ('a42a0f40-ab74-49e9-a0cf-82264cf69444', 'ea-admin'),
    41    ('bc39e791-05a4-4631-b678-45343e3a033a', 'dev'),
    42    ('70a832ea-e2b2-4082-93e0-e9a363a511b0', 'ea-dark')
    43;
    44
    45INSERT INTO oi_role_privileges (role_name, privilege_id)
    46VALUES
    47    ('EDGE_BANNER_OPERATOR', 'a7c379ea-6e34-4017-8e86-eb545d7856a3'),
    48    ('EDGE_BANNER_ADMIN', 'a7c379ea-6e34-4017-8e86-eb545d7856a3'),
    49    ('EDGE_BANNER_ADMIN', 'bc39e791-05a4-4631-b678-45343e3a033a'),
    50    ('EDGE_BANNER_ADMIN', '70a832ea-e2b2-4082-93e0-e9a363a511b0')
    51;
    52```
    53
    54# API
    55
    56The userservice is an HTTP API
    57
    58## Get ea Roles
    59
    60This API is used to find all of the ea roles associated with any user roles
    61
    62__URI__: `/eaRoles`
    63
    64__Method__ : `GET`
    65
    66__Query Parameters__:
    67- `role`: A list of user roles to find the ea roles for
    68
    69__Response__:
    70
    71JSON array of all ea roles associated with any of the user roles
    72
    73# Source code
    74
    75Currently the main binary for the userservice is created in this directory `cmd/sds/emergencyaccess/userservice`,
    76and the packages are located in `pkg/sds/emergencyaccess/user`.
    77The yaml manifests to deploy userservice to a k8s cluster are located within `config/pallets/emergencyaccess/userservice`.

View as plain text