<commit_before>
"""This module file contains Governance related constants and helper functions used within the Container."""

from pyon.core import bootstrap
from pyon.core.bootstrap import IonObject
from pyon.core.exception import BadRequest, Inconsistent
from pyon.ion.resource import RT, PRED, LCS, OT
from pyon.util.containers import get_safe, get_ion_ts_millis
from pyon.util.log import log

#These constants are ubiquitous, so define in the container
DEFAULT_ACTOR_ID = 'anonymous'
ORG_MANAGER_ROLE = 'ORG_MANAGER'  # Can only act upon resource within the specific Org
ORG_MEMBER_ROLE = 'ORG_MEMBER'    # Can only access resources within the specific Org
ION_MANAGER = 'ION_MANAGER'   # Can act upon resources across all Orgs - like a Super User access


#Helper methods

def get_role_message_headers(org_roles):
    '''
    Iterate the Org(s) that the user belongs to and create a header that lists only the role names per Org assigned<commit_msg>OOIION-1245; enhancement to support create_attachment policy<commit_after>
"""This module file contains Governance related constants and helper functions used within the Container."""

from pyon.core import bootstrap
from pyon.core.bootstrap import IonObject
from pyon.core.exception import BadRequest, Inconsistent
from pyon.ion.resource import RT, PRED, LCS, OT
from pyon.util.containers import get_safe, get_ion_ts_millis
from pyon.util.log import log

#These constants are ubiquitous, so define in the container
DEFAULT_ACTOR_ID = 'anonymous'
ORG_MANAGER_ROLE = 'ORG_MANAGER'  # Can only act upon resource within the specific Org
ORG_MEMBER_ROLE = 'ORG_MEMBER'    # Can only access resources within the specific Org
ION_MANAGER = 'ION_MANAGER'   # Can act upon resources across all Orgs - like a Super User access
INSTRUMENT_OPERATOR = 'INSTRUMENT_OPERATOR'
OBSERVATORY_OPERATOR = 'OBSERVATORY_OPERATOR'


#Helper methods

def get_role_message_headers(org_roles):
    '''
    Iterate the Org(s) that the user belongs to and create a header that lists only the role names per Org assigned
{'fraction_non_alphanumeric': 0.05574572127139364, 'fraction_numerical': 0.0019559902200488996, 'mean_word_length': 5.3343653250774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3723995', 'n_tokens_mistral': 622, 'n_tokens_neox': 603, 'n_words': 238}