[users] Handle detailed groups list
Groups can be specified with must_exist and/or system set, so they fill in the groups list more carefully.
This commit is contained in:
parent
a86374386b
commit
02e9872a99
@ -605,10 +605,13 @@ setConfigurationDefaultGroups( const QVariantMap& map, QList< GroupDescription >
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// By default give the user a handful of "traditional" groups, if
|
||||||
|
// none are specified at all. These are system (GID < 1000) groups.
|
||||||
cWarning() << "Using fallback groups. Please check *defaultGroups* value in users.conf";
|
cWarning() << "Using fallback groups. Please check *defaultGroups* value in users.conf";
|
||||||
for ( const auto& s : { "lp", "video", "network", "storage", "wheel", "audio" } )
|
for ( const auto& s : { "lp", "video", "network", "storage", "wheel", "audio" } )
|
||||||
{
|
{
|
||||||
defaultGroups.append( GroupDescription( s, GroupDescription::CreateIfNeeded{}, GroupDescription::SystemGroup{} ) );
|
defaultGroups.append(
|
||||||
|
GroupDescription( s, GroupDescription::CreateIfNeeded {}, GroupDescription::SystemGroup {} ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -620,6 +623,21 @@ setConfigurationDefaultGroups( const QVariantMap& map, QList< GroupDescription >
|
|||||||
{
|
{
|
||||||
defaultGroups.append( GroupDescription( v.toString() ) );
|
defaultGroups.append( GroupDescription( v.toString() ) );
|
||||||
}
|
}
|
||||||
|
else if ( v.type() == QVariant::Map )
|
||||||
|
{
|
||||||
|
const auto innermap = v.toMap();
|
||||||
|
QString name = CalamaresUtils::getString( innermap, "name" );
|
||||||
|
if ( !name.isEmpty() )
|
||||||
|
{
|
||||||
|
defaultGroups.append( GroupDescription( name,
|
||||||
|
CalamaresUtils::getBool( innermap, "must_exist", false ),
|
||||||
|
CalamaresUtils::getBool( innermap, "system", false ) ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cWarning() << "Ignoring *defaultGroups* entry without a name" << v;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cWarning() << "Unknown *defaultGroups* entry" << v;
|
cWarning() << "Unknown *defaultGroups* entry" << v;
|
||||||
|
@ -41,10 +41,18 @@ class GroupDescription
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// TODO: still too-weakly typed, add a macro to define strongly-typed bools
|
// TODO: still too-weakly typed, add a macro to define strongly-typed bools
|
||||||
class MustExist : public std::true_type {};
|
class MustExist : public std::true_type
|
||||||
class CreateIfNeeded : public std::false_type {};
|
{
|
||||||
class SystemGroup : public std::true_type {};
|
};
|
||||||
class UserGroup : public std::false_type {};
|
class CreateIfNeeded : public std::false_type
|
||||||
|
{
|
||||||
|
};
|
||||||
|
class SystemGroup : public std::true_type
|
||||||
|
{
|
||||||
|
};
|
||||||
|
class UserGroup : public std::false_type
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
///@brief An invalid, empty group
|
///@brief An invalid, empty group
|
||||||
GroupDescription() {}
|
GroupDescription() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user