mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-28 03:04:15 +00:00
Add a NeedPrivilege($href,$privilege) to build an error response.
This commit is contained in:
parent
b76a9a6059
commit
fe2db77266
@ -1096,6 +1096,27 @@ EOSQL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a need-privileges error response. This function will never return.
|
||||
*
|
||||
* @param string $href The unconstructed URI where we needed the privilege.
|
||||
* @param string $privilege The name of the needed privilege.
|
||||
*/
|
||||
function NeedPrivilege( $href, $privilege ) {
|
||||
$reply = new XMLDocument();
|
||||
$xml = new XMLElement( 'need-privileges',
|
||||
new XMLElement( 'resource', array(
|
||||
$reply->href( ConstructURL($href) ),
|
||||
new XMLElement( 'privilege', $reply->NSElement( $privilege ) ),
|
||||
))
|
||||
);
|
||||
$xmldoc = $reply->Render('error',$xml);
|
||||
$this->DoResponse( $status, $xmldoc, 'text/xml; charset="utf-8"' );
|
||||
exit(0); // Unecessary, but might clarify things
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send an XML Response. This function will never return.
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user