project BLF > class BRole > method SaveRolePermissionsData
Description
Method to save the RoleResource data from Role Permissions form
Parameters
tRolePermissions | input | temp-table | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/brole.p)
/*this is a instance dependent method so the instance data is available*/
for each tRolePermissions where
tRolePermissions.tlChanged = true and
tRolePermissions.tcResourceURI > '' on error undo, throw:
find tRole where
tRole.Role_ID = tRolePermissions.tiRole_ID no-error.
if not available tRole
then next.
if tRolePermissions.tlRoleResourceLinked
then do :
/* NotLinked --> Linked */
find tRoleResource where
tRoleResource.tc_ParentRowid = tRole.tc_Rowid and
tRoleResource.Resource_ID = tRolePermissions.tiResource_ID no-error.
if available tRoleResource
then do:
if tRoleResource.tc_Status = "D"
then tRoleResource.tc_Status = "".
end.
else do:
<M-1 run AddDetailLine
(input 'RoleResource':U (icTable),
input tRole.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BRole>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
assign tRoleResource.tcResourceURI = tRolePermissions.tcResourceURI
tRoleResource.Resource_ID = tRolePermissions.tiResource_ID.
end.
end.
else do :
/* Linked --> NotLinked */
find tRoleResource where
tRoleResource.tc_ParentRowid = tRole.tc_Rowid and
tRoleResource.Resource_ID = tRolePermissions.tiResource_ID no-error.
if available tRoleResource
then if tRoleResource.tc_Status = "N"
then delete tRoleResource.
else assign tRoleResource.tc_Status = "D".
end.
end.
<M-2 run ValidateBC
(output viFcReturnSuper (oiReturnStatus)) in BRole>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-3 run AdditionalUpdates
(output viFcReturnSuper (oiReturnStatus)) in BRole>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-4 run DataSave
(output viFcReturnSuper (oiReturnStatus)) in BRole>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.