I was wondering if there was a way to get the current permissions for a person when the hiy a connectivity page?
ex: if user_perm['edit'] == TRUE
then { do stuff }
Also I was wondering if there is a way to reference both the user's Display name and their unique Joomla ID in a page?
Thanks in advance!
- Eric
ex: if user_perm['edit'] == TRUE
then { do stuff }
Also I was wondering if there is a way to reference both the user's Display name and their unique Joomla ID in a page?
Thanks in advance!
- Eric
Hi Eric,
Second question first. You can get user info from the Joomla User object
First question - please try $authedit, $authnew and $authdelete e.g.
Bob
Second question first. You can get user info from the Joomla User object
<?php
$user =& JFactory::getUser();
$user_id = $user->id;
$user_name = $user->name;
. . .
?>
There's a full list of values in the JUser apiFirst question - please try $authedit, $authnew and $authdelete e.g.
<?php
if ( $authedit ) {
//do stuff
}
?>
This seems to have worked for me in the previous release.Bob
Hi Eric & Bob,
Hi-jacked this piece of code from the CC v2RC source (for deleting a record):
Given the new, more flexible permissions in v2.0, this seems like a better approach to checking permissions. Checking database records, the available permissions would seem to be 'delete', 'edit', and 'new' for checkPermissions(), and 'delete' and 'edit' for checkRowPermissions().
/Fredrik
Hi-jacked this piece of code from the CC v2RC source (for deleting a record):
$MyConnection =& CFChronoConnection::getInstance($connectionname);
$MyPermissions =& CFChronoConnectionPermissions::getInstance($MyConnection->connectionrow->id);
...
if(!$MyPermissions->checkPermissions('delete')){
echo "You are not authorized to view this page";
return;
}
if(!$MyPermissions->checkRowPermissions('delete', $cids)){
echo "You are not authorized to view this page";
return;
}
Given the new, more flexible permissions in v2.0, this seems like a better approach to checking permissions. Checking database records, the available permissions would seem to be 'delete', 'edit', and 'new' for checkPermissions(), and 'delete' and 'edit' for checkRowPermissions().
/Fredrik
Thankyou both of you, this I was able to make what I was working on
As for the User Information that was also very helpful but I don't have as useful of a snippet to post here ;P
- Eric
$MyConnection =& CFChronoConnection::getInstance($connectionname);
$MyPermissions =& CFChronoConnectionPermissions::getInstance($MyConnection->connectionrow->id);
<?php
if($MyPermissions->checkPermissions('delete'))
{
//&task=deleterecord&cids=77
$MyURL = explode("/", jRequest::getURI());
$MyLink = $MyURL[count($MyURL) - 1];
?>
<a href="<?php echo $MyLink . "&task=deleterecord&cids=" . $MyRow->cf_id; ?>"
onclick="return confirm('Confirm delete?');">Delete Record</a>
<?php } ?>
As for the User Information that was also very helpful but I don't have as useful of a snippet to post here ;P
- Eric
This topic is locked and no more replies can be posted.