Changeset 4427 for syncer-plank-client/trunk/fuentes
- Timestamp:
- Apr 25, 2017, 5:19:00 PM (4 years ago)
- Location:
- syncer-plank-client/trunk/fuentes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
syncer-plank-client/trunk/fuentes/debian/changelog
r4089 r4427 1 syncer-plank-client (0.2) xenial; urgency=medium 2 3 * Deny modifications for teachers 4 5 -- M.Angel Juan <m.angel.juan@gmail.com> Tue, 25 Apr 2017 14:43:59 +0200 6 1 7 syncer-plank-client (0.1) xenial; urgency=medium 2 8 -
syncer-plank-client/trunk/fuentes/syncer-plank-client.install/usr/share/n4d/python-plugins/PlankSync.py
r4089 r4427 7 7 import base64 8 8 import StringIO 9 import types 9 10 10 11 class PlankSync: … … 34 35 def _get_group(self,data): 35 36 try: 36 if type(data) == type(list()): 37 if type(data[0]) == type(list()): # First iteration, list of lists 38 return self._get_group(data[0]) 39 if data[0].lower() == 'users': # Second iteration, plugin name 40 return self._get_group(data[1]) # Third iteration, group_name 41 if data[0].lower() == 'assert_grp': 42 return data[1] 37 if isinstance(data,(types.ListType)): 38 if isinstance(data[0],(types.ListType)): # First iteration, list of lists 39 retgrp=None 40 for item in data: 41 retgrp = self._get_group(item) 42 if retgrp != None: 43 return retgrp 44 45 if isinstance(data[1],(types.ListType)) and isinstance(data[0],(types.StringType,types.UnicodeType)): 46 if isinstance(data[1][0],(types.StringType,types.UnicodeType)): 47 if data[0].lower() == 'users' and data[1][0].lower() == 'assert_grp': 48 if isinstance(data[1][1],(types.StringType,types.UnicodeType)): 49 return data[1][1] 50 else: 51 return None 52 else: 53 return None 54 else: 55 return None 43 56 except Exception as e: 44 57 raise Exception(e) 45 58 def _get_planks(self,data): 46 59 try: 47 if type(data) == type(list()): 48 if data[0][0].lower() == 'plank' and data[0][1][0].lower() == 'add': 49 app=data[0][1][1] 50 if (len(data) > 1): 51 p=self._get_planks(data[1:]) 52 p.append(app) 53 return p 54 else: 55 return [app] 60 if isinstance(data,types.ListType): 61 if isinstance(data[0][0],(types.StringType,types.UnicodeType)) and isinstance(data[0][1][0],(types.StringType,types.UnicodeType)): 62 plugin_name=data[0][0] 63 operation=data[0][1][0] 64 if plugin_name.lower() == 'plank' and operation.lower() == 'add': 65 app=data[0][1][1] 66 if (len(data) > 1): 67 p=self._get_planks(data[1:]) 68 p.append(app) 69 return p 70 else: 71 return [app] 56 72 except Exception as e: 57 73 return str(e) … … 91 107 content=[] 92 108 #add group element 109 content.append(['users',['disavow_grp','teachers']]) 93 110 content.append(['users',['assert_grp',','.join(grouplist)]]) 94 111 #remove previous elements … … 116 133 return str(e) 117 134 135 #if __name__ == '__main__': 136 # sync=PlankSync() 137 # ret=sync.get_profiles() 138 # print('{}'.format(ret)) 118 139 119 140 120
Note: See TracChangeset
for help on using the changeset viewer.