Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8308547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:50:37+00:00 2026-06-08T18:50:37+00:00

I am making a social website using Zend. The site allows users to become

  • 0

I am making a social website using Zend. The site allows users to become friends and access each other’s profiles and blogs. I also want users to have control over their privacy, which can take parameters “Friends Only” and “Public”. I looked at Zend_Acl but it seems to be only able to to handle single user’s accessibility not users have relationship. Any ideas about the best way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:50:39+00:00Added an answer on June 8, 2026 at 6:50 pm

    For your purposes, if you use Zend_Acl, you should look at assertions.

    Given the complex nature of the relationships between users in your applications, most of the access rules you will query seem very dynamic so they will largely rely on assertions that can use more complex logic to determine accessibility.

    You should be able to accomplish what you want using Zend_Acl though.

    You may set up an ACL rule like this:

    $acl->allow('user', 'profile', 'view', new My_Acl_Assertion_UsersAreFriends());
    

    The ACL assertion itself:

    <?php
    
    class My_Acl_Assertion_UsersAreFriends implements Zend_Acl_Assert_Interface
    {
        public function assert(Zend_Acl $acl,
                               Zend_Acl_Role_Interface $role = null,
                               Zend_Acl_Resource_Interface $resource = null,
                               $privilege = null)
        {
            return $this->_usersAreFriends();
        }
    
        protected function _usersAreFriends()
        {
            // get UserID of current logged in user
            // assumes Zend_Auth has stored a User object of the logged in user
            $user   = Zend_Auth::getInstance()->getStorage();
            $userId = $user->getId();
    
            // get the ID of the user profile they are trying to view
            // assume you can pull it from the URL
            // or your controller or a plugin can set this value another way
            $userToView = $this->getRequest()->getParam('id', null);
    
            // call your function that checks the database for the friendship
            $usersAreFriends = usersAreFriends($userId, $userToView);
    
            return $usersAreFriends;
        }
    }
    

    Now with this assertion in place, the access will be denied if the 2 user IDs are not friends.

    Check it like:

    if ($acl->isAllowed('user', 'profile', 'view')) {
        // This will use the UsersAreFriends assertion
    
        // they can view profile
    } else {
        // sorry, friend this person to view their profile
    }
    

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a Social Networking Website using this book called PHP5 Social Networking. I'm
I'm making a social website with lots of different sections, like blogs, galleries, multimedia
I'm making a social networking site and I have two types of statuses. Friends
I'm making a Social networking website for my friends. i wanted to know how
Im making a website using Drupal 7. I just installed the ' Social Media
I am making a web-site , which is a social network. There is need
I am making a social networking site and can't decide what the best way
I'm making a social networking site powered by Plone and would like to set
making an Access database (2003) that is mainly used by other programmers and tech
I am making a social networking site where I want to have a user's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.