+ Start a Discussion
Nikunj VNikunj V 

not able to access the page without author apex permission

Hey,

       I have created vf page , code is given below. page is working fine with the permission , but i need to give autor apex permission otherwise it isn't working. i cant give that to every profile and if i disable it than the page stops working. here is the code , what should i do?
 
<apex:page standardController="Project__c" sidebar="false" showHeader="false" extensions="ProjectTime_Controller" id="TimeTrack" standardStylesheets="false" docType="html-5.0">
    <html lang="en">
        <head>
            <meta charset="utf-8" />
            <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
            <meta name="viewport" content="width=device-width, initial-scale=1"/>
            <meta name="description" content=""/>
            <meta name="author" content=""/>
    
            <title>Time Station</title>
    
            <!-- Bootstrap core CSS -->
            <apex:stylesheet value="{!URLFOR($Resource.Bootstrap3_3_2, '/bootstrap-3.3.2-dist/css/bootstrap.min.css')}" />
            <!-- Bootstrap theme -->
            <apex:stylesheet value="{!URLFOR($Resource.Bootstrap3_3_2, '/bootstrap-3.3.2-dist/css/bootstrap-theme.min.css')}" />
        </head>

        <body role="document">
            <div class="panel panel-default">
            <div class="panel-body">  
            <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">Time Station</h3>
            </div>
            <div class="panel-body">

        <script>
            var pos = {};
            function success(position) {
              pos = position.coords;
              console.log(pos);
            }
            
            function error(msg) {
             console.log(msg);
            }
            
            if (navigator.geolocation) {
              navigator.geolocation.getCurrentPosition(success, error);
            } else {
              error('not supported');
            }
            
            function setPos() {
                var inputs = document.getElementsByTagName('input');
                for(var x = 0; x < inputs.length; x++) {
                    if(inputs[x].id.indexOf('contactlat') >= 0) { inputs[x].value = pos.latitude; }
                    if(inputs[x].id.indexOf('contactlong') >= 0) { inputs[x].value = pos.longitude; }
                }
            }
                        
             if('{!showMessage}'=='True'){
                 alert('You Are not Logged In any project, so you can not switch project, please select a project and Punch In to log time');
             }
            
        </script>
        
        <apex:form >
        <apex:pageBlock rendered="{!AcitivityStatus}">
        <div class="alert alert-info">
        <center><b>Your Are Currently Logged in "{!sObjName}" </b></center>
        </div>
       
        </apex:pageBlock>
            <center><apex:commandButton action="{!Back}" value="Select Project To Log Time" rendered="{!disablepro}" styleClass="btn btn-lg btn-primary" /></center> <!--style="height:45px;width:230px;font-size:15px;" -->
            <center><apex:commandButton action="{!P_Out_Main}" value="Punch Out" onclick="setPos();" rendered="{!AcitivityStatus}" styleClass="btn btn-lg btn-primary"/></center><br/><br/> <!--style="height:40px;width:180px;font-size:15px;"-->
            <center><apex:commandButton action="{!actionDo}" value="Switch Project" rendered="{!AcitivityStatus}" styleClass="btn btn-lg btn-primary"/></center>
            <apex:inputhidden value="{!valuelat}" id="contactlat"/> 
            <apex:inputhidden value="{!valuelong}" id="contactlong" />
         </apex:form>
     </div>
     </div>
     </div>
     </div>
     </body>
     </html>
</apex:page>

 
Best Answer chosen by Nikunj V
David ZhuDavid Zhu
You don't have to give Author permission.

Go to Build | Development | Pages, find the page, click "Security" link beside that page, assign access permission to the Profile(s).