<commit_before>var keystone = require('../../');

exports = module.exports = {
	permissionLevels: {
		admin: 10,
		editor: 9,
		senior: 8,
		junior: 6,
		copy: 4,
		design: 4,
		staff: 1
	},
	/**
	 * Performs an authentication check to see if a user can edit a model field
	 * @param  {Object} field
	 * @param  {Object} user
	 * @return {Boolean}
	 */
	canEditField: function (field, user) {
		switch (field.list.model.modelName) {
		case 'LiteratureSubmission':
			switch (field.label) {
			case 'Title':
			case 'Status':
			case 'Staff Meeting Assignment':
			case 'Publish Online':
				return user.isSeniorDesign || user.isSeniorLiterature || user.permissionLevel > this.permissionLevels.senior;
			case 'Edited Piece':
				return user.isJuniorLiterature || user.permissionLevel > this.permissionLevels.junior;
			default:
				return true;
			}
			break;
		case 'ArtSubmission':
			switch (field.label) {
			case 'Title':
			case 'Status':
			case 'Staff Meeting Assignment':
			case 'Publish Online':
				return user.isSeniorDesign || user.isSeniorArt || user.permissionLevel > this.permissionLevels.senior;
			case 'Edited Image':
				return user.isJuniorArt || user.permissionLevel > this.permissionLevels.senior;
			default:
				return true;
			}
			break;<commit_msg>Adds auth permissions for Volume Assignment relationship.<commit_after>var keystone = require('../../');

exports = module.exports = {
	permissionLevels: {
		admin: 10,
		editor: 9,
		senior: 8,
		junior: 6,
		copy: 4,
		design: 4,
		staff: 1
	},
	/**
	 * Performs an authentication check to see if a user can edit a model field
	 * @param  {Object} field
	 * @param  {Object} user
	 * @return {Boolean}
	 */
	canEditField: function (field, user) {
		switch (field.list.model.modelName) {
		case 'LiteratureSubmission':
			switch (field.label) {
			case 'Title':
			case 'Status':
			case 'Staff Meeting Assignment':
			case 'Volume Assignment':
			case 'Publish Online':
				return user.isSeniorDesign || user.isSeniorLiterature || user.permissionLevel > this.permissionLevels.senior;
			case 'Edited Piece':
				return user.isJuniorLiterature || user.permissionLevel > this.permissionLevels.junior;
			default:
				return true;
			}
			break;
		case 'ArtSubmission':
			switch (field.label) {
			case 'Title':
			case 'Status':
			case 'Staff Meeting Assignment':
			case 'Volume Assignment':
			case 'Publish Online':
				return user.isSeniorDesign || user.isSeniorArt || user.permissionLevel > this.permissionLevels.senior;
			case 'Edited Image':
				return user.isJuniorArt || user.permissionLevel > this.permissionLevels.senior;
			default:
				return true;
			}
			break;
{'fraction_non_alphanumeric': 0.11935240963855422, 'fraction_numerical': 0.006024096385542169, 'mean_word_length': 3.5187074829931975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1024775', 'n_tokens_mistral': 1033, 'n_tokens_neox': 835, 'n_words': 231}