[users] Move autologin and sudoers groups to Config
This commit is contained in:
parent
2f786079f3
commit
35916eb20f
@ -44,6 +44,31 @@ Config::setUserShell( const QString& shell )
|
|||||||
Calamares::JobQueue::instance()->globalStorage()->insert( "userShell", shell );
|
Calamares::JobQueue::instance()->globalStorage()->insert( "userShell", shell );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
setGS( const QString& key, const QString& group )
|
||||||
|
{
|
||||||
|
auto* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||||
|
if ( !gs || group.isEmpty() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gs->insert( key, group );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Config::setAutologinGroup( const QString& group )
|
||||||
|
{
|
||||||
|
setGS( QStringLiteral( "autologinGroup" ), group );
|
||||||
|
emit autologinGroupChanged( group );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Config::setSudoersGroup( const QString& group )
|
||||||
|
{
|
||||||
|
setGS( QStringLiteral( "sudoersGroup" ), group );
|
||||||
|
emit sudoersGroupChanged( group );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Config::setConfigurationMap( const QVariantMap& configurationMap )
|
Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
@ -55,4 +80,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
}
|
}
|
||||||
// Now it might be explicitly set to empty, which is ok
|
// Now it might be explicitly set to empty, which is ok
|
||||||
setUserShell( shell );
|
setUserShell( shell );
|
||||||
|
|
||||||
|
setAutologinGroup( CalamaresUtils::getString( configurationMap, "autologinGroup" ) );
|
||||||
|
setSudoersGroup( CalamaresUtils::getString( configurationMap, "sudoersGroup" ) );
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,9 @@ class Config : public QObject
|
|||||||
|
|
||||||
Q_PROPERTY( QString userShell READ userShell WRITE setUserShell NOTIFY userShellChanged )
|
Q_PROPERTY( QString userShell READ userShell WRITE setUserShell NOTIFY userShellChanged )
|
||||||
|
|
||||||
|
Q_PROPERTY( QString autologinGroup READ autologinGroup WRITE setAutologinGroup NOTIFY autologinGroupChanged )
|
||||||
|
Q_PROPERTY( QString sudoersGroup READ sudoersGroup WRITE setSudoersGroup NOTIFY sudoersGroupChanged )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Config( QObject* parent = nullptr );
|
Config( QObject* parent = nullptr );
|
||||||
~Config();
|
~Config();
|
||||||
@ -43,6 +46,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
QString userShell() const { return m_userShell; }
|
QString userShell() const { return m_userShell; }
|
||||||
|
|
||||||
|
/// The group of which auto-login users must be a member
|
||||||
|
QString autologinGroup() const { return m_autologinGroup; }
|
||||||
|
/// The group of which users who can "sudo" must be a member
|
||||||
|
QString sudoersGroup() const { return m_sudoersGroup; }
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/** @brief Sets the user's shell if possible
|
/** @brief Sets the user's shell if possible
|
||||||
*
|
*
|
||||||
@ -54,11 +62,20 @@ public Q_SLOTS:
|
|||||||
*/
|
*/
|
||||||
void setUserShell( const QString& path );
|
void setUserShell( const QString& path );
|
||||||
|
|
||||||
|
/// Sets the autologin group; empty is ignored
|
||||||
|
void setAutologinGroup( const QString& group );
|
||||||
|
/// Sets the sudoer group; empty is ignored
|
||||||
|
void setSudoersGroup( const QString& group );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void userShellChanged( const QString& );
|
void userShellChanged( const QString& );
|
||||||
|
void autologinGroupChanged( const QString& );
|
||||||
|
void sudoersGroupChanged( const QString& );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_userShell;
|
QString m_userShell;
|
||||||
|
QString m_autologinGroup;
|
||||||
|
QString m_sudoersGroup;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -174,20 +174,6 @@ UsersViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
m_defaultGroups = QStringList { "lp", "video", "network", "storage", "wheel", "audio" };
|
m_defaultGroups = QStringList { "lp", "video", "network", "storage", "wheel", "audio" };
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( configurationMap.contains( "autologinGroup" )
|
|
||||||
&& configurationMap.value( "autologinGroup" ).type() == QVariant::String )
|
|
||||||
{
|
|
||||||
Calamares::JobQueue::instance()->globalStorage()->insert(
|
|
||||||
"autologinGroup", configurationMap.value( "autologinGroup" ).toString() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "sudoersGroup" )
|
|
||||||
&& configurationMap.value( "sudoersGroup" ).type() == QVariant::String )
|
|
||||||
{
|
|
||||||
Calamares::JobQueue::instance()->globalStorage()->insert( "sudoersGroup",
|
|
||||||
configurationMap.value( "sudoersGroup" ).toString() );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setRootPassword = getBool( configurationMap, "setRootPassword", true );
|
bool setRootPassword = getBool( configurationMap, "setRootPassword", true );
|
||||||
Calamares::JobQueue::instance()->globalStorage()->insert( "setRootPassword", setRootPassword );
|
Calamares::JobQueue::instance()->globalStorage()->insert( "setRootPassword", setRootPassword );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user