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
- AddGshadowEntry (map gshadow)
- BackupConfFiles ()
- ChangeGid (integer old_gid, integer gid, map current_group)
- ChangeUserNameInGroups (string old_username, string username)
- ChangeUserlistInGroups (string username, string grouplist)
- DelGroup (integer gid)
- DelUser (integer uid)
- DelUserFromAllGroups (string username)
- DeleteGroupFromShadow (string groupname)
- FindGroupsBelongUser (string username)
- FindGroupsBelongUserHint (string username, map groups_by_users)
- FindUsersBelongGroup (integer gid, symbol what)
- FindUsersBelongGroupHint (map group, map primary_users)
- GetGid (string groupname)
- GetGroup (integer gid)
- GetGroupFromShadow (string groupname)
- GetGroupname (integer gid)
- GetUid (string username)
- GetUser (integer uid)
- GetUserlist (integer gid)
- GroupIdToName (integer Id)
- GroupString2groupList (string str_grouplist)
- GroupsRead (symbol todo, boolean view_all_groups)
- NextFreeGid ()
- NextFreeUid ()
- ReadConfigurationType (boolean interactive)
- ReadGroupFromDisk ()
- ReadGshadowFromDisk ()
- ReadPasswdFromDisk ()
- ReadSettingsFromDisk (boolean interactive)
- ReadShadowFromDisk ()
- RemoveDefaultUserFromUserlist (integer old_gid, list split_userlist)
- SetGroup (integer gid, map group)
- SetGroupname (integer gid, string groupname)
- SetUser (integer uid, map user)
- SetUserlist (integer gid, string userlist)
- SortGroupsByUsers ()
- SortUsersByPrimaryGroup ()
- Test ()
- UserIdToName (integer Id)
- UsersByName ()
- UsersRead (symbol todo, boolean view_all_users)
- addBlanks (integer count)
- consoleUncoding (string fullname)
- getGroupPassword (string groupname)
- isNisMaster ()
- patchUsers ()
|
|
|
|
global ReadGshadowFromDisk () -> boolean
|
|
Read the file /etc/gshadow and save it to the list current_gshadow.
- Return value:
|
global ReadPasswdFromDisk () -> boolean
|
|
Read the file /etc/passwd and save it to the map current_users.
- Return value:
|
global ReadGroupFromDisk () -> boolean
|
|
Read the file /etc/group and save it to the map current_groups.
- Return value:
|
global ReadShadowFromDisk () -> boolean
|
|
Read the file /etc/shadow and save it to the list current_shadow.
- Return value:
|
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:
|
global ReadSettingsFromDisk (boolean interactive) -> boolean
|
|
Read all users and groups settings.
- Parameters:
|
interactive |
true if can ask user via popup |
- Return value:
|
global GetGid (string groupname) -> integer
|
|
Get group id
- Parameters:
|
groupname |
string group name |
- Return value:
|
global GetUid (string username) -> integer
|
|
Get iser id
- Parameters:
|
username |
string user name |
- Return value:
|
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:
|
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:
|
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:
- Return value:
|
global UserIdToName (integer Id) -> string
|
|
Return the username of a user.
- Parameters:
- Return value:
|
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:
|
global UsersByName () -> map
|
|
Return map for mapping user names to UIDs
- Return value:
|
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:
|
global NextFreeUid () -> integer
|
|
Scan usersettings for the next free uid.
- Return value:
|
global NextFreeGid () -> integer
|
|
Scan the groupsettings the next free gid.
- Return value:
|
global GetUser (integer uid) -> map
|
|
Return the settings for a user.
- Parameters:
- Return value:
|
global DelUser (integer uid) -> void
|
|
Delete user
- Parameters:
|
global GetGroup (integer gid) -> map
|
|
Return the settings for a group.
- Parameters:
- Return value:
|
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:
|
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:
|
global GetGroupname (integer gid) -> string
|
|
Get group name for group id
- Parameters:
- Return value:
|
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:
|
global GetUserlist (integer gid) -> string
|
|
Get list of users having additional membership for specified group
- Parameters:
- 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:
|
local consoleUncoding (string fullname) -> string
|
|
Uncode the fullname.
- Parameters:
|
fullname |
fullname of the user |
- Return value:
|
local addBlanks (integer count) -> string
|
|
Build a string with n blanks
- Parameters:
- Return value:
|
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:
|
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:
|
global DelUserFromAllGroups (string username) -> void
|
|
delete the user from the map current_groups (userlist)
- Parameters:
|
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:
|
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 |
Test function
|
global isNisMaster () -> boolean
|
|
Check whether host is NIS master
- Return value:
|
local progress_enabled -> boolean
|
|
If false, the Progress* functions do nothing.
|