<cffunction
name="CheckPermissions"
access="public"
returntype="boolean"
output="false"
hint="I return a boolean flag as to whether or not the user can perform the given action.">
<cfargument
name="User"
type="any"
required="true"
hint="I am the user in question."
/>
<cfargument
name="Action"
type="string"
required="true"
hint="I am the action being performed."
/>
<cfargument
name="Target"
type="any"
required="true"
hint="I am the target object upon which the action is being performed."
/>
<cfswitch expression="#ARGUMENTS.Action#">
<cfcase value="do">
<cfreturn true />
</cfcase>
<cfcase value="delete">
<cfswitch expression="#ListLast( GetMetaData( ARGUMENTS.Target ).Name, '.' )#">
<cfcase value="PhotoGallery">
<cfif (
ARGUMENTS.Target.GetID() AND
(
NOT (
(NOT IsSimpleValue( ARGUMENTS.Target.GetUser() )) AND
(ARGUMENTS.Target.GetUser().GetID() EQ ARGUMENTS.User.GetID())
)
))>
<cfreturn false />
</cfif>
</cfcase>
</cfswitch>
</cfcase>
<cfcase value="edit">
<cfswitch expression="#ListLast( GetMetaData( ARGUMENTS.Target ).Name, '.' )#">
<cfcase value="PhotoGallery">
<cfif (
ARGUMENTS.Target.GetID() AND
(
NOT (
(NOT IsSimpleValue( ARGUMENTS.Target.GetUser() )) AND
(ARGUMENTS.Target.GetUser().GetID() EQ ARGUMENTS.User.GetID())
)
))>
<cfreturn false />
</cfif>
</cfcase>
</cfswitch>
</cfcase>
<cfdefaultcase>
<cfreturn true />
</cfdefaultcase>
</cfswitch>
<cfreturn true />
</cffunction>