from gateone.core.utils import mkdir_p, generate_session_id
from gateone.core.utils import convert_to_timedelta
from gateone.core.utils import total_seconds
from gateone.core.locale import get_translation
from gateone.core.log import go_logger

# 3rd party imports
import tornado.web
import tornado.auth
import tornado.escape
import tornado.httpclient
import tornado.gen
from tornado.options import options

# Localization support
_ = get_translation()

# Globals
SETTINGS_CACHE = {}  # Lists of settings files and their modification times
# The security stuff below is a work-in-progress.  Likely to change all around.

auth_log = go_logger('gateone.auth')


# Helper functions
def additional_attributes(user, settings_dir=None):
    """
    Given a *user* dict, return a dict containing any additional attributes
    defined in Gate One's attribute repositories.

    .. note::
Exemple #2
0
from tornado.options import define, options
# You need 'options' to get define()'d values

# Globals
SESSIONS = {} # This will get replaced with gateone.py's SESSIONS dict
# NOTE: The overwriting of SESSIONS happens inside of gateone.py as part of
# the application initialization process.
APPLICATION_PATH = os.path.split(__file__)[0] # Path to our application
web_handlers = [] # Populated at the bottom of this file
example_log = go_logger("gateone.example") # Our app's logger
# NOTE: You can pass additional metadata to logs which will be JSON-encoded
# when your messages are logged.  Examples of how to do this are further along
# in this file...

# Localization support
_ = get_translation() # You don't *have* to do this but it is a good idea

# This is how you add command-line options to Gate One:
define(
    "example_option", # NOTE: underscores are the preferred word separator here
    default=True,
    help=_("Doesn't do anything (just an example from the example app).")
)
# You could then reference this option like so:
# print(options.example_option)

ALLOW = True # Used by polcy_example() below
def policy_test_example(cls, policy):
    """
    An example policy-checking function.  It will return ``True`` if conditions
    are met.  ``False`` if not.
Exemple #3
0
from gateone.core.utils import mkdir_p, generate_session_id
from gateone.core.utils import convert_to_timedelta
from gateone.core.utils import total_seconds
from gateone.core.locale import get_translation
from gateone.core.log import go_logger

# 3rd party imports
import tornado.web
import tornado.auth
import tornado.escape
import tornado.httpclient
import tornado.gen
from tornado.options import options

# Localization support
_ = get_translation()

# Globals
SETTINGS_CACHE = {} # Lists of settings files and their modification times
# The security stuff below is a work-in-progress.  Likely to change all around.

auth_log = go_logger('gateone.auth')

# Helper functions
def additional_attributes(user, settings_dir=None):
    """
    Given a *user* dict, return a dict containing any additional attributes
    defined in Gate One's attribute repositories.

    .. note::
Exemple #4
0
from tornado.options import define, options
# You need 'options' to get define()'d values

# Globals
SESSIONS = {}  # This will get replaced with gateone.py's SESSIONS dict
# NOTE: The overwriting of SESSIONS happens inside of gateone.py as part of
# the application initialization process.
APPLICATION_PATH = os.path.split(__file__)[0]  # Path to our application
web_handlers = []  # Populated at the bottom of this file
example_log = go_logger("gateone.example")  # Our app's logger
# NOTE: You can pass additional metadata to logs which will be JSON-encoded
# when your messages are logged.  Examples of how to do this are further along
# in this file...

# Localization support
_ = get_translation()  # You don't *have* to do this but it is a good idea

# This is how you add command-line options to Gate One:
define(
    "example_option",  # NOTE: underscores are the preferred word separator here
    default=True,
    help=_("Doesn't do anything (just an example from the example app)."))
# You could then reference this option like so:
# print(options.example_option)

ALLOW = True  # Used by polcy_example() below


def policy_test_example(cls, policy):
    """
    An example policy-checking function.  It will return ``True`` if conditions