Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SPOPS::Secure::Util(3)User Contributed Perl DocumentatioSPOPS::Secure::Util(3)

NAME
       SPOPS::Secure::Util - Common utilities for SPOPS::Secure	and subclasses

SYNOPSIS
	my $levels = SPOPS::Secure::Util->parse_object_into_hashref(	\@security_objects );
	print "Given security from objects:\n",
	      "USER: $levels->{ SEC_SCOPE_USER() }\n",
	      "WORLD: $levels->{ SEC_SCOPE_WORLD() }\n";
	      "GROUP [ID/LEVEL]: ";
	print join( ' ', map { "[$_/$levels->{ SEC_SCOPE_GROUP() }{ $_ }" }
			     keys %{ $levels->{ SEC_SCOPE_GROUP() } } );

	# Not sure if $item is class or	object?

	sub somesub {
	    my ( $item,	$params	) = @_;
	    my ( $object_class,	$object_id ) =
				SPOPS::Secure::Util->find_class_and_oid( $item, $params );
	}

DESCRIPTION
       Common utility methods for security tasks.

METHODS
       All methods are class methods.

       parse_objects_into_hashref( \@security_objects )

       Places the relevant information from "\@security_objects" into a
       hashref for easy	analysis. If no	objects	are in "\@security_objects" it
       returns undef. Otherwise	the returned hashref should have as the	three
       keys the	constants "SEC_SCOPE_WORLD", "SEC_SCOPE_GROUP" and
       "SEC_SCOPE_USER".

       The values of "SEC_SCOPE_WORLD" and "SEC_SCOPE_USER" are	a single value
       corresponding to	one of the "SEC_LEVEL_*" constants. The	value of
       "SEC_LEVEL_GROUP" is another hashref with the keys as the group IDs
       each of which has a single value	corresponding to one of	the
       "SEC_LEVEL_*" constants.

       find_class_and_oid( [$class|$object], \%params )

       Useful when a method can	be called as a class or	object method and the
       class/ID	to be analyzed can be either in	the object calling or in the
       class and the parameters.

       Returns a two-argument list. The	first is the object class, the second
       is the object ID.

       If the first argument is	an object and it has a method "id()", we
       assign the result of calling it to the object ID; for the object	class
       we call "ref" on	the object.

       Otherwise we look in "\%params" for a parameter 'class'.	If it is not
       found we	use the	first argument.	For the	object ID we look in
       "\%params" for a	parameter 'object_id' or 'oid'.	If neither are found
       we assign '0' to	the object ID.	For example:

	my $class = 'My::Object'; my ( $object_class, $object_id ) =
			   SPOPS::Secure::Util->find_class_and_oid( $class, { object_id	=> 5 } );
	# $object_class	= 'My::Object';	$object_id = 5

	my $object = My::OtherObject->new({ id => 99 });
	my ( $object_class, $object_id ) =
			   SPOPS::Secure::Util->find_class_and_oid( $object );
	# $object_class	= 'My::OtherObject'; $object_id	= 99

BUGS
       None known.

TO DO
       Nothing known.

SEE ALSO
COPYRIGHT
       Copyright (c) 2002-2004 intes.net, inc..	All rights reserved.

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

AUTHORS
       Chris Winters <chris@cwinters.com>

perl v5.32.1			  2004-06-02		SPOPS::Secure::Util(3)

NAME | SYNOPSIS | DESCRIPTION | METHODS | BUGS | TO DO | SEE ALSO | COPYRIGHT | AUTHORS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=SPOPS::Secure::Util&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help