user/group.go
func DelUsersInGroup(name string, members ...string) error {
	if len(members) == 0 {
		return ErrNoMembers
	}
	for i, v := range members {
		if v == "" {
			return EmptyMemberError(fmt.Sprintf("members[%s]", strconv.Itoa(i)))
		}
	}

	// Group
	gr, err := LookupGroup(name)
	if err != nil {
		return err
	}
	if err = _delMembers(&gr.UserList, members...); err != nil {
		return err
	}

	// Shadow group
	sg, err := LookupGShadow(name)
	if err != nil {
		return err
	}
	if err = _delMembers(&sg.UserList, members...); err != nil {
		return err
	}

	// Editing
	if err = edit(name, gr); err != nil {
		return err
	}
	if err = edit(name, sg); err != nil {
		return err
	}

	return nil
}
func DelUsersInGroup(name string, members ...string) error {
	if len(members) == 0 {
		return ErrNoMembers
	}
	for i, v := range members {
		if v == "" {
			return EmptyMemberError(fmt.Sprintf("members[%s]", strconv.Itoa(i)))
		}
	}

	// Group
	gr, err := LookupGroup(name)
	if err != nil {
		return err
	}
	if err = _delMembers(&gr.UserList, members...); err != nil {
		return err
	}

	// Shadow group
	sg, err := LookupGShadow(name)
	if err != nil {
		return err
	}
	if err = _delMembers(&sg.UserList, members...); err != nil {
		return err
	}

	// Editing
	if err = edit(name, gr); err != nil {
		return err
	}
	if err = edit(name, sg); err != nil {
		return err
	}

	return nil
}
func DelUsersInGroup ( name string , members ... string ) error { if len ( members ) == 0 { return ErrNoMembers } for i , v := range members { if v == " " { return EmptyMemberError ( fmt . Sprintf ( " " , strconv . Itoa ( i ) ) ) } } // Group gr , err := LookupGroup ( name ) if err != nil { return err } if err = _delMembers ( & gr . UserList , members ... ) ; err != nil { return err } // Shadow group sg , err := LookupGShadow ( name ) if err != nil { return err } if err = _delMembers ( & sg . UserList , members ... ) ; err != nil { return err } // Editing if err = edit ( name , gr ) ; err != nil { return err } if err = edit ( name , sg ) ; err != nil { return err } return nil }
// DelUsersInGroup removes the specific members from a group.
DelUsersInGroup removes the specific members from a group .