Authorize method: ContentAuthorizorBase class

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

Parameter Description

&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;