<commit_before>/* -------------------------------------------------------------------------- */
/* Copyright 2002-2019, OpenNebula Project, OpenNebula Systems                */
/*                                                                            */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
/* not use this file except in compliance with the License. You may obtain    */
/* a copy of the License at                                                   */
/*                                                                            */
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
/*                                                                            */
/* Unless required by applicable law or agreed to in writing, software        */
/* distributed under the License is distributed on an "AS IS" BASIS,          */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
/* See the License for the specific language governing permissions and        */
/* limitations under the License.                                             */
/*--------------------------------------------------------------------------- */

package shared

// Permissions is associated to OpenNebula resources
// * uu: USER USE bit.
// * um: USER MANAGE bit.
// * ua: USER ADMIN bit.
// * gu: GROUP USE bit.
// * gm: GROUP MANAGE bit.
// * ga: GROUP ADMIN bit.
// * ou: OTHER USE bit.
// * om: OTHER MANAGE bit.
// * oa: OTHER ADMIN bit.
type Permissions struct {
	OwnerU int `xml:"OWNER_U"`
	OwnerM int `xml:"OWNER_M"`
	OwnerA int `xml:"OWNER_A"`
	GroupU int `xml:"GROUP_U"`
	GroupM int `xml:"GROUP_M"`
	GroupA int `xml:"GROUP_A"`
	OtherU int `xml:"OTHER_U"`
	OtherM int `xml:"OTHER_M"`
	OtherA int `xml:"OTHER_A"`
}

var permStr = [8]string{"---", "--a", "-m-", "-ma", "u--", "u-a", "um-", "uma"}

// If a bit is set to -1, it will not change when calling Chmod
func (p *Permissions) ToArgs(id int) []interface{} {
	return []interface{}{
		id,
		p.OwnerU, p.OwnerM, p.OwnerA,
		p.GroupU, p.GroupM, p.GroupA,
		p.OtherU, p.OtherM, p.OtherA,
	}<commit_msg>F #4134: GOCA - reduce permission size (#4135)<commit_after>/* -------------------------------------------------------------------------- */
/* Copyright 2002-2019, OpenNebula Project, OpenNebula Systems                */
/*                                                                            */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
/* not use this file except in compliance with the License. You may obtain    */
/* a copy of the License at                                                   */
/*                                                                            */
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
/*                                                                            */
/* Unless required by applicable law or agreed to in writing, software        */
/* distributed under the License is distributed on an "AS IS" BASIS,          */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
/* See the License for the specific language governing permissions and        */
/* limitations under the License.                                             */
/*--------------------------------------------------------------------------- */

package shared

// Permissions is associated to OpenNebula resources
// * uu: USER USE bit.
// * um: USER MANAGE bit.
// * ua: USER ADMIN bit.
// * gu: GROUP USE bit.
// * gm: GROUP MANAGE bit.
// * ga: GROUP ADMIN bit.
// * ou: OTHER USE bit.
// * om: OTHER MANAGE bit.
// * oa: OTHER ADMIN bit.
type Permissions struct {
	OwnerU int8 `xml:"OWNER_U"`
	OwnerM int8 `xml:"OWNER_M"`
	OwnerA int8 `xml:"OWNER_A"`
	GroupU int8 `xml:"GROUP_U"`
	GroupM int8 `xml:"GROUP_M"`
	GroupA int8 `xml:"GROUP_A"`
	OtherU int8 `xml:"OTHER_U"`
	OtherM int8 `xml:"OTHER_M"`
	OtherA int8 `xml:"OTHER_A"`
}

var permStr = [8]string{"---", "--a", "-m-", "-ma", "u--", "u-a", "um-", "uma"}

// If a bit is set to -1, it will not change when calling Chmod
func (p *Permissions) ToArgs(id int) []interface{} {
	return []interface{}{
		id,
		p.OwnerU, p.OwnerM, p.OwnerA,
		p.GroupU, p.GroupM, p.GroupA,
		p.OtherU, p.OtherM, p.OtherA,
	}
{'fraction_non_alphanumeric': 0.1915089986155976, 'fraction_numerical': 0.010383017997231195, 'mean_word_length': 1.3445105462412115, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 18}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5994302', 'n_tokens_mistral': 1201, 'n_tokens_neox': 1140, 'n_words': 408}