Difference: TWikiFuncDotPm (7 vs. 8)

Revision 803 Aug 2008 - Main.TWikiContributor

Line: 390 to 390
 

getCanonicalUserID( $user ) -> $cUID

Added:
>
>
  • $user can be a login, wikiname or web.wikiname
 Return the cUID of the specified user. A cUID is a unique identifier which is assigned by TWiki for each user. BEWARE: While the default TWikiUserMapping? uses a cUID that looks like a user's LoginName, some characters are modified to make them compatible with rcs.
Changed:
<
<
Additionally, other usermappings will use other conventions - the JoomlauserMapping?
>
>
Other usermappings may use other conventions - the JoomlaUserMapping
 for example, has cUIDs like 'JoomlaeUserMapping_1234'.

Changed:
<
<
If $user is undefined Get the cUID of logged in user, and will generally be 'BaseUserMapping_666'
>
>
If $user is undefined, it assumes the currently logged-in user.
 
Changed:
<
<
  • $user can be a cUID, login, wikiname or web.wikiname

Return: $cUID an internal unique and transportable escaped identifier for registered users (they can be autogenerated for an authenticated but unregistered user)

>
>
Return: $cUID, an internal unique and portable escaped identifier for registered users. This may be autogenerated for an authenticated but unregistered user.
  Since: TWiki::Plugins::VERSION 1.2
Line: 433 to 431
 Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)
Changed:
<
<

wikiToUserName( $wikiName ) -> $loginName

Translate a Wiki name (or login name or cUID, if it can) to a login name.
  • $wikiName - Wiki name, e.g. 'Main.JohnDoe' or 'JohnDoe'
>
>

wikiToUserName( $id ) -> $loginName

Translate a Wiki name to a login name.
  • $id - Wiki name, e.g. 'Main.JohnDoe' or 'JohnDoe'. Since TWiki 4.2.1, $id may also be a login name. This will normally be transparent, but should be borne in mind if you have login names that are also legal wiki names.
 Return: $loginName Login name of user, e.g. 'jdoe', or undef if not matched.
Line: 450 to 452
 

userToWikiName( $loginName, $dontAddWeb ) -> $wikiName

Translate a login name to a Wiki name
Changed:
<
<
  • $loginName - Login name, e.g. 'jdoe'
>
>
  • $loginName - Login name, e.g. 'jdoe'. Since TWiki 4.2.1 this may also be a wiki name. This will normally be transparent, but may be relevant if you have login names that are also valid wiki names.
 
  • $dontAddWeb - Do not add web prefix if "1"
Return: $wikiName Wiki name of user, e.g. 'Main.JohnDoe' or 'JohnDoe'
Changed:
<
<
userToWikiName will always return a name, if the user does not
>
>
userToWikiName will always return a name. If the user does not
 exist in the mapping, the $loginName parameter is returned. (backward compatibility)

Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)

Line: 470 to 474
 Since: TWiki::Plugins::VERSION 1.2
Changed:
<
<

wikiNameToEmails( $wikiname ) -> @emails

  • $wikiname - wikiname of user to look up
Returns the registered email addresses of the named user. If $wikiname is
>
>

wikinameToEmails( $user ) -> @emails

  • $user - wikiname of user to look up
Returns the registered email addresses of the named user. If $user is
 undef, returns the registered email addresses for the logged-in user.
Added:
>
>
Since TWiki 4.2.1, $user may also be a login name, or the name of a group.
 Since: TWiki::Plugins::VERSION 1.2
Line: 485 to 491
 Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)
Changed:
<
<

isAnAdmin( $login ) -> $boolean

>
>

isAnAdmin( $id ) -> $boolean

  Find out if the user is an admin or not. If the user is not given, the currently logged-in user is assumed.
Changed:
<
<
  • $login can be either a login, or a CUID
>
>
  • $id can be either a login name or a WikiName
  Since: TWiki::Plugins::VERSION 1.2
Changed:
<
<

isGroupMember( $group, $login ) -> $boolean

>
>

isGroupMember( $group, $id ) -> $boolean

 
Changed:
<
<
Find out if $login is in the named group. e.g.
>
>
Find out if $id is in the named group. e.g.
 
if( TWiki::Func::isGroupMember( "HesperionXXGroup", "jordi" )) {
    ...
Line: 504 to 510
  If $user is undef, it defaults to the currently logged-in user.
Changed:
<
<
  • $login can be a login name, or a cUID, or WikiName
>
>
  Since: TWiki::Plugins::VERSION 1.2
Line: 527 to 533
 Since: TWiki::Plugins::VERSION 1.2
Changed:
<
<

eachMembership($wikiname) -> $iterator

>
>

eachMembership($id) -> $iterator

  • $id - WikiName or login name of the user. If $id is undef, defaults to the currently logged-in user.
 Get an iterator over the names of all groups that the user is a member of.
Deleted:
<
<
If $wikiname is undef, defaults to the currently logged-in user.
  Since: TWiki::Plugins::VERSION 1.2
Line: 574 to 581
 Since: TWiki::Plugins::VERSION 1.2
Changed:
<
<

checkAccessPermission( $type, $wikiName, $text, $topic, $web, $meta ) -> $boolean

>
>

checkAccessPermission( $type, $id, $text, $topic, $web, $meta ) -> $boolean

  Check access permission for a topic based on the TWiki.TWikiAccessControl rules
  • $type - Access type, required, e.g. 'VIEW', 'CHANGE'.
Changed:
<
<
  • $wikiName - WikiName of remote user, required, e.g. "PeterThoeny". If $wikiName is '', 0 or undef then access is always permitted.
>
>
  • $id - WikiName of remote user, required, e.g. "PeterThoeny". From TWiki 4.2.1, $id may also be a login name. If $id is '', 0 or undef then access is always permitted.
 
  • $text - Topic text, optional. If 'perl false' (undef, 0 or ''), topic $web.$topic is consulted. $text may optionally contain embedded %META:PREFERENCE tags. Provide this parameter if:
Line: 598 to 606
  Settings in $meta override Set settings in $text. A perl true result indicates that access is permitted.
Changed:
<
<
Note the wierd parameter order is due to compatibility constraints with
>
>
Note the weird parameter order is due to compatibility constraints with
 earlier TWiki releases.

Tip if you want, you can use this method to check your own access control types. For example, if you:

Line: 708 to 716
 
    my $iterator = TWiki::Func::eachChangeSince(
        $web, time() - 7 * 24 * 60 * 60); # the last 7 days
Changed:
<
<
while ($it->hasNext()) { my $change = $it->next();
>
>
while ($iterator->hasNext()) { my $change = $iterator->next();
  # $change is a perl hash that contains the following fields: # topic => topic name # user => wikiname - wikiname of user who made the change
Line: 779 to 787
 
  • \%options - ref to hash of save options \%options may include:
    dontlog don't log this change in twiki log
Changed:
<
<
comment comment for save
>
>
forcenewrevision force the save to increment the revision counter
 
minor True if this is a minor change, and is not to be notified
Return: error message or undef.
Line: 789 to 797
 
my( $meta, $text ) = TWiki::Func::readTopic( $web, $topic )
$text =~ s/APPLE/ORANGE/g;
Changed:
<
<
TWiki::Func::saveTopic( $web, $topic, $meta, $text, { comment => 'refruited' } );
>
>
TWiki::Func::saveTopic( $web, $topic, $meta, $text, { forcenewrevision => 1 } );
 

Note: Plugins handlers ( e.g. beforeSaveHandler ) will be called as

Line: 903 to 911
 fully documented in the source code documentation shipped with the release, or can be inspected in the lib/TWiki/Meta.pm file.
Changed:
<
<
This method ignores topic access permissions. You should be careful to use checkAccessPermissions to ensure the current user has read access to the topic.
>
>
This method ignores topic access permissions. You should be careful to use checkAccessPermissions to ensure the current user has read access to the topic.
  Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)
Line: 1209 to 1219
 

wikiToEmail( $wikiName ) -> $email

Changed:
<
<
  • $wikiName - wiki name of the user
>
>
  • $wikiname - wiki name of the user
 Get the e-mail address(es) of the named user. If the user has multiple e-mail addresses (for example, the user is a group), then the list will be comma-separated.

Since: TWiki::Plugins::VERSION 1.1

Added:
>
>
Deprecated in favour of wikinameToEmails, because this function only returns a single email address, where a user may in fact have several.

Since TWiki 4.2.1, $wikiName may also be a login name.

 

Creating New Topics

 
This site is powered by the TWiki collaboration platformCopyright � by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiFuncDotPm