Merge pull request #29 from titoko/dev

Skipped_uri & custom app
This commit is contained in:
Alexis Gavoty 2013-12-04 02:17:19 -08:00
commit 89739f69de

View file

@ -148,7 +148,9 @@ def app_list(offset=None, limit=None, filter=None, raw=False):
if original_app in app_dict: if original_app in app_dict:
app_dict[app] = app_dict[original_app] app_dict[app] = app_dict[original_app]
continue continue
app_dict[app] = { 'orphan': True } with open( apps_setting_path + app +'/manifest.json') as json_manifest:
app_dict[app] = {"manifest":json.loads(str(json_manifest.read()))}
app_dict[app]['manifest']['orphan']=True
if len(app_dict) > (0 + offset) and limit > 0: if len(app_dict) > (0 + offset) and limit > 0:
sorted_app_dict = {} sorted_app_dict = {}
@ -411,9 +413,10 @@ def app_install(app, label=None, args=None):
# Execute App install script # Execute App install script
os.system('chown -hR admin: '+ install_tmp) os.system('chown -hR admin: '+ install_tmp)
# Move scripts and manifest to the right place
os.system('cp '+ app_tmp_folder +'/manifest.json ' + app_setting_path)
os.system('cp -R ' + app_tmp_folder +'/scripts '+ app_setting_path)
if hook_exec(app_tmp_folder + '/scripts/install', args_dict) == 0: if hook_exec(app_tmp_folder + '/scripts/install', args_dict) == 0:
# Move scripts and manifest to the right place
os.system('mv "'+ app_tmp_folder +'/manifest.json" "'+ app_tmp_folder +'/scripts" '+ app_setting_path)
shutil.rmtree(app_tmp_folder) shutil.rmtree(app_tmp_folder)
os.system('chmod -R 400 '+ app_setting_path) os.system('chmod -R 400 '+ app_setting_path)
os.system('chown -R root: '+ app_setting_path) os.system('chown -R root: '+ app_setting_path)
@ -686,6 +689,17 @@ def app_ssowatconf():
for user in user_list()['Users']: for user in user_list()['Users']:
users[user['Username']] = app_map(user=user['Username']) users[user['Username']] = app_map(user=user['Username'])
skipped_uri=[]
apps={}
for app in app_list()['Apps']:
with open(apps_setting_path + app['ID'] +'/settings.yml') as f:
app_settings = yaml.load(f)
if 'skipped_uris' in app_settings:
skipped_uri=[app_settings['domain'] + app_settings['path'][:-1] + item for item in app_settings['skipped_uris'].split(',')]
for domain in domains:
skipped_uri.extend([domain +'/ynhadmin', domain +'/ynhapi'])
conf_dict = { conf_dict = {
'portal_domain': main_domain, 'portal_domain': main_domain,
'portal_path': '/ynhsso/', 'portal_path': '/ynhsso/',
@ -698,7 +712,7 @@ def app_ssowatconf():
'Email': 'mail' 'Email': 'mail'
}, },
'domains': domains, 'domains': domains,
'skipped_urls': [main_domain +'/ynhadmin', main_domain +'/ynhapi'], 'skipped_urls': skipped_uri,
'unprotected_urls': [], 'unprotected_urls': [],
'users': users 'users': users
} }