def on_success(appstruct):
            """Update the group resource on successful form validation"""

            organization = self.organizations[appstruct["organization"]]
            scopes = [GroupScope(scope=o) for o in appstruct["scopes"]]

            self.group_update_svc.update(
                group,
                organization=organization,
                creator=self.user_svc.fetch(appstruct["creator"],
                                            group.authority),
                description=appstruct["description"],
                name=appstruct["name"],
                scopes=scopes,
                enforce_scope=appstruct["enforce_scope"],
            )

            memberids = []
            for username in appstruct["members"]:
                memberids.append(
                    self.user_svc.fetch(username, group.authority).userid)

            self.group_members_svc.update_members(group, memberids)

            self.form = _create_form(self.request, self.schema, (_("Save"), ))
            self._update_appstruct()

            return self._template_context()
Exemple #2
0
        def on_success(appstruct):
            user_svc = self.request.find_service(name='user')

            group.creator = user_svc.fetch(appstruct['creator'], group.authority)
            group.description = appstruct['description']
            group.name = appstruct['name']
            group.scopes = [GroupScope(origin=o) for o in appstruct['origins']]

            self._update_appstruct()

            return self._template_context()
Exemple #3
0
        def on_success(appstruct):
            user_svc = self.request.find_service(name='user')
            group_svc = self.request.find_service(name='group')

            group.creator = user_svc.fetch(appstruct['creator'],
                                           group.authority)
            group.description = appstruct['description']
            group.name = appstruct['name']
            group.scopes = [GroupScope(origin=o) for o in appstruct['origins']]
            group.organization = self.organizations[appstruct['organization']]

            group_svc.update_membership(group, appstruct['members'])

            self.form = _create_form(self.request, self.schema, (_('Save'), ))
            self._update_appstruct()

            return self._template_context()