Package org.apache.turbine.om.security

Examples of org.apache.turbine.om.security.Permission


    public void testRenamePermission()
      throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();

        Permission newbie = ss.getPermissionInstance("newbie");
        ss.addPermission(newbie);

        Permission test = ss.getPermissionByName("newbie");
        assertNotNull(test);

        ss.renamePermission(test, "fake");

        Permission fake = ss.getPermissionByName("fake");
        assertNotNull(fake);

//
// Now this is a Turbine Bug...
//
View Full Code Here


    public static final Vector getDifference(Vector some, Vector all)
    {
        Vector clone = (Vector) all.clone();
        for (Enumeration e = some.elements() ; e.hasMoreElements() ;)
        {
            Permission tmp = (Permission) e.nextElement();
            for (Enumeration f = clone.elements() ; f.hasMoreElements() ;)
            {
                Permission tmp2 = (Permission) f.nextElement();
                if (((Persistent) tmp).getPrimaryKey() ==
                    ((Persistent) tmp2).getPrimaryKey())
                {
                    clone.removeElement(tmp2);
                    break;
View Full Code Here

        //
        // Wrap the returned Objects into TorquePermissions.
        //
        for (Iterator it = list.iterator(); it.hasNext(); )
        {
            Permission p = getNewPermission((Persistent) it.next());
            newList.add(p);
        }

        return newList;
    }
View Full Code Here

     *
     */

    public static Permission getNewPermission(Persistent p)
    {
        Permission perm = null;
        try
        {
            Class permissionWrapperClass = TurbineSecurity.getPermissionClass();

            Class [] clazz = new Class [] { Persistent.class };
View Full Code Here

            List results = new ArrayList();

            // Populate the object(s).
            for (int i = 0; i < rows.size(); i++)
            {
                Permission obj = TurbineSecurity.getPermissionInstance(null);
                Record row = (Record) rows.get(i);
                ((SecurityObject) obj).setPrimaryKey(
                        new NumberKey(row.getValue(1).asInt()));
                ((SecurityObject) obj).setName(row.getValue(2).asString());
                byte[] objectData = row.getValue(3).asBytes();
View Full Code Here

    public static final Vector getDifference(Vector some, Vector all)
    {
        Vector clone = (Vector) all.clone();
        for (Enumeration e = some.elements(); e.hasMoreElements();)
        {
            Permission tmp = (Permission) e.nextElement();
            for (Enumeration f = clone.elements(); f.hasMoreElements();)
            {
                Permission tmp2 = (Permission) f.nextElement();
                if (((BaseObject) tmp).getPrimaryKey()
                        == ((BaseObject) tmp2).getPrimaryKey())
                {
                    clone.removeElement(tmp2);
                    break;
View Full Code Here

     * @throws UnknownEntityException if the object could not be instantiated.
     */
    public Permission getPermissionInstance()
            throws UnknownEntityException
    {
        Permission permission;
        try
        {
            permission = (Permission) getPermissionClass().newInstance();
        }
        catch (Exception e)
View Full Code Here

     * @throws UnknownEntityException if the object could not be instantiated.
     */
    public Permission getPermissionInstance(String permName)
            throws UnknownEntityException
    {
        Permission perm = getPermissionInstance();
        perm.setName(permName);
        return perm;
    }
View Full Code Here

     * @throws UnknownEntityException if the permission does not exist.
     */
    public Permission getPermissionByName(String name)
            throws DataBackendException, UnknownEntityException
    {
        Permission permission = getAllPermissions().getPermissionByName(name);
        if (permission == null)
        {
            throw new UnknownEntityException(
                    "The specified permission does not exist");
        }
View Full Code Here

     */
    public Permission getPermissionById(int id)
            throws DataBackendException,
                   UnknownEntityException
    {
        Permission permission = getAllPermissions().getPermissionById(id);
        if (permission == null)
        {
            throw new UnknownEntityException(
                    "The specified permission does not exist");
        }
View Full Code Here

TOP

Related Classes of org.apache.turbine.om.security.Permission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.