Il 19/03/2015 22:44, Manfredo Hopp ha scritto:
Thank you Marco I tested it with no errors but no memberships where created, maybe there is some configuration missing. I verified action class containing your code is active.

Please debug your syncAction and show syncope core logs.
In my example, the sync action assigns a role to an user. Also if you want to associate a membership attribute, you have to add other code.

Before this, you will need to create a membership schema, a role and configure the template in your Role and SyncAction:

UserTO userTO = (UserTO) subject;

MembershipTO membershipTO = new MembershipTO();
membershipTO.setRoleId(roleId);
final AttributeTO attributeTO = new AttributeTO();
attributeTO.setSchema("membershipSchemaName");
attributeTO.getValues().add("values");

//Add membership attribute
membershipTO.getAttrs().add(attributeTO);
//Add role to the user
userTO.getMemberships().add(membershipTO);

Regards
M


Regards

2015-03-19 12:34 GMT-03:00 Marco Di Sabatino Di Diodoro <marco.disabat...@tirasa.net <mailto:marco.disabat...@tirasa.net>>:

    Hi Manfredo,

    Il 19/03/2015 16:09, Manfredo Hopp ha scritto:
    Thank you Marco is it possible to do the same through  SyncAction?

    I tried with:

    Membership mem = new Membership();
    mem.setSyncopeRole(r);
    mem.setSyncopeUser(u);


    UserTO userTO = (UserTO) subject;

    MembershipTO membershipTO = new MembershipTO();
    membershipTO.setRoleId(roleId);

    userTO.getMemberships().add(membershipTO);

    Regards
    Marco



    Regards


    2015-03-19 5:38 GMT-03:00 Marco Di Sabatino Di Diodoro
    <marco.disabat...@tirasa.net <mailto:marco.disabat...@tirasa.net>>:

        Hi Manfredo,

        Il 18/03/2015 21:23, Manfredo Hopp ha scritto:
        Hi, from doc.

        "The primary purpose of identity management systems is to
        manage data belonging to/users/; it is common practice in
        such systems to define as well entities called/roles/that
        helps in defining and enforcing security policies. In
        addition to this, Syncope explicitly represents the fact
        that users can be assigned to roles by mean of/memberships/."

        How is the latter achieved, or how is it possible to assign
        users to Memberships.
        I tried to create a Membership setting user and role but
        doesnt seem to work..
        To be able to assign a role to a user and populate the
        membership you must perform the following steps:

        1) Go to Schema tab, then click Membership subtab.
        2) Create a new membership.
        3) Click to Roles tab, then create a new Role.
        4) In the configuration of the new role, you must not forget
        to add the membership attribute. To do this, you need to go
        under the Template subtab from edit RoleModalPage and move
        the membership schema from Available to Selected.
        5) Save.

        You are ready to create a new user, assign a role and and
        populate the value of its membership.

        1) Go to User Tab.
        2) Click on create.
        3) Fill all fields.
        4) Click on Roles subtab.
        5) Add the role that you have configured before.
        6) In "Selected Roles", click edit link.
        7) Enter the value in your membership field.

        Regards
        Marco


        Regards


-- Dott. Marco Di Sabatino Di Diodoro
        Tel. +39 3939065570

        Tirasa S.r.l.
        Viale D'Annunzio 267 - 65127 Pescara
        Tel +39 0859116307 / FAX +39 0859111173
        http://www.tirasa.net

        Apache Syncope PMC Member
        http://people.apache.org/~mdisabatino/  
<http://people.apache.org/%7Emdisabatino/>



-- Dott. Marco Di Sabatino Di Diodoro
    Tel. +39 3939065570

    Tirasa S.r.l.
    Viale D'Annunzio 267 - 65127 Pescara
    Tel +39 0859116307 / FAX +39 0859111173
    http://www.tirasa.net

    Apache Syncope PMC Member
    http://people.apache.org/~mdisabatino/  
<http://people.apache.org/%7Emdisabatino/>



--
Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173
http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/~mdisabatino/

Reply via email to