<<

NAME

ProductOpener::Orgs - manages organizations

SYNOPSIS

ProductOpener::Orgs contains functions to create and edit organization profiles.

    use ProductOpener::Orgs qw/:all/;

        [..]

DESCRIPTION

[..]

DATA

Organization profile data is kept in files in the $BASE_DIRS{ORGS} directory. If it does not exist yet, the directory is created when the module is initialized.

FUNCTIONS

retrieve_org ( $org_id / $org_name )

Arguments

$org_id / $org_name

Identifier for the org (without the "org-" prefix) or org name.

Return values

This function returns a hash ref for the org, or undef if the org does not exist.

FUNCTIONS

list_org_ids()

Return values

This function returns an array of all existing org ids

store_org ( $org_ref )

Save changes to an org

Arguments

$org_ref

Hash ref for the org object.

Return values

None

create_org ( $creator, $org_id / $org_name, $org_ref )

Creates a new org.

Arguments

$creator

User id of the user creating the org (it can be the first user of the org, or an admin that creates an org by assigning an user to it).

$org_id / $org_name

Identifier for the org (without the "org-" prefix), or org name.

Return values

This function returns a hash ref for the org.

retrieve_or_create_org ( $creator, $org_id / $org_name, $org_ref )

If the org exists, the function returns the org object. Otherwise it creates a new org.

Arguments

$creator

User id of the user creating the org (it can be the first user of the org, or an admin that creates an org by assigning an user to it).

$org_id / $org_name

Identifier for the org (without the "org-" prefix), or org name.

Return values

This function returns a hash ref for the org.

set_org_gs1_gln ( $org_ref, $list_of_gs1_gln )

If the org exists, the function returns the org object. Otherwise it creates a new org.

Arguments

$creator

User id of the user creating the org (it can be the first user of the org, or an admin that creates an org by assigning an user to it).

$org_id / $org_name

Identifier for the org (without the "org-" prefix), or org name.

Return values

This function returns a hash ref for the org.

add_user_to_org ( $org_id / $org_ref, $user_id, $groups_ref )

Add the user to the specified groups of an organization.

Arguments

$org_id / $org_ref

Org id or org object.

$user_id

User id.

$groups_ref

Reference to an array of group ids (e.g. ["admins", "members"])

remove_user_from_org ( $org_id / $org_ref, $user_id, $groups_ref )

Remove the user from the specified groups of an organization.

Arguments

$org_id / $org_ref

Org id or org object.

$user_id

User id.

$groups_ref

Reference to an array of group ids (e.g. ["admins", "members"])

update_last_import_type($orgid, $data_source)

Update the last import type for an organization.

Arguments

$orgid

org_id_or_ref($org_id_or_ref)

Systematically return the org_ref for a given org_id or org_ref.

<<