anchor.diff:          do_request(
               RestAddress ++ "/groups/" ++ binary_to_list(GID)++ "/users/token", Headers, get, [], Options
           ),
  -%%     ?PRINT(Response),
       [Token] = get_body_val([token], Response),
       Token.
   
  
positive.code:      %% create users
      UserId1 = create_user(?USER_NAME1, Node),
      UserId2 = create_user(?USER_NAME2, Node),
  
      %% authenticate users
      NewHeaders = auth_user(UserId1, ProviderId, ReqParams, Node),
      UserReqParams1 = update_req_params(ProviderReqParams, NewHeaders, headers),
      NewHeaders2 = auth_user(UserId2, ProviderId, ReqParams, Node),
      UserReqParams2 = update_req_params(ProviderReqParams, NewHeaders2, headers),
  
      GID = create_group(?GROUP_NAME1, UserReqParams1),
  
  
negative.code: %%         check_status(update_group(GID, ?GROUP_NAME2, UserReqParams2))
  %%     ),
  %%
  %%     set_group_user_privileges(GID, UserId2, [group_view_data], UserReqParams1),
  %%
  %%     ?assertMatch(
  %%         ok,
  %%         check_status(update_group(GID, ?GROUP_NAME2, UserReqParams2))
  %%     ),
  %%     get_group_user_privileges(GID, UserId1, UserReqParams1),
  %%     get_group_user_privileges(GID, UserId2, UserReqParams1),
  %%     clean_group_privileges(GID, UserId2, UserReqParams1),
  %%     ok.
  
  group_privileges_check([], _, _, _) -> ok;
  group_privileges_check([FirstPrivilege | Privileges], Users, GID, _SID) ->
      ?PRINT("PRIVILEGE"),
      ?PRINT(FirstPrivilege),
      group_privilege_check(FirstPrivilege, Users, GID, _SID),
      group_privileges_check(Privileges, Users, GID, _SID).
  
  group_privilege_check(group_view_data, Users, GID, _SID) ->
      [{_UserId1, UserReqParams1}, {UserId2, UserReqParams2} | _] = Users,
      %% user who belongs to group should have group_view_data privilege by default
      ?assertMatch([GID, ?GROUP_NAME1], read_group(GID, UserReqParams2)),
      clean_group_privileges(GID, UserId2, UserReqParams1);
  group_privilege_check(group_change_data, Users, GID, _SID) ->
      [{_UserId1, UserReqParams1}, {UserId2, UserReqParams2} | _] = Users,
      %% test if user2 lacks group_change_data privileges
      ?assertMatch(bad, check_status(update_group(GID, ?GROUP_NAME2, UserReqParams2))),
      set_group_user_privileges(GID, UserId2, [group_change_data], UserReqParams1),
      ?assertMatch(ok, check_status(update_group(GID, ?GROUP_NAME2, UserReqParams2))),
      clean_group_privileges(GID, UserId2, UserReqParams1);
  group_privilege_check(group_invite_user, Users, GID, _SID) ->
      [{_UserId1, UserReqParams1}, {UserId2, UserReqParams2} | _] = Users,
      %% test if user2 lacks group_invite_user privileges
      ?assertMatch(bad, check_status(get_group_invitation_token(GID, UserReqParams2))),
      set_group_user_privileges(GID, UserId2, [group_invite_user], UserReqParams1),
      ?assertNotMatch(bad, get_group_invitation_token(GID, UserReqParams2)),
      clean_group_privileges(GID, UserId2, UserReqParams1);
  group_privilege_check(group_set_privileges, Users, GID, _SID) ->
      [{UserId1, UserReqParams1}, {UserId2, UserReqParams2} | _] = Users,
       %% test if user2 lacks group_set_privileges privileges
      ?assertMatch(bad,
          check_status(set_group_user_privileges(GID, UserId1, ?GROUP_PRIVILEGES, UserReqParams2))
      ),
      set_group_user_privileges(GID, UserId2, [group_set_privileges], UserReqParams1),
      ?assertMatch(ok,
          check_status(set_group_user_privileges(GID, UserId1, ?GROUP_PRIVILEGES, UserReqParams2))
      ),
      clean_group_privileges(GID, UserId2, UserReqParams1);
  group_privilege_check(group_join_space, Users, GID, SID) ->
      [{_UserId1, UserReqParams1}, {UserId2, UserReqParams2} | _] = Users,
      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_group_privileges(GID, UserId2, UserReqParams1);
  group_privilege_check(group_leave_space, Users, GID, SID) ->
      [{_UserId1, UserReqParams1}, {UserId2, UserReqParams2} | _] = Users,
      InvitationToken = get_space_invitation_token(groups, SID, UserReqParams2),
      set_group_user_privileges(GID, UserId2, [group_join_space], UserReqParams1),
      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_group_privileges(GID, UserId2, UserReqParams1);
  group_privilege_check(group_create_space_token, Users, GID, _SID) ->
      [{_UserId1, UserReqParams1}, {UserId2, UserReqParams2} | _] = Users,
      %% 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_group_privileges(GID, UserId2, UserReqParams1);
  group_privilege_check(group_create_space_token, Users, GID, _SID) ->
      [{_UserId1, UserReqParams1}, {UserId2, UserReqParams2} | _] = Users,
      %% 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_group_privileges(GID, UserId2, UserReqParams1);
  group_privilege_check(group_remove_user, Users, GID, _SID) ->
      [{_UserId1, UserReqParams1}, {UserId2, UserReqParams2} , {UserId3, UserReqParams3}| _] = Users,
      Token = get_group_invitation_token(GID, UserReqParams1),
      join_user_to_group(Token, UserReqParams3),
      %% test if user2 lacks group_remove_user privilege
      ?assertMatch(bad, check_status(delete_group_user(GID, UserId3, UserReqParams3))),
      set_group_user_privileges(GID, UserId2, [group_remove_user], UserReqParams3),
      ?assertMatch(ok, check_status(delete_group_user(GID, UserId3, UserReqParams3)));
  group_privilege_check(group_remove, Users, GID, _SID) ->
      [{_UserId1, UserReqParams1}, {UserId2, UserReqParams2} | _] = Users,
      %% test if user2 lacks group_remove privileges
      ?assertMatch(bad, check_status(delete_group(GID, UserReqParams2))),
      set_group_user_privileges(GID, UserId2, [group_remove], UserReqParams1),
      ?assertMatch(ok, check_status(delete_group(GID, UserReqParams2))).
  
  clean_group_privileges(GID, UserId, ReqParams) ->
      set_group_user_privileges(GID, UserId, [group_view_data], ReqParams).
  