YaST2 Developers Documentation: UserSettings.ycp



functions
files
intro

UserSettings.ycp

  • Johannes Buchhold <jbuch@suse.de>
  • Purpose: Handle all settings from the files
  • /etc/passwd
  • /etc/shadow
  • /etc/gshadow
  • /etc/groups

Imports

  • Mode
  • UserAddDefs
  • UserDefs

Includes

  • users/passwd.ycp
  • users/ui.ycp

Variables

Functions

global ReadGshadowFromDisk () -> boolean

Read the file /etc/gshadow and save it to the list current_gshadow.

Return value:
true if success

global ReadPasswdFromDisk () -> boolean

Read the file /etc/passwd and save it to the map current_users.

Return value:
true if success

global ReadGroupFromDisk () -> boolean

Read the file /etc/group and save it to the map current_groups.

Return value:
true is success

global ReadShadowFromDisk () -> boolean

Read the file /etc/shadow and save it to the list current_shadow.

Return value:
true if success

global ReadConfigurationType (boolean interactive) -> boolean

If we can ask and are a NIS server, ask which set of users to administer and set UserWriteStack accordingly.

Parameters:
interactive true if can ask user via popup
Return value:
success?

global ReadSettingsFromDisk (boolean interactive) -> boolean

Read all users and groups settings.

Parameters:
interactive true if can ask user via popup
Return value:
success?

global GetGid (string groupname) -> integer

Get group id

Parameters:
groupname string group name
Return value:
gid

global GetUid (string username) -> integer

Get iser id

Parameters:
username string user name
Return value:
uid

global DeleteGroupFromShadow (string groupname) -> void

Delete the group with groupname from current_gshadow.

Parameters:
groupname name of the group

global GetGroupFromShadow (string groupname) -> map

Return the group with groupname from current_gshadow.

Parameters:
groupname name of the group
Return value:
gshadow entry

global FindGroupsBelongUser (string username) -> string

This define returns the groups of a user.

Parameters:
username the name of the user
Return value:
group comma separated list

global FindGroupsBelongUserHint (string username, map groups_by_users) -> string

This define returns the additional groups of a user. It is just a compatibility wrapper to make use of SortGroupsByUsers

Parameters:
username the name of the user
groups_by_users the result of SortGroupsByUsers
Return value:
group comma separated list

global SortGroupsByUsers () -> map

Sorts current_groups according to additional users they contain. FIXME: how about group["todo"] == `delete?

Return value:
keys: user names (not all of them), values: lists of group names

global GroupString2groupList (string str_grouplist) -> list

Split string of groups - estimation of behaviour

Parameters:
str_grouplist string list of groups
Return value:
of groups

global SortUsersByPrimaryGroup () -> map

Sorts current_users according to their primary group. This avoids calling FindUsersBelongGroup for each group (yuck). FIXME: how about user["todo"] == `delete?

Return value:
keys: gids (not all of them), values: lists of uids

global FindUsersBelongGroupHint (map group, map primary_users) -> string

Return a comma separated list of users belonging to a group. This is an optimized version of FindUsersBelongGroup for use in GroupsRead.

Parameters:
group a member of current_groups
primary_users the hint, mapping gids to lists of uids
Return value:
sorted, uniq'd, comma separated list of user names

global FindUsersBelongGroup (integer gid, symbol what) -> any

This define returns the users of a group. This is used in usersGroupRead and usersEditGroup.

Parameters:
gid integer group id
what `string or `list
Return value:
a list of users (as a string or a list of terms)

global GroupIdToName (integer Id) -> string

Return the groupname of a group.

Parameters:
Id the group gid
Return value:
groupname

global UserIdToName (integer Id) -> string

Return the username of a user.

Parameters:
Id the user uid
Return value:
username

global GroupsRead (symbol todo, boolean view_all_groups) -> list

Convert the map current_groups to a list

Parameters:
todo specify the variant of the output list `items = build a item list for the group table `groupnamelist = list with all groupnames
view_all_groups boolean true = add all groups to the output list false = add only groups with gid > max_system_gid
Return value:
of groups/items

global UsersByName () -> map

Return map for mapping user names to UIDs

Return value:
mapping

global patchUsers () -> void

patch list of groups for each user to it's structure

global UsersRead (symbol todo, boolean view_all_users) -> list

Convert the map current_users to a list.

Parameters:
todo specify the variant of the output list `items = build a item list for the user table `usernamelist = list with all usernames `homelist = list with all homes
view_all_users boolean true = add all users to the output list false = add only users with uid > max_system_uid
Return value:
of users/items

global NextFreeUid () -> integer

Scan usersettings for the next free uid.

Return value:
free uid

global NextFreeGid () -> integer

Scan the groupsettings the next free gid.

Return value:
free gid

global GetUser (integer uid) -> map

Return the settings for a user.

Parameters:
uid the user id
Return value:
of user

global DelUser (integer uid) -> void

Delete user

Parameters:
uid the user id

global GetGroup (integer gid) -> map

Return the settings for a group.

Parameters:
gid the group id
Return value:
of group

global SetUser (integer uid, map user) -> void

Update the settings for a user.

Parameters:
uid the user id
user the new settings for the user

global SetGroup (integer gid, map group) -> void

Update the settings for a group.

Parameters:
gid the group id
group the new settings for the group

global DelGroup (integer gid) -> void

Delete group

Parameters:
gid integer group id

global SetGroupname (integer gid, string groupname) -> boolean

Set group name for group specified by GID

Parameters:
gid integer group id
groupname string new name for group
Return value:
true if success

global GetGroupname (integer gid) -> string

Get group name for group id

Parameters:
gid integer group id
Return value:
strign group name

global SetUserlist (integer gid, string userlist) -> boolean

Set list of users having additional membership for specified group

Parameters:
gid integer group id
userlist string comma separated list of users
Return value:
true if success

global GetUserlist (integer gid) -> string

Get list of users having additional membership for specified group

Parameters:
gid integer group id
Return value:
comma separated list of users

global AddGshadowEntry (map gshadow) -> void

Add a group password entry.

Parameters:
gshadow new entry for gshadow

local getGroupPassword (string groupname) -> string

Return the group password if the group have a password ( use current_gshadow ).

Parameters:
groupname name of the group
Return value:
/nil group password

local consoleUncoding (string fullname) -> string

Uncode the fullname.

Parameters:
fullname fullname of the user
Return value:
recoded fullname

local addBlanks (integer count) -> string

Build a string with n blanks

Parameters:
count number of blanks
Return value:
of blanks

global BackupConfFiles () -> void

Backup /etc/passwd, shadow, group and gshadow files

global ChangeUserNameInGroups (string old_username, string username) -> boolean

Change the username in current_groups.

Parameters:
old_username the old username
username the new username
Return value:
true if success

global ChangeUserlistInGroups (string username, string grouplist) -> boolean

Change the userlist in current_groups. Add and remove entries form the userlist

Parameters:
username the name of the changed user
grouplist the new grouplist of the changed user
Return value:
true if succeses

global DelUserFromAllGroups (string username) -> void

delete the user from the map current_groups (userlist)

Parameters:
username string username

global RemoveDefaultUserFromUserlist (integer old_gid, list split_userlist) -> string

Remove all users from the userlist with a default group (gid) that is part of the userlist.

Parameters:
old_gid the gid
split_userlist the userlist
Return value:
new users list

global ChangeGid (integer old_gid, integer gid, map current_group) -> void

Change the group id and the content of a group.

Parameters:
old_gid the old group id
gid the new group id
current_group the new entry for the new group id

global Test () -> void

Test function

global isNisMaster () -> boolean

Check whether host is NIS master

Return value:
true if is master

local progress_enabled -> boolean

If false, the Progress* functions do nothing.


YaST2 Developers Documentation