@ Override public List < String > getRoles ( String name , String ... domain ) { if ( domain . length == 1 ) { name = domain [ 0 ] + "::" + name ; } else if ( domain . length > 1 ) { throw new Error ( "error: domain should be 1 parameter" ) ; } if ( ! hasRole ( name ) ) { throw new Error ( "error: name does not exist" ) ; } List < String > roles = createRole ( name ) . getRoles ( ) ; if ( domain . length == 1 ) { for ( int i = 0 ; i < roles . size ( ) ; i ++ ) { roles . set ( i , roles . get ( i ) . substring ( domain [ 0 ] . length ( ) + 2 , roles . get ( i ) . length ( ) ) ) ; } } return roles ; }
getRoles gets the roles that a subject inherits . domain is a prefix to the roles .