Example #1
0
        def post_user_bind(object, collection, item, ui):
            provider = UserManager.get(manager.context).get_sync_provider()
            editable = item.name != 'root'
            renameable = editable and provider.allows_renaming
            deletable = renameable

            ui.find('name-edit').visible = renameable 
            ui.find('name-label').visible = not renameable 
            ui.find('delete').visible = deletable
            
            box = ui.find('permissions')
            box.empty()

            p = PermissionProvider.get_all()
            for prov in p:
                line = self.ui.create('tab', title=prov.get_name())
                box.append(line)
                for perm in prov.get_permissions():
                    line.append(
                        self.ui.create('checkbox', id=perm[0], text=perm[1], value=(perm[0] in item.permissions))
                    )

            def copy():
                self.save()
                newuser = deepcopy(item)
                newuser.name += '_'
                collection[newuser.name] = newuser
                self.refresh()

            ui.find('copy').on('click', copy)
Example #2
0
        def post_user_bind(object, collection, item, ui):
            provider = UserManager.get(manager.context).get_sync_provider()
            editable = item.name != 'root'
            renameable = editable and provider.allows_renaming
            deletable = renameable

            ui.find('name-edit').visible = renameable
            ui.find('name-label').visible = not renameable
            ui.find('delete').visible = deletable

            box = ui.find('permissions')
            box.empty()

            p = PermissionProvider.get_all()
            for prov in p:
                line = self.ui.create('tab', title=prov.get_name())
                box.append(line)
                for perm in prov.get_permissions():
                    line.append(
                        self.ui.create('checkbox',
                                       id=perm[0],
                                       text=perm[1],
                                       value=(perm[0] in item.permissions)))

            def copy():
                self.save()
                newuser = deepcopy(item)
                newuser.name += '_'
                collection[newuser.name] = newuser
                self.refresh()

            ui.find('copy').on('click', copy)
Example #3
0
 def post_user_bind(object, collection, item, ui):
     box = ui.find('permissions')
     box.empty()
     for prov in PermissionProvider.get_all():
         line = self.ui.create('tab', title=prov.get_name())
         box.append(line)
         for perm in prov.get_permissions():
             line.append(self.ui.create('checkbox', id=perm[0], text=perm[1], \
                 value=(perm[0] in item.permissions)))
Example #4
0
 def post_user_bind(object, collection, item, ui):
     box = ui.find('permissions')
     box.empty()
     for prov in PermissionProvider.get_all():
         line = self.ui.create('tab', title=prov.get_name())
         box.append(line)
         for perm in prov.get_permissions():
             line.append(self.ui.create('checkbox', id=perm[0], text=perm[1], \
                 value=(perm[0] in item.permissions)))
Example #5
0
 def post_user_update(object, collection, item, ui):
     box = ui.find('permissions')
     for prov in PermissionProvider.get_all():
         for perm in prov.get_permissions():
             has = box.find(perm[0]).value
             if has and not perm[0] in item.permissions:
                 item.permissions.append(perm[0])
             if not has and perm[0] in item.permissions:
                 item.permissions.remove(perm[0])
Example #6
0
 def post_user_update(object, collection, item, ui):
     box = ui.find('permissions')
     for prov in PermissionProvider.get_all():
         for perm in prov.get_permissions():
             has = box.find(perm[0]).value
             if has and not perm[0] in item.permissions:
                 item.permissions.append(perm[0])
             if not has and perm[0] in item.permissions:
                 item.permissions.remove(perm[0])