Parsing data from Plone to Plomino #515

Open
beblank opened this Issue Jan 1, 2014 · 5 comments

Projects

None yet

2 participants

beblank commented Jan 1, 2014

i need to display document depending on user group
i tested this
http://www.plomino.net/how-to/display-documents-depending-on-the-current-user
and it works but now the problem is the manager is not 1 person and the managerial group is in plone user data.
how to parse the managerial data (from plone) to plomino field so the managers (e.g financial) can see the same data
or any workarround

thanks

Owner

I am not sure I understand the question.
Nevertheless, be aware you can use Plone groups instead of Plone users anywhere in Plomino (for example in Plomino_Readers or Plomino_Authors)

beblank commented Jan 21, 2014

that can be a workaround
how to do that?
and 1 other question
if im creating custom grouping based on location in plone can i do that to in plomino ?

Owner

How to do that? well, there is nothing special to do, if you create a Plone group, it will be listed with the users ids in the ACL tab fields.

beblank commented Jan 27, 2014

i think it would be best if i give u a detail on project im working on
so you can come up with best solution
im new to plone so sorry if im not really know how to do things in plone
and this is the problem
i need to have some member groups in one location its done in plone
but i have really hard times to make it happen in plomino
the solution i came up with is creating location user and restrict ones location user from filling others
but it has account sharing issue
lets just say
i have 3 members
andy and kevin who live in bali
then sarah who lives in jakarta
when andy filling the plomino form kevin can see and edit it while sarah cant see what andy and kevin filled
so she has to fill it from the beginning
thats why i need to create groups in plomino so i can restrict sarah from fill what andy and kevin filled

the algorithm will be something like this
if ( current_user_plone_group == documents_plone_group ){
openDocument()
} else {
return "error"
}

thanks

Owner

Ok I see, that's quite easy:

  • in Plone, create 2 groups: JakartaUsers and BaliUsers, and put the proper members in each of them
  • in Plomino, go to Access Control tab, and give the Author access level to the 2 groups
  • edit your form, and go to the Events tab to enter the following formula in the onSave event like this
user_groups = context.getCurrentUserGroups()
location_group = ""
if "JakartaUsers" in user_groups:
    location_group = "JakartaUsers"
if "BaliUsers" in user_groups:
    location_group = "BaliUsers"
if location_group:
    context.setItem("Plomino_Authors", [location_group])
    context.setItem("Plomino_Readers", [location_group])

First we get the current user groups.
Then, we check the location group the current user is belonging to.
And then, we set the identified group in the current document Plomino_Authors and Plomino_Readers fields.
The Plomino_Authors makes sure that only users belonging to the location group will be able to modify the doc.
And the Plomino_Readers makes sure that only users belonging to the location group will be able to see and read the doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment