anchor.diff:      %% TODO check user creator privileges
       get_group_user_privileges(GID, UserId2, UserReqParams2),
   
  -    Privileges =
  -        [
  -            group_view_data, group_change_data, group_invite_user,group_set_privileges
  -%%  ,           group_remove_user, group_join_space,
  -%%             group_create_space, group_remove, group_leave_space,
  -%%              group_create_space_token
  -        ],
  +    SID = create_space_for_user(?SPACE_NAME1, UserReqParams2),
  +
       ?assertMatch(
           ok,
  -        group_privileges_check(Privileges, {UserId1, UserReqParams1}, {UserId2, UserReqParams2}, GID)
  +        group_privileges_check(
  +            ?GROUP_PRIVILEGES, {UserId1, UserReqParams1}, {UserId2, UserReqParams2}, GID, SID
  +        )
       ).
   
   group_spaces_test(Config) ->
  
positive.code:         RestAddress ++ "/groups/" ++ binary_to_list(GID) ++ "/users/" ++ binary_to_list(UID),
          Headers, delete, [], Options
      ).
  
  
  get_group_user_privileges(GID, UID, ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
  
negative.code:     ?assertMatch(
          ok,
          check_status(set_group_user_privileges(GID, UserId1, ?GROUP_PRIVILEGES, UserReqParams2))
      ),
      clean_privileges(GID, UserId2, UserReqParams1);
  
  group_privileges_check(group_join_space, UserData1, UserData2, GID, SID) ->
      {UserId1, UserReqParams1} = UserData1,
      {UserId2, UserReqParams2} = UserData2,
  
      InvitationToken = get_space_invitation_token(groups, GID, UserReqParams2),
  
       %% test if user2 lacks group_join_space privileges
      ?assertMatch(
          bad,
          check_status(join_group_to_space(InvitationToken, SID, UserReqParams2))
      ),
  
      set_group_user_privileges(GID, UserId2, [group_join_space], UserReqParams1),
  
      ?assertMatch(
          SID,
          check_status(join_group_to_space(InvitationToken, GID, UserReqParams2))
      ),
      clean_privileges(GID, UserId2, UserReqParams1);
  
  group_privileges_check(group_leave_space, UserData1, UserData2, GID, SID) ->
      {UserId1, UserReqParams1} = UserData1,
      {UserId2, UserReqParams2} = UserData2,
  
      InvitationToken = get_space_invitation_token(groups, SID, UserReqParams2),
  
      set_group_user_privileges(GID, UserId2, [group_join_space], UserReqParams1),
  
      ?assertMatch(
          ok,
          check_status(join_group_to_space(InvitationToken, GID, UserReqParams2))
      ),
      %% test if user2 lacks group_leave_space privileges
      ?assertMatch(
          bad,
          check_status(group_leave_space(GID, SID, UserReqParams2))
      ),
  
      set_group_user_privileges(GID, UserId2, [group_join_space, group_leave_space], UserReqParams1),
      ?assertMatch(
          ok,
          check_status(group_leave_space(GID, SID, UserReqParams2))
      ),
      clean_privileges(GID, UserId2, UserReqParams1);
  
  group_privileges_check(group_create_space_token, UserData1, UserData2, GID, SID) ->
      {UserId1, UserReqParams1} = UserData1,
      {UserId2, UserReqParams2} = UserData2,
  
      %% test if user2 lacks group_create_space_token privileges
      ?assertMatch(
          bad,
          check_status(get_space_creation_token_for_group(GID, UserReqParams2))
      ),
  
      set_group_user_privileges(GID, UserId2, [group_create_space_token, group_leave_space], UserReqParams1),
  
      ?assertNotMatch(
          bad,
          check_status(get_space_creation_token_for_group(GID, UserReqParams2))
      ),
      clean_privileges(GID, UserId2, UserReqParams1);
  
  group_privileges_check(group_create_space_token, UserData1, UserData2, GID, SID) ->
      {UserId1, UserReqParams1} = UserData1,
      {UserId2, UserReqParams2} = UserData2,
  
      %% test if user2 lacks group_create_space_token privileges
      ?assertMatch(
          bad,
          check_status(create_space_for_group(?SPACE_NAME2, GID, UserReqParams2))
      ),
  
      set_group_user_privileges(GID, UserId2, [group_create_space], UserReqParams1),
  
      ?assertNotMatch(
          bad,
          check_status(create_space_for_group(?SPACE_NAME2, GID, UserReqParams2))
      ),
      clean_privileges(GID, UserId2, UserReqParams1);
  
  group_privileges_check(group_remove_user, UserData1, UserData2, GID, _SID) ->
      group_privileges_check(group_remove, UserData1, UserData2, GID, _SID);
  
  group_privileges_check(group_remove, UserData1, UserData2, GID, _SID) ->
  
      {UserId1, UserReqParams1} = UserData1,
      {UserId2, UserReqParams2} = UserData2,
  
      %% test if user2 lacks group_remove_user privileges
      ?assertMatch(
          bad,
          check_status(delete_group_user(GID, UserId1, UserReqParams2))
      ),
  
      %% test if user2 lacks group_remove privileges
      ?assertMatch(
          bad,
          check_status(delete_group(GID, UserReqParams2))
      ),
  
      set_group_user_privileges(GID, UserId2, [group_remove_user, group_remove], UserReqParams1),
  
      %% test if user2 lacks group_remove_user privileges
      ?assertMatch(
          ok,
          check_status(delete_group_user(GID, UserId1, UserReqParams2))
      ),
  
      %% test if user2 lacks group_remove privileges
      ?assertMatch(
          ok,
          check_status(delete_group(GID, UserReqParams2))
      ).
  
  clean_privileges(GID, UserId, ReqParams) ->
      set_group_user_privileges(GID, UserId, [group_view_data], ReqParams).
  