Module GroupService

Macros to manipulate and create user groups, their availability in contexts, and their membership lists.

Since: 2.1

Macro Summary
external

LSAF
%lsaf_addgroupmember(lsaf_path=, lsaf_group=, lsaf_type=USER, lsaf_member=, lsaf_group_context=);
Adds a user or group as a member of a group in the specified context.
external

LSAF
%lsaf_creategroup(lsaf_path=, lsaf_group=, lsaf_description=);
Creates a group in the specified context.
external

LSAF
%lsaf_deletegroup(lsaf_path=, lsaf_group=);
Deletes a group from the specified organization, project, or analysis.
external

LSAF
%lsaf_getgroupmembers(lsaf_path=, lsaf_group=, sas_dsname=work.lsafGetGroupMembers);
Gets the metadata for all of the members that are assigned to a group within the specified ...
external

LSAF
%lsaf_getgroups(lsaf_path=, sas_dsname=work.lsafGetGroups);
Gets the metadata for all of the groups that are defined within the specified context. The ...
external

LSAF
%lsaf_getusergroups(lsaf_userid=, sas_dsname=work.lsafGetUserGroups);
Gets the metadata for each of the groups in which the specified user is a member. The ...
external

LSAF
%lsaf_groupexists(lsaf_path=, lsaf_group=);
Indicates whether a group is defined for the specified context.
external

LSAF
%lsaf_isgroupmember(lsaf_path=, lsaf_group=, lsaf_member=, lsaf_type=USER, lsaf_group_context=, lsaf_includeImplicit=0);
Indicates whether a user or group is a member of the group in the specified context. A flag can be ...
external

LSAF
%lsaf_removegroupmember(lsaf_path=, lsaf_group=, lsaf_member=, lsaf_type=USER, lsaf_group_context=);
Removes a user or a group as a member of a group in the specified context.

Macro Detail

%lsaf_addgroupmember(lsaf_path=, lsaf_group=, lsaf_type=USER, lsaf_member=, lsaf_group_context=);

[ Exposure: external ]
Adds a user or group as a member of a group in the specified context.

Syntax:
%LSAF_ADDGROUPMEMBER(LSAF_PATH=lsaf-path, LSAF_GROUP=lsaf-group-name,
LSAF_MEMBER=lsaf-member-identifier <, LSAF_TYPE=lsaf-member-type,
LSAF_GROUP_CONTEXT=lsaf-group-context>);

Example Code
Context paths used in examples:
- Organization: /SAS
- Project: /SAS/Project1
- Analysis: /SAS/Project1/Analysis1

1. Add user as a group member at the project level:
%lsaf_addgroupmember(lsaf_path=%str(/SAS/Project1), lsaf_group=%str(PrjGrp1),
lsaf_member=%str(User1), lsaf_type=%str(USER));

2. Add group as a group member at the project level:
%lsaf_addgroupmember(lsaf_path=%str(/SAS/Project1), lsaf_group=%str(PrjGrp1),
lsaf_member=%str(OrgGrp1), lsaf_type=%str(GROUP), lsaf_group_context=%str(/SAS));

3. Add user as a group member at the analysis level:
%lsaf_addgroupmember(lsaf_path=%str(/SAS/Project1/Analysis1),
lsaf_group=%str(AnaGrp1), lsaf_member=%str(User1), lsaf_type=%str(USER));

4. Add project group as a group member at the analysis level:
%lsaf_addgroupmember(lsaf_path=%str(/SAS/Project1/Analysis1),
lsaf_group=%str(AnaGrp1), lsaf_member=%str(PrjGrp1), lsaf_type=%str(GROUP),
lsaf_group_context=%str(/SAS/Project1));

5. Add an organization group as a group member at the analysis level:
%lsaf_addgroupmember(lsaf_path=%str(/SAS/Project1/Analysis1),
lsaf_group=%str(AnaGrp1), lsaf_member=%str(OrgGrp1), lsaf_type=%str(GROUP),
lsaf_group_context=%str(/SAS));

          
History:
   2013-08-30
updates for standardization and coding conventions
   2016-08-29
rebrand as LSAF
   2019-01-21
updates for LSAF 5.1 functionality
Expected Macro Variables:
_lsafMsg_ - The return message.
_lsafRC_ - The return code.
Parameters:
lsaf_path - - Required - The path of the context.
lsaf_group - - Required - The name of the group in which to add the member.
lsaf_type - - conditional - the type of member being added.
        Valid values (case-insensitive):
        - USER (Default)
        - GROUP
lsaf_member - - Required - The user ID of the user or the name of the group to add.
lsaf_group_context - - Conditional - The context in which the group is defined, specified
        as a path (such as /SAS). If LSAF_TYPE=GROUP, this parameter is required. Otherwise,
        it is ignored.
File: lsaf_addgroupmember.sas
First available in version: 1.2

%lsaf_creategroup(lsaf_path=, lsaf_group=, lsaf_description=);

[ Exposure: external ]
Creates a group in the specified context.

Syntax:
%LSAF_CREATEGROUP(LSAF_PATH=lsaf-path, LSAF_GROUP=lsaf-group-name
<, LSAF_DESCRIPTION=lsaf-description>);

          
History:
   2013-08-30
updates for standardization and coding conventions
   2016-08-26
rebrand as LSAF
   2019-01-21
updates for LSAF 5.1 behavior.
Expected Macro Variables:
_lsafMsg_ - The return message.
_lsafRC_ - The return code.
Parameters:
lsaf_path - - Required - The path of the context.
lsaf_group - - Required - The name of the group.
lsaf_description - - Optional- The description for the group.
File: lsaf_creategroup.sas
First available in version: 1.2

%lsaf_deletegroup(lsaf_path=, lsaf_group=);

[ Exposure: external ]
Deletes a group from the specified organization, project, or analysis.

Syntax:
%LSAF_DELETEGROUP(LSAF_PATH=lsaf-path, LSAF_GROUP=lsaf-group-name);

          
History:
   2013-08-30
updates for standardization and coding conventions
   2016-08-26
rebrand as LSAF
Expected Macro Variables:
_lsafMsg_ - The return message.
_lsafRC_ - The return code.
Parameters:
lsaf_path - - Required - The path of the context in which the group is defined.
lsaf_group - - Required - The name of the group.
File: lsaf_deletegroup.sas
First available in version: 1.2

%lsaf_getgroupmembers(lsaf_path=, lsaf_group=, sas_dsname=work.lsafGetGroupMembers);

[ Exposure: external ]
Gets the metadata for all of the members that are assigned to a group within the specified
context. The metadata is stored in a SAS data set.

Syntax:
%LSAF_GETGROUPMEMBERS(LSAF_PATH=lsaf-path, LSAF_GROUP=lsaf-group
<, SAS_DSNAME=SAS-data-set>);

          
History:
   2013-08-30
updates for standardization and coding conventions
   2016-08-26
rebrand as LSAF
   2019-01-21
updates for LSAF 5.1 functionality.
   2019-11-01
update to handle a blank SAS output file.
Expected Macro Variables:
_lsafMsg_ - The return message.
_lsafRC_ - The return code.
Parameters:
lsaf_path - - Required - The path of the context in which the group is defined.
lsaf_group - - Required - The name of the group.
sas_dsname - - Optional - The name of the output SAS data set that contains the metadata
        for the members, specified as libref.data set. The default value is
        WORK.LSAFGETGROUPMEMBERS. The data set contains a row for each member and columns
        with the following names. The data set is sorted by member type and principalId.
        - contextPath: The full path of the context item in the repository.
        - type: The member type. Valid values are USER and GROUP.
        - principalId: The name of the member. Valid values are the group name or user ID.
        - description: The description of the member. Valid values are group name or user
        display name.
        - grpSrcCtxt: The context in which the group member is defined.
File: lsaf_getgroupmembers.sas
First available in version: 1.2

%lsaf_getgroups(lsaf_path=, sas_dsname=work.lsafGetGroups);

[ Exposure: external ]
Gets the metadata for all of the groups that are defined within the specified context. The
metadata is stored in a SAS data set.

Syntax:
%LSAF_GETGROUPS(LSAF_PATH=lsaf-path <, SAS_DSNAME=SAS-data-set>);

          
History:
   2013-08-30
updates for standardization and coding conventions
   2016-08-26
rebrand as LSAF
   2019-01-21
updates for LSAF 5.1 behavior
   2019-11-01
update to handle a blank SAS output file.
Expected Macro Variables:
_lsafMsg_ - The return message.
_lsafRC_ - The return code.
Parameters:
lsaf_path - - Required - The path of the context in which the groups are defined.
sas_dsname - - Optional - The name of the output SAS data set that contains the metadata
        for all of the groups, specified as libref.dataset. The default value is
        WORK.LSAFGETGROUPS. The data set contains a row for each group and columns with the
        following names. The data set is sorted by group name.
        - contextPath: The path of the context item in the repository.
        - name: The name of the group.
        - description: The group description.
File: lsaf_getgroups.sas
First available in version: 1.2

%lsaf_getusergroups(lsaf_userid=, sas_dsname=work.lsafGetUserGroups);

[ Exposure: external ]
Gets the metadata for each of the groups in which the specified user is a member. The
metadata is stored in a SAS data set.

Syntax:
%LSAF_GETUSERGROUPS(LSAF_USERID=lsaf-userid <, SAS_DSNAME=SAS-data-set>);

          
History:
   2014-03-20
initial coding
   2016-08-26
rebrand as LSAF
   2019-11-01
update to handle a blank SAS output file.
Expected Macro Variables:
_lsafMsg_ - The return message.
_lsafRC_ - The return code.
Parameters:
lsaf_userid - - Required - The user ID of the user for whom to retreive the groups.
sas_dsname - - Optional - The name of the output SAS data set to contain the metadata
        for the groups, specified as libref.dataset. The default value is
        WORK.LSAFGETUSERGROUPS. The data set contains a row for each group and columns
        with the following names. The data set is sorted by the group name and group
        context path.
        - userId: The user ID of the user.
        - name: The name of the group.
        - description: The description of the group.
        - grpSrcCtxt: The context path in which the group is defined.
File: lsaf_getusergroups.sas
First available in version: 1.4

%lsaf_groupexists(lsaf_path=, lsaf_group=);

[ Exposure: external ]
Indicates whether a group is defined for the specified context.

The macro variable _lsafGroupExists_ is set to 1, if the group exists, 0 if it does not.
In the event of an incorrect call to the macro that results in an error, the return value of
_lsafGroupExists_ is set to -1.

Syntax:
%LSAF_GROUPEXISTS (LSAF_PATH=lsaf-path, LSAF_GROUP=lsaf- name);

          
History:
   2013-08-30
updates for standardization and coding conventions
   2016-08-26
rebrand as LSAF
   2019-03-06
update to 2.1
Expected Macro Variables:
_lsafGroupExists_ - Indicates whether the group exists in the context.
_lsafMsg_ - The return message.
_lsafRC_ - The return code.
Parameters:
lsaf_path - - Required - The path of the context object.
lsaf_group - - Required - The name of the group.
File: lsaf_groupexists.sas
First available in version: 1.2

%lsaf_isgroupmember(lsaf_path=, lsaf_group=, lsaf_member=, lsaf_type=USER, lsaf_group_context=, lsaf_includeImplicit=0);

[ Exposure: external ]
Indicates whether a user or group is a member of the group in the specified context. A flag can be
set to indicate whether the search for membership includes implicit membership.

The SAS macro variable _lsafIsGroupMember_ is set to a value of 1 when the specified user or
group is a member of the group, 0 if it is not. In the event of an incorrect call to the
macro that results in an error, the return value of _lsafIsGroupMember_ is set to -1.

Syntax:
%LSAF_ISGROUPMEMBER(LSAF_PATH=lsaf-path, LSAF_GROUP=lsaf-group-name,
LSAF_MEMBER=lsaf-member-identifier, <, LSAF_TYPE=lsaf-type, LSAF_GROUP_CONTEXT=lsaf-group-context,
LSAF_INCLUDEIMPLICIT=lsaf_include_implicit>);

          
History:
   2013-08-30
updates for standardization and coding conventions
   2016-01-18
added includeImplicit flag.
   2016-08-26
rebrand as LSAF
   2019-01-18
updated for LSAF 5.1 functionality.
Expected Macro Variables:
_lsafIsGroupMember_ - Indicates whether the user or group is a member of the specified group.
_lsafMsg_ - The return message.
_lsafRC_ - The return code.
Parameters:
lsaf_path - - Required - The path of the context in which the group is assigned.
lsaf_group - - Required - The name of the group.
lsaf_member - - Required - The user ID or group name of the member.
lsaf_type - - Optional - The type of member. Valid values (case-insensitive):
        - USER (Default)
        - GROUP
        An invalid value results in the member not being found. *;
lsaf_group_context - - Conditional - The context in which the member group is defined,
        specified as a path (such as /SAS). The parameter is required, if LSAF_TYPE=GROUP.
        Otherwise, it is ignored.
lsaf_includeImplicit - - Optional - Indicates whether to include the implied members, such as
        the members of groups within groups. Valid values:
        - 0 (Default): Exclude
        - 1: Include
        If this value is not provided or an incorrect value is used, it defaults to 0. *;
File: lsaf_isgroupmember.sas
First available in version: 1.2

%lsaf_removegroupmember(lsaf_path=, lsaf_group=, lsaf_member=, lsaf_type=USER, lsaf_group_context=);

[ Exposure: external ]
Removes a user or a group as a member of a group in the specified context.

Syntax:
%LSAF_REMOVEGROUPMEMBER(LSAF_PATH=lsaf-path, LSAF_GROUP=lsaf-group-name,
LSAF_MEMBER=lsaf-member-identifier <, LSAF_TYPE=lsaf-type, LSAF_GROUP_CONTEXT=lsaf-group-context>);

          
History:
   2013-08-30
updates for standardization and coding conventions
   2016-08-26
rebrand as LSAF
   2019-01-21
updates for LSAF 5.1 functionality.
Expected Macro Variables:
_lsafMsg_ - The return message.
_lsafRC_ - The return code.
Parameters:
lsaf_path - - Required - The path of the context in which the group is defined.
lsaf_group - - Required - The name of the group from which to remove the member.
lsaf_member - - Required - The ID of the user or the name of the group to remove.
lsaf_type - - Conditional - The type of the member. Valid values (case-insensitive):
        - USER (Default)
        - GROUP
lsaf_group_context - - Conditional - The context in which the group to remove is defined,
        specified as a path (such as /SAS). This parameter is required, if LSAF_TYPE=GROUP.
        Otherwise, it is ignored.
File: lsaf_removegroupmember.sas
First available in version: 1.2