<commit_before>package ufront.auth.tasks;

import ufront.auth.api.EasyAuthApi;
import ufront.auth.EasyAuthPermissions;
using tink.CoreApi;

#if ufront_uftasks
class EasyAuthTasks extends ufront.tasks.UFTaskSet {
	@:skip @inject public var easyAuthApi:EasyAuthApi;

	/** Create a new user with the given username and password. **/
	public function createUser( username:String, password:String ) {
		easyAuthApi.createUser( username, password ).sure();
	}

	/** Create a new user with the given username and password. **/
	public function createGroup( groupName:String ) {
		easyAuthApi.createGroup( groupName ).sure();
	}

	/** Assign a given permission to a given user. **/
	public function assignPermissionToUser( permission:String, username:String ) {
		var p = getPermissionFromString( permission );
		var u = easyAuthApi.getUserByUsername( username ).sure();
		easyAuthApi.assignPermissionToUser( p, u ).sure();
	}

	/** Assign a given permission to a given group. **/
	public function assignPermissionToGroup( permission:String, group:String ) {<commit_msg>Add some docs to EasyAuthTasks<commit_after>package ufront.auth.tasks;

import ufront.auth.api.EasyAuthApi;
import ufront.auth.EasyAuthPermissions;
using tink.CoreApi;

#if ufront_uftasks
/**
A `UFTaskSet` to perform some `EasyAuth` administration from your command line tasks.
**/
class EasyAuthTasks extends ufront.tasks.UFTaskSet {
	@:skip @inject public var easyAuthApi:EasyAuthApi;

	/** Create a new user with the given username and password. **/
	public function createUser( username:String, password:String ) {
		easyAuthApi.createUser( username, password ).sure();
	}

	/** Create a new user with the given username and password. **/
	public function createGroup( groupName:String ) {
		easyAuthApi.createGroup( groupName ).sure();
	}

	/** Assign a given permission to a given user. **/
	public function assignPermissionToUser( permission:String, username:String ) {
		var p = getPermissionFromString( permission );
		var u = easyAuthApi.getUserByUsername( username ).sure();
		easyAuthApi.assignPermissionToUser( p, u ).sure();
	}

	/** Assign a given permission to a given group. **/
	public function assignPermissionToGroup( permission:String, group:String ) {
{'fraction_non_alphanumeric': 0.10514541387024609, 'fraction_numerical': 0.0, 'mean_word_length': 5.043243243243243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '396625', 'n_tokens_mistral': 675, 'n_tokens_neox': 641, 'n_words': 204}