13.6 VolumeRestriction Object

Gives the volume restriction information for a specified object.

13.6.1 Name property

Gives the name of the object for which the space restriction is defined.

Syntax

object.Name

Type

String.

Attributes

Read-only.

Example

See sample in Example

13.6.2 Restriction property

Gives the number of blocks the object can use.

Syntax

object.Restriction

Type

Integer.

Attributes

Read-only.

Remarks

If this property is non-zero, the object has a space restriction. Otherwise, the object has no space restriction.

Example

See sample in Example

13.6.3 Usage property

Gives the number of blocks the object is currently using.

Syntax

object.Usage

Type

Long.

Attributes

Read-only.

Example

See sample in Example

13.6.4 VolumeLimit property

Provides information about the amount of space an object is allowed to use on a volume.

Syntax

object.VolumeLimit

Type

String/Integer.

Attributes

Read-only.

Remarks

The value returned by this property is the number of blocks the object can use on the mounted volume. The size of each block is 4 KB. If there is no space restriction, this property will return the string "Unlimited."

Example

This sample provides all information about the amount of space TestUser is allowed to use on volume Sys.

On Error Resume Next
Set volmgr = CreateObject ("UCX:VolumeMgr") 
Set volumes = volmgr.volumes 
Set volume = Volumes.Element("Sys") 
If (Err.Number=0) then
   Set RestrictionsObj=volume.GetSpaceRestriction()
   If (Err.Number=0) then
      Set restr = RestrictionsObj.Element("Testuser")
      If(Err.Number=0) then
        Print "The number of restriction blocks for
 "&restr.Name & " is "&restr.Restriction
        Print"The number of blocks currently in use for
 "&restr.Name &" is "&restr.Usage
        Print "The amount of space allowed for " &restr.Name
 &" is "&restr.VolumeLimit
      Else 
        Print "Failed to find restriction for the specified
user "&Err.Description
      Endif
   Else
      Print "Failed to get restrictions object
"&Err.Description
   Endif
Else 
   Print "Failed to find the volume "&Err.Description
Endif

13.6.5 RemoveSpaceRestriction method

Removes the volume space restriction for a specified user on the mounted volume.

Syntax

object.RemoveSpaceRestriction()

Parameters

None.

Return Values

Boolean. Returns TRUE if successful; otherwise, FALSE.

Example

This example removes the volume space restriction for TestUser on volume Sys.

Set nds1 = CreateObject ("UCX:"NWDir")
’Log in to an account with supervisory rights
nds1.Login("username","password")
If (Err.Number=0) then
’Get all information about Sys
   Set volmgr=CreateObject("UCX:VolumeMgr")
   Set vols=volmgr.volumes
   Set volume = Vols.Element("Sys")
   Set restns = volume.GetSpaceRestriction()
     If (Err.Number=0)then
        Set restr = Restns.Element("testuser")
        If (Err.Number=0) then
           Restr.RemoveSpaceRestriction()
           If (Err.Number=0) then
               Print "Restriction removed successfully"
           Else
               Print "Failed to remove restriction "
&Err.Description
           Endif
        Else
           Print "Could not remove the restriction
"&Err.description
        Endif 
     Else 
        Print "GetSpaceRestriction failed - "&Err.Description
     Endif 
     nds1.Logout()
Else 
     Print("Login failed") 
Endif

13.6.6 SetSpaceRestriction Method

Sets the volume space restriction for a specified user on the mounted volume.

Syntax

object.SetSpaceRestriction( 
   Value As Long)

Parameters

Value

Long. The volume space restriction value to be set for the user.

Return Values

Boolean. Returns TRUE if successful; otherwise, FALSE.

Example

This example sets the space restriction for TestUser on volume Sys.

Set nds1 = CreateObject ("UCX:NWDir")
’Log in to an account with supervisory rights
nds1.login("username","password")
If (Err.Number=0) then
’Get all information about Sys
   Set volmgr = CreateObject("UCX:VolumeMgr")
   Set vols = volmgr.volumes
   Set volume = Vols.Element("Sys")
   Set restns = volume.GetSpaceRestriction()
   If (Err.Number=0) Then
      Set restr = Restns.Element("Testuser")
      If (Err.Number=0) Then
         Restr.SetSpaceRestriction(1024)
         If (Err.Number=0) then
            Print "Restriction set successfully"
         Else
            Print "Failed to set restriction "&Err.Description
         Endif 
      Else
         Print "Could not set the restriction object "
&Err.description
      Endif
   Else
      Print "GetSpaceRestriction failed - "&Err.Description
   Endif 
   nds1.Logout()
Else 
   Print "Login failed"
Endif