ContentAuthorizorBase Class Methods
In this section, the ContentAuthorizorBase class methods are presented in alphabetical order.
Syntax
Authorize(&TheStorageGroup, &TheNormalizePath, &TheUserId
Description
The Authorize method is an abstract method. Application developers need to implement this method in their own authentication class. You can write authorization logic in this method.
Parameters
|
Field or Control |
Definition |
|---|---|
| &TheStorageGroup |
Specifies the storage group name as a string value. |
| &TheNormalizePath |
Specifies the normalized folder path as a string value. |
| &TheUserId |
Specifies the user ID as a string value. |
Returns
None.
Example
import PTPP_SG:ContentAuthorizorBase;
class ELMAuthClass extends PTPP_SG:ContentAuthorizorBase
method Authorize(&TheStorageGroup As string, &TheNormalizePath As string, &TheUserId As string);
end-class;
method Authorize
Local string &path, &sgName;
Local string &userAccess;
Local string &cmd;
Local integer &duration = 60;
&path = &TheNormalizePath;
&sgName = &TheStorageGroup;
If (All(&sgName) And
All(&path)) Then
SQLExec("select course_access from ps_course_access where ptpp_sg_name=:1 and course_folder=:2 and course_user=:3", &sgName, &path, &TheUserId, &userAccess);
Else
%Response.Write("Please specify storage group name and path.");
End-If;
Evaluate &userAccess
When = "1"
&cmd = %This.DENY;
Break;
When = "2"
&cmd = %This.ALLOW_DIRECTORY;
Break;
When = "3"
&cmd = %This.ALLOW_SUBDIR;
Break;
When-Other
&cmd = %This.DENY;
End-Evaluate;
%This.SetResponse(&cmd, &duration);
end-method;
Syntax
SetResponse(&Cmd, &ValidDuration)
Description
Use the SetResponse method to set the authorization result and the time duration (in seconds).
Parameters
|
Field or Control |
Definition |
|---|---|
| &Cmd |
Specifies the authorization result as a fixed string value.
|
| &ValidDuration |
Specifies the time duration as an integer value. This is an optional parameter. The default value is 300 seconds. |
Returns
None.
Example
%This.SetResponse(%This.DENY, 60);