0

I'm learning django viewflow (non-Pro) and the all processes that I've been creating works for superuser users only

Is that normal?

Thanks, José.-

Edit 2: My specific problem is that my user can start the process, but he can't continue it (can't see the "otro_paso" task. See the code below), only if he's not superuser. When I cnange him to superuser, works.. why??

Edit 1: I'm using django-material auto-generated forms

A way to make it work is implementing custom views, making the permission validation programmatically

Edit 3:

Here's the flows.py part:

@frontend.register
class Flujo_Proceso_Recursos_fisicos(Flow):
    process_class = Proceso_Recursos_fisicos
    process_title = 'Recursos físicos'
    process_description = 'Registro de recursos físicos'

    inicio = flow.Start(
        CreateProcessView,
        fields=['anio'],
        task_title='Iniciar'
    ).Available(
        username='jose'
    ).Permission(
        'helloworld.puede_participar_biblioteca'
    ).Next(this.otro_paso)

    otro_paso = flow.View(
        UpdateProcessView,
        fields=['campus'],
        task_title='Campus',
        task_description= "Completar campus",
    ).Permission(
        'helloworld.puede_participar_biblioteca'
    ).Assign(
        username='jose'
    ).Next(this.fin)

    fin = flow.End(
        task_title='Finalizado',
    )
José
  • 1,774
  • 1
  • 17
  • 21
  • Why the downvotes? I'm using the material front-end with the auto-generated forms Still can't make it work for non-superusers – José Mar 06 '19 at 20:26

1 Answers1

0

To make a task available for a user, you need to auto-assign it with flow.View(..).Assign(...) or provide permission that would make this task available for a user - flow.View(..).Permission(..)

For the reference, you can check the demos

https://github.com/viewflow/viewflow/blob/master/demo/helloworld/flows.py#L42 https://github.com/viewflow/viewflow/blob/master/demo/shipment/flows.py#L28

kmmbvnr
  • 5,863
  • 4
  • 35
  • 44
  • Thanks @kmmbvnr. I checked the demos and the cookbook. I think I still missing something. I'll post my code in the next hours – José Mar 07 '19 at 12:15
  • I'm doing that. But still can't see the second task for "non-superusers" users – José Mar 08 '19 at 15:54
  • In addition you need to grant view permission - https://github.com/viewflow/viewflow/blob/master/demo/helloworld/fixtures/helloworld/default_data.json#L12 – kmmbvnr Mar 12 '19 at 06:54
  • So, I've always put process permissions besides custom permissions, right? – José Mar 12 '19 at 12:21
  • 1
    To get access to a flow user needs to have at least view permission. To get access to specific task - the task should be assigned to a user, or user should have task specific permission. – kmmbvnr Mar 13 '19 at 05:05