<commit_before>/*©mit**************************************************************************
*                                                                              *
* This file is part of FRIEND UNIFYING PLATFORM.                               *
* Copyright (c) Friend Software Labs AS. All rights reserved.                  *
*                                                                              *
* Licensed under the Source EULA. Please refer to the copy of the MIT License, *
* found in the file license_mit.txt.                                           *
*                                                                              *
*****************************************************************************©*/
/** @file
 *
 *  User Group Manager
 *
 * file contain all functitons related to user group management
 *
 *  @author PS (<NAME>)
 *  @date created 18/01/2019
 */

#include "user_group_manager.h"
#include <system/user/user_sessionmanager.h>

#include <system/systembase.h>
#include <util/sha256.h>
#include <system/fsys/device_handling.h>
#include <util/session_id.h>
#include <util/element_list.h>

/**
 * Create UserGroupManager
 *
 * @param sb pointer to SystemBase
 * @return UserGroupManager structure
 */
UserGroupManager *UGMNew( void *sb )
{
	UserGroupManager *sm;
	
	if( ( sm = FCalloc( 1, sizeof( UserGroupManager ) ) ) != NULL )
	{
		SystemBase *lsb = (SystemBase *)sb;
		sm->ugm_SB = sb;
		Log( FLOG_INFO,  "[SystemBase] Loading groups from DB\n");
	
		SQLLibrary *sqlLib = lsb->LibrarySQLGet( lsb );
		if( sqlLib != NULL )
		{
			int entries;
			sm->ugm_UserGroups = sqlLib->Load( sqlLib, UserGroupDesc, NULL, &entries );
			lsb->LibrarySQLDrop( lsb, sqlLib );<commit_msg>FIX - UGM read only groups marked by type Workgroups and Level<commit_after>/*©mit**************************************************************************
*                                                                              *
* This file is part of FRIEND UNIFYING PLATFORM.                               *
* Copyright (c) Friend Software Labs AS. All rights reserved.                  *
*                                                                              *
* Licensed under the Source EULA. Please refer to the copy of the MIT License, *
* found in the file license_mit.txt.                                           *
*                                                                              *
*****************************************************************************©*/
/** @file
 *
 *  User Group Manager
 *
 * file contain all functitons related to user group management
 *
 *  @author PS (<NAME>)
 *  @date created 18/01/2019
 */

#include "user_group_manager.h"
#include <system/user/user_sessionmanager.h>

#include <system/systembase.h>
#include <util/sha256.h>
#include <system/fsys/device_handling.h>
#include <util/session_id.h>
#include <util/element_list.h>

/**
 * Create UserGroupManager
 *
 * @param sb pointer to SystemBase
 * @return UserGroupManager structure
 */
UserGroupManager *UGMNew( void *sb )
{
	UserGroupManager *sm;
	
	if( ( sm = FCalloc( 1, sizeof( UserGroupManager ) ) ) != NULL )
	{
		SystemBase *lsb = (SystemBase *)sb;
		sm->ugm_SB = sb;
		Log( FLOG_INFO,  "[SystemBase] Loading groups from DB\n");
	
		SQLLibrary *sqlLib = lsb->LibrarySQLGet( lsb );
		if( sqlLib != NULL )
		{
			int entries;
			char where[ 256 ];
			
			strcpy( where, " Type in( 'Workgroup','Level' )" );
			
			sm->ugm_UserGroups = sqlLib->Load( sqlLib, UserGroupDesc, where, &entries );
			lsb->LibrarySQLDrop( lsb, sqlLib );
{'fraction_non_alphanumeric': 0.1834121903701642, 'fraction_numerical': 0.0075146117450598385, 'mean_word_length': 2.017632241813602, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6948744', 'n_tokens_mistral': 1022, 'n_tokens_neox': 929, 'n_words': 268}